Anonymous

Main Page: Difference between revisions

From geokb
Line 302: Line 302:
</sparql>
</sparql>


We can build on the query for document classes to get document instances.
We can build on the query for document classes to get document instances and some of the statements we might need to use.


<sparql tryit="1">
<sparql tryit="1">
Line 308: Line 308:
PREFIX wdt: <https://geokb.wikibase.cloud/prop/direct/>
PREFIX wdt: <https://geokb.wikibase.cloud/prop/direct/>


SELECT ?item ?itemLabel
SELECT ?item ?itemLabel ?instance_ofLabel (YEAR(?publication_date) AS ?year) ?doi
WHERE {
WHERE {
   ?classes wdt:P2* wd:Q5 . # subclass of, transitive "document"
   ?classes wdt:P2* wd:Q5 . # subclass of, transitive "document"
   ?item wdt:P1 ?classes . # get entities that are instances of any of the classes
   ?item wdt:P1 ?classes ; # get entities that are instances of any of the classes
        wdt:P1 ?instance_of ; # get the item classification to display
        wdt:P7 ?publication_date ; # only get items that have a publication date
        wdt:P74 ?doi . # only get items that have a doi
   SERVICE wikibase:label { bd:serviceParam wikibase:language "en" . }
   SERVICE wikibase:label { bd:serviceParam wikibase:language "en" . }
}
}