Nanopublication

< Home

ID

https://w3id.org/np/RAUgwed_YnC3BT4O_JGq9fAj7pMGObkaMl8pjgTiHRg0c

Formats

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

Content

@prefix this: <https://w3id.org/np/RAUgwed_YnC3BT4O_JGq9fAj7pMGObkaMl8pjgTiHRg0c> .
@prefix sub: <https://w3id.org/np/RAUgwed_YnC3BT4O_JGq9fAj7pMGObkaMl8pjgTiHRg0c/> .
@prefix np: <http://www.nanopub.org/nschema#> .
@prefix grlc: <https://w3id.org/kpxl/grlc/> .
@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-ideas a grlc:grlc-query;
    dct:description "Lists the ideas (instances of the Idea class, published with the \"Suggesting an idea\" template) that are suggested for a given space or maintained resource, most up-voted first, then oldest first. An up-vote is a schema:VoteAction whose schema:object is the idea; the count is the number of distinct signing keys with a valid, non-retracted up-vote, so each person counts once per idea and a retracted up-vote no longer counts. Ideas and up-votes marked as example nanopublications, and superseded or invalidated ones, are ignored. The hidden action columns are computed against the viewer's local key (?__LOCALPUBKEY_multi): upvote_target holds the idea unless the viewer has already up-voted it, withdraw_target holds the viewer's own up-vote nanopublication if there is one (to retract it), and edit_target holds the idea nanopublication if the viewer's key signed it (to supersede it).";
    dct:license <http://www.apache.org/licenses/LICENSE-2.0>;
    rdfs:label "Get the ideas suggested for a resource with their up-votes";
    grlc:endpoint <https://w3id.org/np/l/nanopub-query-1.1/repo/full>;
    grlc:sparql """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 gen: <https://w3id.org/kpxl/gen/terms/>
prefix schema: <https://schema.org/>
prefix foaf: <http://xmlns.com/foaf/0.1/>
prefix idea: <https://w3id.org/np/RA7b4hUMrroGWIlG_JJm9XV_XJlHGqRiTFP0amY0BcOd8/>

select ?idea ?idea_label ?description ?votes ?proposer ?proposer_label ?date ?np ?np_label ?upvote_target ?withdraw_target ?edit_target
where {
  {
    select ?idea ?np ?a ?pk ?created
           (min(str(?lbl)) as ?idea_label) (sample(?desc) as ?description)
           (min(str(?prop)) as ?propS) (min(str(?pname)) as ?proposer_label)
    where {
      {
        select ?idea ?np ?a ?pk ?created where {
          values ?_target_multi_iri {}
          graph ?a { ?idea a idea:Idea ; gen:isRelevantFor ?_target_multi_iri . }
          graph npa:graph {
            ?np np:hasAssertion ?a ; npa:hasValidSignatureForPublicKey ?pk ; npx:introduces ?idea ; dct:created ?created .
            filter not exists { ?inv npx:invalidates ?np ; npa:hasValidSignatureForPublicKey ?pk . }
            filter not exists { ?newer npx:supersedes ?np . }
            filter not exists { ?np npx:hasNanopubType npx:ExampleNanopub . }
          }
        }
      }
      graph ?a { ?idea rdfs:label ?lbl . }
      optional { graph ?a { ?idea dct:description ?desc . } }
      graph npa:graph { ?np np:hasPublicationInfo ?pi . }
      optional { graph ?pi { ?np dct:creator ?prop . } }
      optional { graph ?pi { ?prop foaf:name ?pname . } }
    } group by ?idea ?np ?a ?pk ?created
  }
  optional {
    select ?idea (count(distinct ?vpk) as ?nvotes) where {
      graph ?va { ?vote a schema:VoteAction ; schema:object ?idea . }
      graph npa:graph {
        ?vnp np:hasAssertion ?va ; npa:hasValidSignatureForPublicKey ?vpk .
        filter not exists { ?vinv npx:invalidates ?vnp ; npa:hasValidSignatureForPublicKey ?vpk . }
        filter not exists { ?vnp npx:hasNanopubType npx:ExampleNanopub . }
      }
    } group by ?idea
  }
  optional {
    select ?idea (max(str(?mvnp)) as ?myvote) where {
      values ?__LOCALPUBKEY_multi {}
      graph ?mva { ?mvote a schema:VoteAction ; schema:object ?idea . }
      graph npa:graph {
        ?mvnp np:hasAssertion ?mva ; npa:hasValidSignatureForPublicKey ?mvpk .
        filter not exists { ?minv npx:invalidates ?mvnp ; npa:hasValidSignatureForPublicKey ?mvpk . }
      }
      filter(coalesce(str(?mvpk) = str(?__LOCALPUBKEY_multi), false))
    } group by ?idea
  }
  values ?__LOCALPUBKEY_multi {}
  bind(coalesce(?nvotes, 0) as ?votes)
  bind(if(bound(?propS), iri(?propS), ?propS) as ?proposer)
  bind(substr(str(?created), 1, 10) as ?date)
  bind(\"^\" as ?np_label)
  bind(if(bound(?myvote), \"\", str(?idea)) as ?upvote_target)
  bind(coalesce(?myvote, \"\") as ?withdraw_target)
  bind(if(coalesce(str(?pk) = str(?__LOCALPUBKEY_multi), false), str(?np), \"\") as ?edit_target)
}
order by desc(?votes) ?created""" .
}

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-14T15:04:35Z"^^xsd:dateTime;
    dct:creator orcid:0000-0002-1267-0234;
    dct:license <https://creativecommons.org/licenses/by/4.0/>;
    npx:embeds sub:get-ideas;
    rdfs:label "Get the ideas suggested for a resource with their up-votes";
    nt:wasCreatedFromProvenanceTemplate <http://purl.org/np/RANwQa4ICWS5SOjw7gp99nBpXBasapwtZF1fIM3H2gYTM>;
    nt:wasCreatedFromPubinfoTemplate <https://w3id.org/np/RA-N4_kFxcruvBTlo1yJv29E4SLOXsx5KO_th69PprMrA>,
      <https://w3id.org/np/RACJ58Gvyn91LqCKIO9zu1eijDQIeEff28iyDrJgjSJF8>, <https://w3id.org/np/RARJj78P72NR5edKOnu_f4ePE9NYYuW2m2pM-fEoobMBk>;
    nt:wasCreatedFromTemplate <https://w3id.org/np/RAEFAt-QcFK0ZhqfvlsmS10BnzGJA0xwOICZXkO-ai87k> .
  
  sub:sig npx:hasAlgorithm "RSA";
    npx:hasPublicKey "MIGfMA0GCSqGSIb3DQEBAQUAA4GNADCBiQKBgQCwUtewGCpT5vIfXYE1bmf/Uqu1ojqnWdYxv+ySO80ul8Gu7m8KoyPAwuvaPj0lvPtHrg000qMmkxzKhYknEjq8v7EerxZNYp5B3/3+5ZpuWOYAs78UnQVjbHSmDdmryr4D4VvvNIiUmd0yxci47dTFUj4DvfHnGd6hVe5+goqdcwIDAQAB";
    npx:hasSignature "hfBCBpROzuJ8XU5ZFF+5eZN4yUmAUhXHqajv4HXsWAOEJDQHXq5EjWHS6kUCpoaIbstKZGjhvbVBujREdolmzr03SLmwootTytRiJGfU2Ph7ImuAZlvI9+kKs2QkJ+p1nmCDw/Irp9LV0+q9pyvBph8Zvx2gz2zWr03CqBEuXcc=";
    npx:hasSignatureTarget this:;
    npx:signedBy orcid:0000-0002-1267-0234 .
}