Difference between revisions of "Sparql endpoint"

From Openresearch
Jump to: navigation, search
(The following contains some sparql query examples)
(Replaced content with "==== Sparql endpoint The SPARQL endpoint for the RDF dataset of OpenResearch is accessable here ==> [http://openresearch.org/sparql sparql]==== ==== The following page co...")
Line 1: Line 1:
 
==== Sparql endpoint The SPARQL endpoint for the RDF dataset of OpenResearch is accessable here ==> [http://openresearch.org/sparql sparql]====
 
==== Sparql endpoint The SPARQL endpoint for the RDF dataset of OpenResearch is accessable here ==> [http://openresearch.org/sparql sparql]====
  
==== The following contains some sparql query examples ====  
+
==== The following page contains example SPARQL query that can be used by users to get ideas on what type queries can be run====  
 
[[Examples]]
 
[[Examples]]
  
 +
==== The following page contains queries related to data quality ====
 
[[Maintenance]]
 
[[Maintenance]]
 
===== Query 1, find events which have country location, city location, start date, end date, and home page =====
 
<pre>
 
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
 
</pre>
 
 
===== 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" =====
 
<pre>
 
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
 
</pre>
 
 
===== Query 3, get pc members and general chairs who involve semantic web related events in last 7 years =====
 
<pre>
 
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
 
</pre>
 
 
===== Query 4, Which period of year have had the most number of events organized for a specific field or topic =====
 
<pre>
 
        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
 
</pre>
 
 
===== 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)=====
 
<pre>
 
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
 
  }
 
}
 
</pre>
 
 
===== Query 6, In what event, Person P had some role (either a chair, co-chair, PC member or participants), example: "Harith Alani" =====
 
<pre>
 
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.
 
}
 
</pre>
 
 
===== 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 =====
 
 
<pre>
 
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)}
 
 
</pre>
 
 
===== Query 8, What might be the registration fee of event E in the coming edition? =====
 
 
<pre>
 
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
 
 
</pre>
 
 
===== 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 =====
 
 
<pre>
 
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)}
 
</pre>
 

Revision as of 16:42, 16 February 2017

Sparql endpoint The SPARQL endpoint for the RDF dataset of OpenResearch is accessable here ==> sparql

The following page contains example SPARQL query that can be used by users to get ideas on what type queries can be run

Examples

The following page contains queries related to data quality

Maintenance