Skip to content

Latest commit

 

History

History
141 lines (130 loc) · 14.3 KB

SPARQL.md

File metadata and controls

141 lines (130 loc) · 14.3 KB

Statistics

The results of these queries were computed over the whole dataset (loaded on Virtuoso 07.20.3215).

Query Number Statistic Value
1 Number of triples 23,033,490
2 Number labelled nodes 2,610,223
3 Number of main processes 215,959

Sample Endpoint

You can try some of these queries at the Dydra public endpoint. For federated queries, use this URI.

NOTE: this endpoint does not expose the whole dataset! Some query results might be missing or incomplete.

Query Prefixes

Standard prefixes for all the queries:

PREFIX prohow: <http://w3id.org/prohow#> 
PREFIX rdf: <http://www.w3.org/1999/02/22-rdf-syntax-ns#> 
PREFIX rdfs: <http://www.w3.org/2000/01/rdf-schema#> 
PREFIX oa: <http://www.w3.org/ns/oa#> 
PREFIX owl: <http://www.w3.org/2002/07/owl#> 

Queries

Query 1) Count the number of triples. Try it!

SELECT (COUNT(*) AS ?no) WHERE { ?s ?p ?o  }

Query 2) Count the number of entities with an associated label. Try it!

SELECT (COUNT(distinct ?s) AS ?no) WHERE { ?s rdfs:label ?o  }

Query 3) Count of number of distinct sets of instructions. Try it!

SELECT (COUNT(distinct ?main) AS ?no) WHERE { ?main rdf:type prohow:instruction_set }

Query 4) Search main sets of instructions that contain substring "email account" in the label. Try it!

SELECT ?main ?label WHERE { 
 ?main rdf:type prohow:instruction_set .
 ?main rdfs:label ?label 
 FILTER regex(str(?label), "email account", "i" )
} LIMIT 100

Query 5) Get the title and types (categories) of a set of instructions. Try it!

SELECT ?label ?type WHERE { 
  <http://vocab.inf.ed.ac.uk/procont#?url=http://www.wikihow.com/make-pizza-dough&t=1396510456016&n=11094&k=mainentity> rdfs:label ?label . 
  <http://vocab.inf.ed.ac.uk/procont#?url=http://www.wikihow.com/make-pizza-dough&t=1396510456016&n=11094&k=mainentity> rdf:type / rdfs:subClassOf* ?type
} LIMIT 100

Query 6) Select the various methods of a process (query result is empty if the process does not have sub-methods). Try it!

SELECT ?method ?label WHERE { 
 <http://vocab.inf.ed.ac.uk/procont#?url=http://www.wikihow.com/create-an-email-account&t=1396532526446&n=1068622&k=mainentity> prohow:has_method ?method . 
 ?method rdfs:label ?label 
} LIMIT 100

Query 7) Select the various steps of a process (query result is empty if the process does not have sub-steps). Try it!

SELECT ?step ?label WHERE { 
  <http://vocab.inf.ed.ac.uk/procont#?url=http://www.wikihow.com/create-an-email-account&t=1396532526447&n=1068628> prohow:has_step ?step . 
  ?step rdfs:label ?label 
} LIMIT 100

Query 8) Select the various requirements of a process (query result is empty if the process does not have requirements). Try it!

SELECT ?requirement ?label WHERE { 
<http://vocab.inf.ed.ac.uk/procont#?url=http://www.wikihow.com/make-pizza-dough&t=1396510456016&n=11094&k=mainentity> prohow:requires ?requirement . 
?requirement rdfs:label ?label 
} LIMIT 100

Query 9) Like Query 8), but optionally return the DBpedia resource linked to each requirement (when available). Try it!

SELECT ?requirement ?label ?type WHERE { 
<http://vocab.inf.ed.ac.uk/procont#?url=http://www.wikihow.com/make-pizza-dough&t=1396510456016&n=11094&k=mainentity> prohow:requires ?requirement . 
?requirement rdfs:label ?label 
OPTIONAL {?requirement rdf:type ?type} 
} LIMIT 100

Query 10) Find the 100 most common requirements. Try it!

SELECT ?type (COUNT (DISTINCT ?main) as ?no) WHERE { 
?main prohow:requires ?requirement .
?requirement rdf:type ?type
} GROUP BY ?type ?no ORDER BY desc(?no) LIMIT 100

Query 11) Find the 100 most common outputs. Try it!

SELECT ?type (COUNT (DISTINCT ?output) as ?no) WHERE { 
?main rdf:type prohow:instruction_set .
?output prohow:has_method ?main .
?output rdf:type ?type
} GROUP BY ?type ?no ORDER BY desc(?no) LIMIT 100

Query 12) Find the type of requirements most correlated with a particular requirement (in this example, the query can be interpreted as: "what is usually used in conjunction with Paper"?). Try it!

SELECT ?type (COUNT (DISTINCT ?other_req) as ?no)
WHERE { 
?main rdf:type prohow:instruction_set .
?main prohow:requires ?requirement . 
?requirement rdf:type <http://dbpedia.org/resource/Paper> .
?main prohow:requires ?other_req . 
?other_req rdf:type ?type
FILTER (?type != <http://dbpedia.org/resource/Paper>)
} GROUP BY ?type ORDER BY desc(?no) LIMIT 20

Query 13) The Linked Data representation of instructions is linked to the web documents it was extracted from using the Open Annotation data model. This query finds the original source webpages of 20 instruction entities, along with the exact text span they relate to: Try it!

SELECT DISTINCT ?exact ?source ?main
WHERE { 
?annotation oa:hasBody ?main . 
?main rdf:type prohow:instruction_set .
?annotation oa:hasTarget ?target . 
?target oa:hasSource ?source .
?target oa:hasSelector ?selector .
?selector oa:exact ?exact .
} LIMIT 20

Query 14) The multilingual version of the dataset contains different versions in different languages of the same set of instructions. If you are using this data, you can use this query to find out pairs of instructions in different languages, along with their label, which refer to the same set of instructions: Try it!

SELECT DISTINCT ?a ?b ?a_label ?b_label
WHERE {
?a rdf:type prohow:instruction_set .
?b rdf:type prohow:instruction_set .
?ann_a oa:hasBody ?a .
?ann_b oa:hasBody ?b .
?ann_a oa:hasTarget ?tar_a .
?ann_b oa:hasTarget ?tar_b .
?tar_a owl:sameAs ?tar_b . 
?a rdfs:label ?a_label . 
?b rdfs:label ?b_label . 
}