query-5001bd880b4c6581591feecf2cc0129f
Query #7: Select 'written works' and 'academic journal articles' by subject: (linked data)
Use at
- https://query.wikidata.org/sparql
PREFIX wikibase: <http://wikiba.se/ontology#>
PREFIX wdt: <http://www.wikidata.org/prop/direct/>
PREFIX wd: <http://www.wikidata.org/entity/>
PREFIX rdfs: <http://www.w3.org/2000/01/rdf-schema#>
PREFIX bd: <http://www.bigdata.com/rdf#>
SELECT DISTINCT ?item ?title ?mainSubjectLabel ?itemTypeLabel (GROUP_CONCAT(DISTINCT ?authorLabel; SEPARATOR = ", ") AS ?authors)
WHERE
{
{
?item wdt:P31 wd:Q47461344 ; # instance of a written work
wdt:P31 ?itemType ;
rdfs:label ?title .
?item wdt:P921 wd:Q515701 ; # has the term 'linked data' as main subject
wdt:P921 ?mainSubject .
?item wdt:P50 ?author .
?author rdfs:label ?authorLabel .
FILTER (LANG(?authorLabel) = "en")
FILTER (LANG(?title) = "en")
}
UNION
{
?item wdt:P31 wd:Q18918145 ; # instance of a academic journal article
wdt:P31 ?itemType ;
rdfs:label ?title .
?item wdt:P921 wd:Q515701 ; # has the term 'linked data' as main subject
wdt:P921 ?mainSubject .
?item wdt:P50 ?author .
?author rdfs:label ?authorLabel .
FILTER (LANG(?authorLabel) = "en")
FILTER (LANG(?title) = "en")
}
FILTER(?mainSubject IN (wd:Q515701)) # Filter out 'main subject' values NOT in this list
FILTER(?itemType IN (wd:Q47461344, wd:Q18918145 )) # Filter out 'instance of' values NOT in this list
SERVICE wikibase:label { bd:serviceParam wikibase:language "en". }
}
GROUP BY ?item ?title ?mainSubjectLabel ?itemTypeLabel ?authors
ORDER by ASC (?title)