Nanopublication

< Home

ID

https://w3id.org/np/RAY9jYNDJUqYI5EBWcVo4A1r_B0xAvY51Kj6C6DooB4KE

Formats

.trig | .trig.txt | .jelly | .jelly.txt | .jsonld | .jsonld.txt | .nq | .nq.txt | .xml | .xml.txt

Content

@prefix this: <https://w3id.org/np/RAY9jYNDJUqYI5EBWcVo4A1r_B0xAvY51Kj6C6DooB4KE> .
@prefix sub: <https://w3id.org/np/RAY9jYNDJUqYI5EBWcVo4A1r_B0xAvY51Kj6C6DooB4KE/> .
@prefix np: <http://www.nanopub.org/nschema#> .
@prefix dct: <http://purl.org/dc/terms/> .
@prefix nt: <https://w3id.org/np/o/ntemplate/> .
@prefix npx: <http://purl.org/nanopub/x/> .
@prefix xsd: <http://www.w3.org/2001/XMLSchema#> .
@prefix rdfs: <http://www.w3.org/2000/01/rdf-schema#> .
@prefix orcid: <https://orcid.org/> .
@prefix prov: <http://www.w3.org/ns/prov#> .
@prefix foaf: <http://xmlns.com/foaf/0.1/> .

sub:Head {
  this: a np:Nanopublication;
    np:hasAssertion sub:assertion;
    np:hasProvenance sub:provenance;
    np:hasPublicationInfo sub:pubinfo .
}

sub:assertion {
  sub:get-concepts-of-a-skos-scheme-from-space-members a <https://w3id.org/kpxl/grlc/grlc-query>;
    dct:description "Returns the concepts (skos:Concept) that declare themselves to be in the given SKOS concept scheme or vocabulary via skos:inScheme, restricted to nanopublications published by an admin, maintainer or member of the space that maintains the scheme. The maintaining space and its validated member public-key hashes are resolved server-side from the spaces repo (/repo/spaces); observers are excluded, since that tier is self-attestable. Each concept URI appears at most once: of all non-invalidated member-published definitions of a concept in this scheme, only the latest one by nanopublication timestamp is kept (ties broken by nanopublication URI), so an in-place override of a definition replaces the earlier one in the listing rather than adding a second row. The broader concepts are given as a multi-valued column: the IRIs in broader_concepts_multi_iri and the matching labels in broader_concepts_label_multi, in the same order, so a view renders them as a list of links. A broader concept's label is its own skos:prefLabel wherever that concept is defined (not necessarily in the same scheme), falling back to the IRI. Labels and definitions prefer an untagged literal but fall back to a language-tagged one, so a concept labelled only in a tagged language still shows a label and never duplicates its row across languages. The status column is a multi-value literal listing the curation states that apply to the winning definition: \"deprecated\" (owl:DeprecatedClass, or owl:deprecated true), \"withdrawn\" (gen:WithdrawnTerm), \"draft\" (npx:DraftNanopub) and \"example\" (npx:ExampleNanopub), in that order. Unlike the sibling queries for OWL classes and terms, this query applies no approval mechanism: every member-published definition is listed. The override_target column is action data rather than content: it carries the row's nanopublication so that a view can offer a per-row in-place re-edit action. The last_modified_by/last_modified columns give the signer and timestamp of the winning definition; the signer name is resolved from the trust repo (/repo/trust) or left blank.";
    dct:license <http://www.apache.org/licenses/LICENSE-2.0>;
    rdfs:label "Get the concepts of a SKOS scheme from space members";
    <https://w3id.org/kpxl/grlc/endpoint> <https://w3id.org/np/l/nanopub-query-1.1/repo/type/af79dec054ac75f59327aa4e560e3ed0c243130f9852d4e7027aee5beefed2f3>;
    <https://w3id.org/kpxl/grlc/sparql> """prefix owl: <http://www.w3.org/2002/07/owl#>
prefix rdfs: <http://www.w3.org/2000/01/rdf-schema#>
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 gen: <https://w3id.org/kpxl/gen/terms/>
prefix foaf: <http://xmlns.com/foaf/0.1/>

select ?concept (strafter(?labelWin, \"|\") as ?concept_label) (strafter(?descWin, \"|\") as ?description)
       ?broader_concepts_multi_iri ?broader_concepts_label_multi
       ?status_multi
       ?last_modified_by (sample(?lmbl) as ?last_modified_by_label) ?last_modified
       (?np as ?override_target) ?np ?np_label where {
  {
    select ?concept (min(?labelRank) as ?labelWin) (min(?descRank) as ?descWin)
           ?status_multi (sample(?user) as ?last_modified_by) (sample(?date) as ?last_modified)
           ?np (\"^\" as ?np_label) where {
      values ?_scheme_multi_iri {}
      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 ?_scheme_multi_iri {}
          graph ?stateG {
            ?_scheme_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 skos:Concept .
        ?np npa:hasValidSignatureForPublicKeyHash ?pubkey .
        filter not exists { ?npx npx:invalidates ?np ; npa:hasValidSignatureForPublicKeyHash ?pubkey . }
        ?np dct:created ?date .
        ?np npx:introduces ?concept .
        ?np np:hasAssertion ?a .
        optional { ?np npx:signedBy ?user . }
      }
      filter(contains(?memberPubkeys, ?pubkey))
      graph ?a {
        ?concept skos:inScheme ?_scheme_multi_iri .
        optional { ?concept skos:prefLabel ?label . }
        optional { ?concept skos:definition ?definition . }
      }
      bind(concat(if(lang(?label) = \"\", \"1\", \"2\"), \"|\", str(?label)) as ?labelRank)
      bind(concat(if(lang(?definition) = \"\", \"1\", \"2\"), \"|\", str(?definition)) as ?descRank)
      bind(replace(concat(
        if(exists { graph ?a { ?concept a owl:DeprecatedClass } }
           || exists { graph ?a { ?concept owl:deprecated true } }, \"deprecated\\n\", \"\"),
        if(exists { graph ?a { ?concept a gen:WithdrawnTerm } }, \"withdrawn\\n\", \"\"),
        if(exists { graph npa:graph { ?np npx:hasNanopubType npx:DraftNanopub } }, \"draft\\n\", \"\"),
        if(exists { graph npa:graph { ?np npx:hasNanopubType npx:ExampleNanopub } }, \"example\\n\", \"\")
      ), \"\\n$\", \"\") as ?status_multi)
      filter not exists {
        graph npa:graph {
          ?np2 npx:hasNanopubType skos:Concept .
          ?np2 npa:hasValidSignatureForPublicKeyHash ?pubkey2 .
          filter not exists { ?np2x npx:invalidates ?np2 ; npa:hasValidSignatureForPublicKeyHash ?pubkey2 . }
          ?np2 dct:created ?date2 .
          ?np2 npx:introduces ?concept .
          ?np2 np:hasAssertion ?a2 .
        }
        filter(contains(?memberPubkeys, ?pubkey2))
        graph ?a2 { ?concept skos:inScheme ?_scheme_multi_iri . }
        filter(?date2 > ?date || (?date2 = ?date && str(?np2) > str(?np)))
      }
    } group by ?concept ?status_multi ?np
  }
  optional {
    select ?np ?concept
           (group_concat(?bIri; separator=\" \") as ?broader_concepts_multi_iri)
           (group_concat(?bLabel; separator=\"\\n\") as ?broader_concepts_label_multi) where {
      values ?_scheme_multi_iri {}
      graph npa:graph {
        ?np npx:hasNanopubType skos:Concept ; npx:introduces ?concept ; np:hasAssertion ?a .
      }
      graph ?a { ?concept skos:inScheme ?_scheme_multi_iri ; skos:broader ?broader . }
      filter(isIRI(?broader))
      optional {
        select ?broader (min(?bRank) as ?bWin) where {
          graph npa:graph { ?bnp npx:hasNanopubType skos:Concept ; npx:introduces ?broader ; np:hasAssertion ?ba . }
          graph ?ba { ?broader skos:prefLabel ?blbl . }
          bind(concat(if(lang(?blbl) = \"\", \"1\", \"2\"), \"|\", str(?blbl)) as ?bRank)
        } group by ?broader
      }
      bind(str(?broader) as ?bIri)
      bind(replace(replace(coalesce(strafter(?bWin, \"|\"), str(?broader)), \"\\\\\\\\\", \"\\\\\\\\\\\\\\\\\"), \"[\\r\\n]+\", \"\\\\\\\\n\") as ?bLabel)
    } group by ?np ?concept
  }
  optional {
    service <https://w3id.org/np/l/nanopub-query-1.1/repo/trust> {
      select ?last_modified_by ?lmbl where {
        graph npa:graph { npa:thisRepo npa:hasCurrentTrustState ?tg . }
        graph ?tg { ?last_modified_by foaf:name ?lmbl . }
      }
    }
  }
}
group by ?concept ?labelWin ?descWin ?broader_concepts_multi_iri ?broader_concepts_label_multi ?status_multi ?last_modified_by ?last_modified ?np ?np_label
order by ?concept_label""" .
}

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 "2026-09-04T05:26:14Z"^^xsd:dateTime;
    dct:creator orcid:0000-0002-1267-0234;
    dct:license <https://creativecommons.org/licenses/by/4.0/>;
    npx:embeds sub:get-concepts-of-a-skos-scheme-from-space-members;
    rdfs:label "Get the concepts of a SKOS scheme from space members";
    prov:wasDerivedFrom <https://w3id.org/np/RAul10Jretr7ykLaQ9dS_kdYRr9v4Cp2homA9W3Demzxg>;
    nt:wasCreatedFromProvenanceTemplate <https://w3id.org/np/RA7lSq6MuK_TIC6JMSHvLtee3lpLoZDOqLJCLXevnrPoU>;
    nt:wasCreatedFromPubinfoTemplate <https://w3id.org/np/RACJ58Gvyn91LqCKIO9zu1eijDQIeEff28iyDrJgjSJF8>,
      <https://w3id.org/np/RARW4MsFkHuwjycNElvEVtuMjpf4yWDL10-0C5l2MqqRQ>, <https://w3id.org/np/RAukAcWHRDlkqxk7H2XNSegc1WnHI569INvNr-xdptDGI>;
    nt:wasCreatedFromTemplate <https://w3id.org/np/RAEFAt-QcFK0ZhqfvlsmS10BnzGJA0xwOICZXkO-ai87k> .
  
  sub:sig npx:hasAlgorithm "RSA";
    npx:hasPublicKey "MIGfMA0GCSqGSIb3DQEBAQUAA4GNADCBiQKBgQCwUtewGCpT5vIfXYE1bmf/Uqu1ojqnWdYxv+ySO80ul8Gu7m8KoyPAwuvaPj0lvPtHrg000qMmkxzKhYknEjq8v7EerxZNYp5B3/3+5ZpuWOYAs78UnQVjbHSmDdmryr4D4VvvNIiUmd0yxci47dTFUj4DvfHnGd6hVe5+goqdcwIDAQAB";
    npx:hasSignature "FXF8BStfytx5HTPt9CRYm1bB+ZAfkdn5J4KU731SjdsV4qIBwrCEBgrjNCXakzcH1muQBL8Hdfzmbthr/GqGkLBseJYKOwRTGM9OfEDvySvhV4IyEmTAR9ZgIN37Q4RxIXzGcCLGdDzPcR6g+Fezk4xdfjXjiAn0KRW2fpkape0=";
    npx:hasSignatureTarget this:;
    npx:signedBy orcid:0000-0002-1267-0234 .
}