sub:assertion {
sub:get-classes-for-thing dct:description "This query returns the classes that have been assigned to the thing of the given URI." ;
dct:license <
http://www.apache.org/licenses/LICENSE-2.0> ;
a <
https://w3id.org/kpxl/grlc/grlc-query> ;
rdfs:label "Get the classes assigned to a thing" ;
<
https://w3id.org/kpxl/grlc/endpoint> <
https://w3id.org/np/l/nanopub-query-1.1/repo/full> ;
<
https://w3id.org/kpxl/grlc/sparql> """prefix dct: <http://purl.org/dc/terms/>
prefix rdfs: <http://www.w3.org/2000/01/rdf-schema#>
prefix np: <http://www.nanopub.org/nschema#>
prefix npa: <http://purl.org/nanopub/admin/>
prefix npx: <http://purl.org/nanopub/x/>
prefix nt: <https://w3id.org/np/o/ntemplate/>
select ?class ?classLabel ?np ?npLabel ?date ?pubkey where {
graph ?g {
?_thing_iri a ?class .
}
graph npa:graph {
?np npa:hasValidSignatureForPublicKey ?pubkey .
filter not exists { ?npx npx:invalidates ?np ; npa:hasValidSignatureForPublicKey ?pubkey . }
?np npa:hasGraph ?g .
?np np:hasPublicationInfo ?i .
?np dct:created ?date .
optional { ?np rdfs:label ?npLabel }
}
optional { graph ?g { ?class rdfs:label ?classLabel1 . } }
optional { graph ?g { ?class dct:title ?classLabel2 . } }
optional { graph ?i { ?class rdfs:label ?classLabel3 . } }
optional { graph ?i { ?class nt:hasLabelFromApi ?classLabel4 . } }
bind(coalesce(?classLabel1, ?classLabel2, ?classLabel3, ?classLabel4) as ?classLabel)
} limit 1000""" .
}