Like 'Get the definitions of an ontology including namespace and descriptions', but restricted to definition nanopublications published by an admin, maintainer, or member of the space that maintains the resource (observers excluded). It returns the definitions of the elements of a given OWL ontology (classes, properties, named individuals, and describing paragraphs) that either match the ontology namespace or declare dct:isPartOf the ontology. The maintaining space and its validated member public-key hashes are resolved server-side from the spaces repo (/repo/spaces). Each element appears once, kept from the latest member-authored definition (by nanopub timestamp, ties broken by nanopub URI). The last_modified_by/last_modified columns give the signer and timestamp of that latest definition; the signer name is resolved from the trust repo (/repo/trust) or left blank.
Get the latest member-authored definitions of an ontology including namespace
prefix owl: <http://www.w3.org/2002/07/owl#> prefix rdfs: <http://www.w3.org/2000/01/rdf-schema#> prefix rdf: <http://www.w3.org/1999/02/22-rdf-syntax-ns#> prefix dct: <http://purl.org/dc/terms/> prefix np: <http://www.nanopub.org/nschema#> prefix npa: <http://purl.org/nanopub/admin/> prefix npx: <http://purl.org/nanopub/x/> prefix skos: <http://www.w3.org/2004/02/skos/core#> prefix schema: <https://schema.org/> prefix gen: <https://w3id.org/kpxl/gen/terms/> prefix foaf: <http://xmlns.com/foaf/0.1/> select ?item (sample(?item_label_) as ?item_label) (sample(?user) as ?last_modified_by) (sample(?lmbl) as ?last_modified_by_label) (sample(?date) as ?last_modified) (sample(?np_) as ?np) ("^" as ?np_label) where { { select ?item (max(?rank) as ?maxrank) where { { select ?np_ ?item ?a ?date ?pubkey ?itemType where { values ?itemType { owl:Class rdf:Property owl:ObjectProperty owl:DatatypeProperty owl:NamedIndividual gen:Paragraph } service <https://w3id.org/np/l/nanopub-query-1.1/repo/spaces> { select (group_concat(?mpk; separator=" ") as ?memberPubkeys) where { graph npa:graph { npa:thisRepo npa:hasCurrentSpaceState ?stateG . } values ?_ontology_multi_iri {} graph ?stateG { ?_ontology_multi_iri npa:isMaintainedBy? ?space . ?ri a gen:RoleInstantiation ; npa:forSpace ?space ; npa:forAgent ?agent ; npa:hasRoleType ?rt . filter(?rt in (gen:AdminRole, gen:MaintainerRole, gen:MemberRole)) ?acct a npa:AccountState ; npa:agent ?agent ; npa:pubkey ?mpk . } } } graph npa:graph { ?np_ npx:hasNanopubType ?itemType . ?np_ npa:hasValidSignatureForPublicKeyHash ?pubkey . filter not exists { ?npx npx:invalidates ?np_ ; npa:hasValidSignatureForPublicKeyHash ?pubkey . } ?np_ dct:created ?date . ?np_ npx:introduces ?item . ?np_ np:hasAssertion ?a . } filter(contains(?memberPubkeys, ?pubkey)) } } values ?_ontology_multi_iri {} graph ?a { { ?item a ?itemType . filter(strstarts(str(?item), ?__ontologyNamespace)) } union { ?item a ?itemType . ?item dct:isPartOf|schema:isPartOf ?_ontology_multi_iri . } } bind(concat(str(?date), "|", str(?np_)) as ?rank) } group by ?item } { select ?np_ ?item ?date ?user ?item_label_ where { { select ?np_ ?item ?a ?date ?user ?pubkey ?itemType where { values ?itemType { owl:Class rdf:Property owl:ObjectProperty owl:DatatypeProperty owl:NamedIndividual gen:Paragraph } service <https://w3id.org/np/l/nanopub-query-1.1/repo/spaces> { select (group_concat(?mpk; separator=" ") as ?memberPubkeys) where { graph npa:graph { npa:thisRepo npa:hasCurrentSpaceState ?stateG . } values ?_ontology_multi_iri {} graph ?stateG { ?_ontology_multi_iri npa:isMaintainedBy? ?space . ?ri a gen:RoleInstantiation ; npa:forSpace ?space ; npa:forAgent ?agent ; npa:hasRoleType ?rt . filter(?rt in (gen:AdminRole, gen:MaintainerRole, gen:MemberRole)) ?acct a npa:AccountState ; npa:agent ?agent ; npa:pubkey ?mpk . } } } graph npa:graph { ?np_ npx:hasNanopubType ?itemType . ?np_ npa:hasValidSignatureForPublicKeyHash ?pubkey . filter not exists { ?npx npx:invalidates ?np_ ; npa:hasValidSignatureForPublicKeyHash ?pubkey . } ?np_ dct:created ?date . ?np_ npx:introduces ?item . ?np_ np:hasAssertion ?a . optional { ?np_ npx:signedBy ?user . } } filter(contains(?memberPubkeys, ?pubkey)) } } values ?_ontology_multi_iri {} graph ?a { { ?item a ?itemType . filter(strstarts(str(?item), ?__ontologyNamespace)) } union { ?item a ?itemType . ?item dct:isPartOf|schema:isPartOf ?_ontology_multi_iri . } optional { ?item rdfs:label|schema:title ?item_label_ . } } } } bind(concat(str(?date), "|", str(?np_)) as ?rank) filter(?rank = ?maxrank) optional { service <https://w3id.org/np/l/nanopub-query-1.1/repo/trust> { select ?user ?lmbl where { graph npa:graph { npa:thisRepo npa:hasCurrentTrustState ?tg . } graph ?tg { ?user foaf:name ?lmbl . } } } } } group by ?item order by ?item_label