@prefix this: . @prefix sub: . @prefix np: . @prefix dct: . @prefix nt: . @prefix npx: . @prefix xsd: . @prefix rdfs: . @prefix orcid: . @prefix ns1: . @prefix prov: . @prefix foaf: . sub:Head { this: a np:Nanopublication; np:hasAssertion sub:assertion; np:hasProvenance sub:provenance; np:hasPublicationInfo sub:pubinfo . } sub:assertion { sub:get-latest-thing-nanopub a ; dct:description "This query returns all latest versions of a given nanopublication and thing URI that is introduced or described therein."; dct:license ; rdfs:label "Get latest nanopubs defining a thing"; ; """prefix np: prefix npa: prefix npx: prefix dct: select ?latestVersion ?date where { graph npa:graph { ?_np_iri npa:hasValidSignatureForPublicKey ?pubkey . ?_np_iri npx:introduces|npx:describes ?_thing_iri . } graph npa:networkGraph { ?latestVersion (npx:supersedes)* ?_np_iri . } graph npa:graph { filter exists { ?latestVersion npa:hasValidSignatureForPublicKey ?pubkey . } filter not exists { ?npx npx:invalidates ?latestVersion ; npa:hasValidSignatureForPublicKey ?pubkey . } ?latestVersion dct:created ?date . ?latestVersion npx:introduces|npx:describes ?_thing_iri . } } order by desc(?date) ?latestVersion""" . } sub:provenance { sub:assertion prov:wasAttributedTo orcid:0000-0002-1267-0234 . } sub:pubinfo { orcid:0000-0002-1267-0234 foaf:name "Tobias Kuhn" . this: dct:created "2025-05-20T14:56:08.957Z"^^xsd:dateTime; dct:creator orcid:0000-0002-1267-0234; dct:license ; npx:introduces sub:get-latest-thing-nanopub; npx:wasCreatedAt ; nt:wasCreatedFromProvenanceTemplate ns1:RANwQa4ICWS5SOjw7gp99nBpXBasapwtZF1fIM3H2gYTM; nt:wasCreatedFromPubinfoTemplate , ; nt:wasCreatedFromTemplate . sub:sig npx:hasAlgorithm "RSA"; npx:hasPublicKey "MIGfMA0GCSqGSIb3DQEBAQUAA4GNADCBiQKBgQD4Wj537OijfOWVtsHMznuXKISqBhtGDQZfdO6pbb4hg9EHMcUFGTLbWaPrP783PHv8HMAAPjvEkHLaOHMIknqhaIa5236lfBO3r+ljVdYBElBcLvROmwG+ZGtmPNZf7lMhI15xf5TfoaSa84AFRd5J2EXekK6PhaFQhRm1IpSYtwIDAQAB"; npx:hasSignature "D5mdC3CUaqieUFhCmAlkvNAU3q6e3lBV00oBktbweEfNERVIf2StTqZf9XUVKzCV+40+BGYuCOWOPhrRVQcZPvkyzATlgxozhyoZtG/Osl6VhOlGyJb0dsInaG9udQQ15qCnPe3i1IbEv27n/jFe7FkmxTCpRyLztfc0bcYhSU4="; npx:hasSignatureTarget this:; npx:signedBy orcid:0000-0002-1267-0234 . }