Sparql endpoint

From Openresearch
Revision as of 15:38, 26 September 2016 by Liy1 (talk | contribs)
Jump to: navigation, search

Sparql endpoint

The sparql endpoint for the RDF dataset of OpenResearch is in 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/>

SELECT ?event ?endDate ?startDate ?city ?country ?wikipage ?homepage WHERE {
  ?e property:Has_location_country category:Germany .
  ?e rdfs:label ?event.
  ?e property:Start_date ?startDate.
  ?e property:End_date ?endDate.
  #?e property:Creation_date-23aux ?pageCreationDate.
  #?e property:Accepted_papers ?acceptedPapers.
  #?e property:Acceptance_rate ?acceptanceRate.
  ?e property:Has_location_city ?city.
  ?e property:Has_location_country ?country.
  ?e property:Homepage ?homepage.
  ?e swivt:page ?wikipage
} ORDER BY DESC(?startDate) LIMIT 100
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"
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#>

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 property:Start_date ?startDate.
  ?e property:End_date ?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
Query 3, get pc members and general chairs who involve semantic web related events in last 7 years
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#>


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 property:Start_date ?startDate.
  ?e property:End_date ?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