Difference between revisions of "Sparql endpoint"
(→The following contains some sparql query examples) |
(→The following contains some sparql query examples) |
||
Line 3: | Line 3: | ||
==== The following contains some sparql query examples ==== | ==== The following contains some sparql query examples ==== | ||
[[Examples]] | [[Examples]] | ||
+ | |||
+ | [[Maintenance]] | ||
===== Query 1, find events which have country location, city location, start date, end date, and home page ===== | ===== Query 1, find events which have country location, city location, start date, end date, and home page ===== |
Revision as of 16:36, 16 February 2017
Contents
- 1 Sparql endpoint The SPARQL endpoint for the RDF dataset of OpenResearch is accessable here ==> sparql
- 2 The following contains some sparql query examples
- 2.1 Query 1, find events which have country location, city location, start date, end date, and home page
- 2.2 Query 2, get events happen in Europe between 2016-01-01 and 2017-01-01, with acceptance rate less than 25%, with related to "semantic web"
- 2.3 Query 3, get pc members and general chairs who involve semantic web related events in last 7 years
- 2.4 Query 4, Which period of year have had the most number of events organized for a specific field or topic
- 2.5 Query 5, List growing topics in the last 10 years. (definition of growing topic: a topic which corresponding events have an increasing number of submissions in each new edition is growing e.g., Semantic Web is growing because Number of submissions for each edition of Event E in category of this topic from 2007 are growing: E2007=120, E2008=130, E2009=131, E2010=140,...E2016=220)
- 2.6 Query 6, In what event, Person P had some role (either a chair, co-chair, PC member or participants), example: "Harith Alani"
- 2.7 Query 7, List of conferences with best (lowest) acceptance rate in topic T; Example: list 10 conferences of topic "Semantic Web" sort in descending order based on Acceptance_rate
- 2.8 Query 8, What might be the registration fee of event E in the coming edition?
- 2.9 Query 9, Number or List of conferences and workshops of topic T in Year Y1 and Y2;example: list of conferences and workshops in topic "Semantic Web" happen in the years 2016, 2017
Sparql endpoint The SPARQL endpoint for the RDF dataset of OpenResearch is accessable here ==> sparql
The following contains some sparql query examples
Query 1, find events which have country location, city location, start date, end date, and home page
PREFIX rdfs: <http://www.w3.org/2000/01/rdf-schema#> PREFIX swivt: <http://semantic-mediawiki.org/swivt/1.0#> PREFIX property: <http://openresearch.org/Special:URIResolver/Property-3A> PREFIX category: <http://openresearch.org/Special:URIResolver/Category-3A> PREFIX wiki: <http://openresearch.org/Special:URIResolver/> PREFIX icaltzd: <https://www.w3.org/2002/12/cal/icaltzd#> PREFIX foaf: <http://xmlns.com/foaf/0.1/> SELECT ?event ?endDate ?startDate ?city ?country ?wikipage ?homepage WHERE { ?e property:Has_location_country category:Germany. ?e rdfs:label ?event. ?e property:Has_location_city ?city. ?e property:Has_location_country ?country. ?e icaltzd:dtend ?endDate. ?e icaltzd:dtstart ?startDate. ?e foaf:homepage ?homepage. ?e swivt:page ?wikipage. } ORDER BY DESC(?startDate) LIMIT 100
PREFIX rdf: <http://www.w3.org/1999/02/22-rdf-syntax-ns#> PREFIX rdfs: <http://www.w3.org/2000/01/rdf-schema#> PREFIX swivt: <http://semantic-mediawiki.org/swivt/1.0#> PREFIX property: <http://openresearch.org/Special:URIResolver/Property-3A> PREFIX category: <http://openresearch.org/Special:URIResolver/Category-3A> PREFIX wiki: <http://openresearch.org/Special:URIResolver/> PREFIX site: <http://openresearch.org/Special:ExportRDF/> PREFIX xsd: <http://www.w3.org/2001/XMLSchema#> PREFIX icaltzd: <https://www.w3.org/2002/12/cal/icaltzd#> PREFIX foaf: <http://xmlns.com/foaf/0.1/> SELECT ?event ?endDate ?startDate ?city ?country ?wikipage ?acceptanceRate ?continent WHERE { ?e rdfs:label ?event. ?e property:Has_location_country ?country. ?country rdfs:subClassOf ?partContinent. ?partContinent rdfs:subClassOf ?continent. ?continent rdfs:isDefinedBy site:Category:Europe. ?e a category:Semantic_Web. ?e icaltzd:dtstart ?startDate. ?e icaltzd:dtend ?endDate. ?e property:Acceptance_rate ?acceptanceRate. ?e property:Has_location_city ?city. ?e swivt:page ?wikipage. FILTER (?acceptanceRate < 25.0 && ?startDate >= "2016-01-01"^^xsd:date && ?endDate < "2017-01-01"^^xsd:date). } ORDER BY DESC(?startDate) LIMIT 100
PREFIX rdf: <http://www.w3.org/1999/02/22-rdf-syntax-ns#> PREFIX rdfs: <http://www.w3.org/2000/01/rdf-schema#> PREFIX swivt: <http://semantic-mediawiki.org/swivt/1.0#> PREFIX urir: <http://openresearch.org/Special:URIResolver/> PREFIX property: <http://openresearch.org/Special:URIResolver/Property-3A> PREFIX category: <http://openresearch.org/Special:URIResolver/Category-3A> PREFIX wiki: <http://openresearch.org/Special:URIResolver/> PREFIX site: <http://openresearch.org/Special:ExportRDF/> PREFIX xsd: <http://www.w3.org/2001/XMLSchema#> PREFIX icaltzd: <https://www.w3.org/2002/12/cal/icaltzd#> SELECT ?event ?endDate ?startDate ?pcMember ?geMember WHERE { ?e rdfs:label ?event. ?e property:Has_PC_member ?pcMember. ?e property:Has_general_chair ?geMember. ?e a category:Semantic_Web. ?e icaltzd:dtstart ?startDate. ?e icaltzd:dtend ?endDate. minus {?e property:Has_PC_member urir:Some_person.} FILTER (?startDate >= "2010-01-01"^^xsd:date && ?endDate < "2017-01-01"^^xsd:date). } ORDER BY DESC(?startDate) LIMIT 10
Query 4, Which period of year have had the most number of events organized for a specific field or topic
PREFIX rdf: <http://www.w3.org/1999/02/22-rdf-syntax-ns#> PREFIX rdfs: <http://www.w3.org/2000/01/rdf-schema#> PREFIX xsd: <http://www.w3.org/2001/XMLSchema#> PREFIX property: <http://openresearch.org/Special:URIResolver/Property-3A> PREFIX category: <http://openresearch.org/Special:URIResolver/Category-3A> PREFIX icaltzd: <https://www.w3.org/2002/12/cal/icaltzd#> SELECT ?month (count(?e) as ?numEvents) WHERE { ?e rdfs:label ?event. ?e icaltzd:dtend ?endDate. ?e icaltzd:dtstart ?startDate. ?e a category:Semantic_Web. Filter (datatype(?endDate) != xsd:double && datatype(?startDate) != xsd:double) FILTER (?startDate >= "2016-01-01"^^xsd:date && ?endDate < "2017-01-01"^^xsd:date). VALUES ?month {1 2 3 4 5 6 7 8 9 10 11 12} FILTER ( month(?startDate) <= ?month && ?month <= month(?endDate) ) } GROUP BY ?month
Query 5, List growing topics in the last 10 years. (definition of growing topic: a topic which corresponding events have an increasing number of submissions in each new edition is growing e.g., Semantic Web is growing because Number of submissions for each edition of Event E in category of this topic from 2007 are growing: E2007=120, E2008=130, E2009=131, E2010=140,...E2016=220)
PREFIX rdf: <http://www.w3.org/1999/02/22-rdf-syntax-ns#> PREFIX rdfs: <http://www.w3.org/2000/01/rdf-schema#> PREFIX swivt: <http://semantic-mediawiki.org/swivt/1.0#> PREFIX urir: <http://openresearch.org/Special:URIResolver/> PREFIX property: <http://openresearch.org/Special:URIResolver/Property-3A> PREFIX category: <http://openresearch.org/Special:URIResolver/Category-3A> PREFIX wiki: <http://openresearch.org/Special:URIResolver/> PREFIX site: <http://openresearch.org/Special:ExportRDF/> PREFIX xsd: <http://www.w3.org/2001/XMLSchema#> PREFIX icaltzd: <https://www.w3.org/2002/12/cal/icaltzd#> PREFIX smwont: <http://data.semanticweb.org/ns/swc/ontology#> SELECT ?series ?numEvents ?topic ?events ?years WHERE{ ?series a ?topic. ?topic rdfs:subClassOf category:Computer_Science. FILTER(?numEvents = 10). { SELECT ?series (count(?e) as ?numEvents) (group_concat(distinct ?e; separator="; ") as ?events) (group_concat(distinct ?startDate; separator="; ") as ?years) WHERE { ?e rdfs:label ?event. ?e a smwont:ConferenceEvent. ?e property:Event_in_series ?series. ?e property:Submitted_papers ?num_papers. ?e icaltzd:dtstart ?startDate. ?e icaltzd:dtend ?endDate. FILTER (datatype(?endDate) != xsd:double && datatype(?startDate) != xsd:double). FILTER (?startDate >= "2007-01-01"^^xsd:date && ?endDate < "2017-01-01"^^xsd:date). }Group by ?series } }
Query 6, In what event, Person P had some role (either a chair, co-chair, PC member or participants), example: "Harith Alani"
PREFIX rdf: <http://www.w3.org/1999/02/22-rdf-syntax-ns#> PREFIX rdfs: <http://www.w3.org/2000/01/rdf-schema#> PREFIX swivt: <http://semantic-mediawiki.org/swivt/1.0#> PREFIX urir: <http://openresearch.org/Special:URIResolver/> PREFIX property: <http://openresearch.org/Special:URIResolver/Property-3A> PREFIX category: <http://openresearch.org/Special:URIResolver/Category-3A> PREFIX wiki: <http://openresearch.org/Special:URIResolver/> PREFIX site: <http://openresearch.org/Special:ExportRDF/> PREFIX xsd: <http://www.w3.org/2001/XMLSchema#> PREFIX icaltzd: <https://www.w3.org/2002/12/cal/icaltzd#> SELECT ?event ?endDate ?startDate ?person ?hasRole WHERE { ?e rdfs:label ?event. ?e ?hasRole ?person. ?hasRole rdfs:subPropertyOf property:Has_person. ?person rdfs:label "Harith Alani". ?e icaltzd:dtstart ?startDate. ?e icaltzd:dtend ?endDate. }
Query 7, List of conferences with best (lowest) acceptance rate in topic T; Example: list 10 conferences of topic "Semantic Web" sort in descending order based on Acceptance_rate
PREFIX rdf: <http://www.w3.org/1999/02/22-rdf-syntax-ns#> PREFIX rdfs: <http://www.w3.org/2000/01/rdf-schema#> PREFIX swivt: <http://semantic-mediawiki.org/swivt/1.0#> PREFIX property: <http://openresearch.org/Special:URIResolver/Property-3A> PREFIX category: <http://openresearch.org/Special:URIResolver/Category-3A> PREFIX wiki: <http://openresearch.org/Special:URIResolver/> PREFIX site: <http://openresearch.org/Special:ExportRDF/> PREFIX xsd: <http://www.w3.org/2001/XMLSchema#> PREFIX icaltzd: <https://www.w3.org/2002/12/cal/icaltzd#> PREFIX foaf: <http://xmlns.com/foaf/0.1/> PREFIX smwont: <http://data.semanticweb.org/ns/swc/ontology#> SELECT ?event ?endDate ?startDate ?city ?country ?wikipage ?acceptanceRate WHERE { ?e rdfs:label ?event. ?e property:Has_location_country ?country. ?e a category:Semantic_Web. ?e a ?EventTypes. ?e icaltzd:dtstart ?startDate. ?e icaltzd:dtend ?endDate. ?e property:Acceptance_rate ?acceptanceRate. ?e property:Has_location_city ?city. ?e swivt:page ?wikipage. FILTER (datatype(?endDate) != xsd:double && datatype(?startDate) != xsd:double) } ORDER BY DESC(?acceptanceRate) LIMIT 10 BINDINGS ?EventTypes {(smwont:ConferenceEvent)}
Query 8, What might be the registration fee of event E in the coming edition?
PREFIX rdf: <http://www.w3.org/1999/02/22-rdf-syntax-ns#> PREFIX rdfs: <http://www.w3.org/2000/01/rdf-schema#> PREFIX swivt: <http://semantic-mediawiki.org/swivt/1.0#> PREFIX urir: <http://openresearch.org/Special:URIResolver/> PREFIX property: <http://openresearch.org/Special:URIResolver/Property-3A> PREFIX category: <http://openresearch.org/Special:URIResolver/Category-3A> PREFIX wiki: <http://openresearch.org/Special:URIResolver/> PREFIX site: <http://openresearch.org/Special:ExportRDF/> PREFIX xsd: <http://www.w3.org/2001/XMLSchema#> PREFIX icaltzd: <https://www.w3.org/2002/12/cal/icaltzd#> PREFIX smwont: <http://data.semanticweb.org/ns/swc/ontology#> SELECT ?series (count(?e) as ?numEvents) (group_concat(distinct ?attendFee; separator="; ") as ?fees) (group_concat(distinct ?e; separator="; ") as ?events) (group_concat(distinct ?startDate; separator="; ") as ?years) WHERE { ?e rdfs:label ?event. ?e a smwont:ConferenceEvent. ?e property:Event_in_series ?series. ?e property:Attendance_fee ?attendFee. ?e icaltzd:dtstart ?startDate. ?e icaltzd:dtend ?endDate. FILTER (datatype(?endDate) != xsd:double && datatype(?startDate) != xsd:double). FILTER (?startDate >= "2014-01-01"^^xsd:date && ?endDate < "2017-01-01"^^xsd:date). }Group by ?series
Query 9, Number or List of conferences and workshops of topic T in Year Y1 and Y2;example: list of conferences and workshops in topic "Semantic Web" happen in the years 2016, 2017
PREFIX rdf: <http://www.w3.org/1999/02/22-rdf-syntax-ns#> PREFIX rdfs: <http://www.w3.org/2000/01/rdf-schema#> PREFIX swivt: <http://semantic-mediawiki.org/swivt/1.0#> PREFIX property: <http://openresearch.org/Special:URIResolver/Property-3A> PREFIX category: <http://openresearch.org/Special:URIResolver/Category-3A> PREFIX wiki: <http://openresearch.org/Special:URIResolver/> PREFIX site: <http://openresearch.org/Special:ExportRDF/> PREFIX xsd: <http://www.w3.org/2001/XMLSchema#> PREFIX icaltzd: <https://www.w3.org/2002/12/cal/icaltzd#> PREFIX foaf: <http://xmlns.com/foaf/0.1/> PREFIX smwont: <http://data.semanticweb.org/ns/swc/ontology#> SELECT ?event ?endDate ?startDate ?city ?country ?wikipage ?acceptanceRate WHERE { ?e rdfs:label ?event. ?e property:Has_location_country ?country. ?e a category:Semantic_Web. ?e a ?EventTypes. ?e icaltzd:dtstart ?startDate. ?e icaltzd:dtend ?endDate. ?e property:Acceptance_rate ?acceptanceRate. ?e property:Has_location_city ?city. ?e swivt:page ?wikipage. FILTER (datatype(?endDate) != xsd:double && datatype(?startDate) != xsd:double) FILTER (?acceptanceRate < 25.0 && ?startDate >= "2016-01-01"^^xsd:date && ?endDate < "2018-01-01"^^xsd:date). } BINDINGS ?EventTypes {(smwont:ConferenceEvent) (smwont:WorkshopEvent)}