sparql-examples

A set of SPARQL examples that are used in different TGX resources

View the Project on GitHub BiGCAT-UM/sparql-examples

118

rq turtle/ttl

Organization aspect: recent literature

Use at

PREFIX bd: <http://www.bigdata.com/rdf#>
PREFIX p: <http://www.wikidata.org/prop/>
PREFIX rdfs: <http://www.w3.org/2000/01/rdf-schema#>
PREFIX wdt: <http://www.wikidata.org/prop/direct/>
PREFIX wikibase: <http://wikiba.se/ontology#>
PREFIX xsd: <http://www.w3.org/2001/XMLSchema#>
#defaultView:Table

PREFIX target: <http://www.wikidata.org/entity/Q104785223>

SELECT
  ?publication_date
  ?work ?workLabel
  ?researchers ?researchersUrl
WITH {
  SELECT 
    (MIN(?publication_datetimes) AS ?publication_datetime) ?work 
    (GROUP_CONCAT(DISTINCT ?researcher_label; separator=', ') AS ?researchers)
    (CONCAT("../authors/", GROUP_CONCAT(DISTINCT SUBSTR(STR(?researcher), 32); separator=",")) AS ?researchersUrl)
  WHERE {                                                         
    ?researcher ( wdt:P108 | wdt:P463 | wdt:P1416 ) / wdt:P361* target: .
    ?work wdt:P50 ?researcher .
    ?researcher rdfs:label ?researcher_label . FILTER (LANG(?researcher_label) = 'en')
    OPTIONAL {
      ?work wdt:P577 ?publication_datetimes .
    }
  }
  GROUP BY ?work
  ORDER BY DESC(?publication_datetime)
  LIMIT 200  
} AS %results
WHERE {
  INCLUDE %results
  BIND(xsd:date(?publication_datetime) AS ?publication_date)
  SERVICE wikibase:label { bd:serviceParam wikibase:language "[AUTO_LANGUAGE],mul,en" . }
}
ORDER BY DESC(?publication_date)

graph TD