Difference between revisions of "Sparql endpoint"

From Openresearch
Jump to: navigation, search
Line 164: Line 164:
 
</pre>
 
</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
+
===== 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>
 
<pre>
Line 195: Line 194:
 
</pre>
 
</pre>
  
===== Query 8, What might be the registration fee of event E in the coming edition? (take the registration fee of last three editions and calculate the change, show the last edition fee +/the average of the two changes e.g., Registration fee of Event E2014=250, E2015= 300, E2016=310; difference of E2014 to E2015 is 50 and E2015 to E 2016 is 10 then (50 + 10)/2 = 30 ---> estimated fee for E2017 is 310 +30= ~340) IF this is difficult then let's just take a pattern of previous year and propose something similar.
+
===== Query 8, What might be the registration fee of event E in the coming edition? (take the registration fee of last three editions and calculate the change, show the last edition fee +/the average of the two changes e.g., Registration fee of Event E2014=250, E2015= 300, E2016=310; difference of E2014 to E2015 is 50 and E2015 to E 2016 is 10 then (50 + 10)/2 = 30 ---> estimated fee for E2017 is 310 +30= ~340) IF this is difficult then let's just take a pattern of previous year and propose something similar.(based on your calculation, we only need the value of E2014 and E2016, and their difference over 2 will the average range 310 - 250 = 60, 60 / 2 = 30 If E2014 = 250, E2015 = 200, E2016 = 240, then 240 - 250 = -10, -10 / 2 = -5 which is same as (-50 + 40) / 2) =====
(based on your calculation, we only need the value of E2014 and E2016, and their difference over 2 will the average range
+
 
310 - 250 = 60, 60 / 2 = 30
 
If E2014 = 250, E2015 = 200, E2016 = 240, then 240 - 250 = -10, -10 / 2 = -5 which is same as (-50 + 40) / 2
 
)
 
=====
 
 
<pre>
 
<pre>
 
PREFIX rdf: <http://www.w3.org/1999/02/22-rdf-syntax-ns#>
 
PREFIX rdf: <http://www.w3.org/1999/02/22-rdf-syntax-ns#>
Line 233: Line 228:
 
</pre>
 
</pre>
  
===== Query 9, Number or List of conferences and workshops of topic T in Year Y1 and Y2;example: list of conferences and workshops of topic "Semantic Web" happen in year 2016, 2017
+
===== 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>
 
<pre>

Revision as of 10:39, 1 February 2017

Contents

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
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#>
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
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#>
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? (take the registration fee of last three editions and calculate the change, show the last edition fee +/the average of the two changes e.g., Registration fee of Event E2014=250, E2015= 300, E2016=310; difference of E2014 to E2015 is 50 and E2015 to E 2016 is 10 then (50 + 10)/2 = 30 ---> estimated fee for E2017 is 310 +30= ~340) IF this is difficult then let's just take a pattern of previous year and propose something similar.(based on your calculation, we only need the value of E2014 and E2016, and their difference over 2 will the average range 310 - 250 = 60, 60 / 2 = 30 If E2014 = 250, E2015 = 200, E2016 = 240, then 240 - 250 = -10, -10 / 2 = -5 which is same as (-50 + 40) / 2)
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)}