@prefix this: . @prefix sub: . @prefix np: . @prefix dct: . @prefix nt: . @prefix npx: . @prefix xsd: . @prefix rdfs: . @prefix orcid: . @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-mira-records a ; dct:description "Returns every current MIRA record as quads, for bulk import into another system. Each row is one statement with its named graph, so the graph pointers inside a record resolve to graphs the caller also received. Columns: np (the nanopublication, fetch it with Accept: application/trig to get the signed original), created (the sync cursor), subj, pred, obj, graph. Optional parameters: class restricts to one MIRA class; since returns only records created strictly after that timestamp, so re-pulling with the newest value seen returns nothing; part selects head, assertion, provenance or pubinfo, or all, and defaults to assertion plus provenance; examples=include adds the demo records, which are excluded by default. Request application/sparql-results+json rather than CSV: CSV drops datatypes and language tags, and MIRA titles contain commas. Coupled to the shared MIRA record type (https://w3id.org/spaces/mira/r/MiraRecord)."; dct:license ; rdfs:label "Get MIRA records as quads"; ; """prefix np: prefix npa: prefix npx: prefix dct: prefix mira: select ?np ?created ?subj ?pred ?obj ?graph where { # Every record of the shared MIRA record type. The type repository holds only # current versions, so a superseded record never leaves this endpoint. graph npa:graph { ?np npx:hasNanopubType ; dct:created ?created . } # Optional narrowing to one MIRA class. Absent, ?class falls back to the record # type itself, so the extra pattern is a no-op rather than a second binding. bind(coalesce(?__class_iri, ) as ?class) graph npa:graph { ?np npx:hasNanopubType ?class . } # Incremental sync: pass the newest ?created seen on the previous pull. # Strict, so re-pulling with the last timestamp returns only what is new. bind(coalesce(?__since, \"0000\") as ?since) filter(?since < str(?created)) # Demo records carry npx:ExampleNanopub. They are excluded by default: importing # example data into a live system is worse than missing it. OPTIONAL + !bound rather # than NOT EXISTS, which mis-plans here. optional { graph npa:graph { ?np npx:hasNanopubType ?example . } filter(?example = npx:ExampleNanopub) } bind(coalesce(?__examples, \"exclude\") as ?ex) filter(?ex = \"include\" || !bound(?example)) { # The Head graph has no pointer predicate of its own: it is the graph in which the # nanopublication declares itself. Must exclude npa:graph, which mirrors that triple. graph ?graph { ?np a np:Nanopublication . } filter(?graph != npa:graph) bind(\"head\" as ?part) } union { graph npa:graph { ?np np:hasAssertion ?graph . } bind(\"assertion\" as ?part) } union { graph npa:graph { ?np np:hasProvenance ?graph . } bind(\"provenance\" as ?part) } union { graph npa:graph { ?np np:hasPublicationInfo ?graph . } bind(\"pubinfo\" as ?part) } # Default is the MIRA content and its attribution: assertion + provenance. Head and # pubinfo are available but not sent unless asked, so a default pull carries neither # the role declarations nor dct:license. Pass part=all for a complete, self-consistent # nanopublication; a single part name selects just that graph. bind(coalesce(?__part, \"default\") as ?want) filter(?want = \"all\" || ?want = ?part || (?want = \"default\" && (?part = \"assertion\" || ?part = \"provenance\"))) graph ?graph { ?subj ?pred ?obj . } } order by ?created ?np ?graph ?subj ?pred ?obj limit 50000 """ . } 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-10-02T09:24:44Z"^^xsd:dateTime; dct:creator orcid:0000-0002-1267-0234; dct:license ; npx:embeds sub:get-mira-records; rdfs:label "Get MIRA records as quads"; nt:wasCreatedFromProvenanceTemplate ; nt:wasCreatedFromPubinfoTemplate , ; nt:wasCreatedFromTemplate . sub:sig npx:hasAlgorithm "RSA"; npx:hasPublicKey "MIGfMA0GCSqGSIb3DQEBAQUAA4GNADCBiQKBgQCwUtewGCpT5vIfXYE1bmf/Uqu1ojqnWdYxv+ySO80ul8Gu7m8KoyPAwuvaPj0lvPtHrg000qMmkxzKhYknEjq8v7EerxZNYp5B3/3+5ZpuWOYAs78UnQVjbHSmDdmryr4D4VvvNIiUmd0yxci47dTFUj4DvfHnGd6hVe5+goqdcwIDAQAB"; npx:hasSignature "TOkO9iC1qV4G7XwYYGZZEOAWHeaGTkMpn6nN38WWwVsRUveJ6UfbgQLYdLV5UHpVmLETgdNqmB1rbjAX643c0m1Gydpvi/C1K04u/L+QqtxECxqwN8i/aYulQr2iajBUKIIklO7dpwO/99BLsPwVKBgSHxeaawXwGi4I6SRxcys="; npx:hasSignatureTarget this:; npx:signedBy orcid:0000-0002-1267-0234 . }