The concept of nanopublications was first proposed about six years ago, but it lacked openly available implementations. The library presented here is the first one that has become an official implementation of the nanopublication community. Its core features are stable, but it also contains unofficial and experimental extensions: for publishing to a decentralized server network, for defining sets of nanopublications with indexes, for informal assertions, and for digitally signing nanopublications. Most of the features of the library can also be accessed via an online validator interface.
1. nanopub-java:
A Java Library for Nanopublications
Tobias Kuhn
http://www.tkuhn.org
@txkuhn
VU University Amsterdam
5th Workshop on Linked Science (LISC) 2015
at ISWC 2015, Bethlehem, Pennsylvania, USA
12 October 2015
2. The nanopub-java Library
https://github.com/Nanopublication/nanopub-java
This library can be useful in a number of scenarios:
• To represent and share chunks of data in RDF in a
provenance-aware manner (as nanopublications)
• To make RDF content verifiable and immutable (with trusty
URIs)
• To define large or small datasets of RDF content where the
data entries can be individually addressed and recombined in
new datasets (with nanopublication indexes)
• To quickly publish RDF snippets in a verifiable and permanent
manner (relying on an existing server network)
• To retrieve existing nanopublications from the network
(5 millions and counting)
• To digitally sign RDF snippets (experimental)
Tobias Kuhn, VU University Amsterdam nanopub-java: A Java Library for Nanopublications 2 / 19
3. Nanopublications: Linked Data Containers for
Provenance-Aware Semantic Publishing
assertion
provenance
publication info
nanopublication
http://nanopub.org / @nanopub org
Tobias Kuhn, VU University Amsterdam nanopub-java: A Java Library for Nanopublications 3 / 19
4. Nanopublication Example
sub:assertion {
sub:_3 a rdf:Statement ; rdf:subject schem:Adenosine%20triphosphate ;
rdf:predicate belv:decreases ; rdf:object sub:_1 ;
occursIn: obo:UBERON_0001134 , species:9606 .
sub:_1 a go:0003824 ; hasAgent: sub:_2 .
sub:_2 a Protein: ; geneProductOf: hgnc:12517 .
}
sub:provenance {
sub:assertion prov:hadPrimarySource pubmed:9703368 ;
prov:wasDerivedFrom beldoc: , sub:_4 .
beldoc: dce:description "Approximately 61,000 statements." ;
dce:rights "Copyright (c) 2011-2012, Selventa. All rights reserved." ;
dce:title "BEL Framework Large Corpus Document" ;
pav:authoredBy sub:_5 ; pav:version "20131211" .
sub:_4 prov:value "UCP1 contains six potential transmembrane a-helices (72) and
prov:wasQuotedFrom pubmed:9703368 .
sub:_5 rdfs:label "Selventa" .
}
sub:pubinfo {
this: dct:created "2014-07-03T14:34:13.226+02:00"^^xsd:dateTime ;
pav:createdBy orcid:0000-0001-6818-334X , orcid:0000-0002-1267-0234 .
}
Tobias Kuhn, VU University Amsterdam nanopub-java: A Java Library for Nanopublications 4 / 19
5. Nanopublication Schema
np:Nanopublication rdf:type owl:Class.
np:Assertion rdfs:subClassOf rdfg:Graph.
np:Provenance rdfs:subClassOf rdfg:Graph.
np:PublicationInfo rdfs:subClassOf rdfg:Graph.
np:hasAssertion a owl:FunctionalProperty.
np:hasAssertion rdfs:domain np:Nanopublication.
np:hasAssertion rdfs:range np:Assertion.
np:hasProvenance a owl:FunctionalProperty.
np:hasProvenance rdfs:domain np:Nanopublication.
np:hasProvenance rdfs:range np:Provenance.
np:hasPublicationInfo a owl:FunctionalProperty.
np:hasPublicationInfo rdfs:domain np:Nanopublication.
np:hasPublicationInfo rdfs:range np:PublicationInfo.
Tobias Kuhn, VU University Amsterdam nanopub-java: A Java Library for Nanopublications 5 / 19
6. Nanopublication Guidelines
We need libraries to enforce and check this!
http://nanopub.org/guidelines/working_draft/
Tobias Kuhn, VU University Amsterdam nanopub-java: A Java Library for Nanopublications 6 / 19
7. check / CheckNanopub
Reads a nanopublication or several of them and checks whether any
of the well-formedness criteria are violated:
$ np check nanopubfile.trig
Summary: 3 valid (not trusty);
Tobias Kuhn, VU University Amsterdam nanopub-java: A Java Library for Nanopublications 7 / 19
8. Trusty URIs: Cryptographic Hash Values for
Nanopublication Identifiers
Nanopublications with Trusty URIs are ...
Verifiable
+
Immutable
+
Permanent
.trighttp://example.org/r1. RA 5AbXdpz5DcaYXCh9l3eI9ruBosiL5XDU3rxBbBaUO70
http://trustyuri.net/
Kuhn, Dumontier. Trusty URIs: Verifiable, Immutable, and Permanent Digital Artifacts for Linked Data. ESWC 2014.
Tobias Kuhn, VU University Amsterdam nanopub-java: A Java Library for Nanopublications 8 / 19
9. mktrusty / MakeTrustyNanopub
Takes a non-trusty nanopublication and transforms it into one with
a newly created trusty URI:
$ np mktrusty nanopubfile.trig
or:
$ np mktrusty -v nanopubfile.trig
Nanopub URI: http://example.org/np1#RAHGB0WzgQijR88g rIwtP
Nanopub URI: http://example.org/np2#RA4xTdhe2gPctqvAwdgTU4
Nanopub URI: http://example.org/np3#RAEjvXP0xTkeIa2mKmYT66
This generates a file trusty.nanopubfile.trig:
$ np check trusty.nanopubfile.trig
Summary: 3 trusty (unsigned);
Tobias Kuhn, VU University Amsterdam nanopub-java: A Java Library for Nanopublications 9 / 19
10. Decentralized and Reliable Publishing with a
Nanopublication Server Network
Nanopublications
with Trusty URIs
Publication
Retrieval
Propagation /
Archiving
http://npmonitor.inn.ac
Tobias Kuhn, VU University Amsterdam nanopub-java: A Java Library for Nanopublications 10 / 19
11. publish / PublishNanopub
Uploads trusty nanopublications to the server network, and they
are then distributed among the servers of the network:
$ np publish trusty.nanopubfile.trig
3 nanopubs published at http://np.inn.ac/
In this way, a nanopublication is made permanent and its publication
cannot be undone.
Tobias Kuhn, VU University Amsterdam nanopub-java: A Java Library for Nanopublications 11 / 19
12. status / NanopubStatus
Checks whether and how often a given nanopublication (identified by
its trusty URI) is found on the server network:
$ np status -a http://example.org/np1#RAHGB0WzgQijR88g rIw
URL: http://np.inn.ac/RAHGB0WzgQijR88g rIwtPCmzYgyO4wRMT7M
URL: http://ristretto.med.yale.edu:8080/nanopub-server/RAH
URL: http://nanopub-server.ops.labs.vu.nl/RAHGB0WzgQijR88g
URL: http://nanopubs.stanford.edu/nanopub-server/RAHGB0Wzg
URL: http://nanopubs.semanticscience.org/RAHGB0WzgQijR88g
Found on 5 nanopub servers.
Tobias Kuhn, VU University Amsterdam nanopub-java: A Java Library for Nanopublications 12 / 19
13. get / GetNanopub
Retrieves given nanopublications from the server network, and
verifies them according to their trusty URIs (only verified
nanopublications are returned):
$ np get http://www.tkuhn.ch/bel2nanopub/RAhV9IpiUEjbentzG
or:
$ np get RAhV9IpiUEjbentzGivp1Lbx0BVegp5sgE3BwS0S2RAYM
Tobias Kuhn, VU University Amsterdam nanopub-java: A Java Library for Nanopublications 13 / 19
14. Defining Datasets with Nanopublication Indexes
(which are themselves Nanopublications)
appends
has sub-index
has
element
(a) (b)
(c) (f)
(d) (e)
Tobias Kuhn, VU University Amsterdam nanopub-java: A Java Library for Nanopublications 14 / 19
15. mkindex / MakeIndex
Takes a list of nanopublications and creates an index that refers to
them (which itself consists of one or more nanopublications):
$ np mkindex trusty.nanopubfile.trig
Index URI: http://np.inn.ac/RAFa x4h0ng NXtof35Ie9pQVsAY69
This creates a new file index.nanopubfile.trig containing the
index nanopublication(s).
Tobias Kuhn, VU University Amsterdam nanopub-java: A Java Library for Nanopublications 15 / 19
16. Publishing / Retrieving Indexes
As indexes are also nanopublications, we can publish them in the
same way:
$ np publish index.nanopubfile.trig
1 nanopub published at http://np.inn.ac/
Retrieving the content of a nanopublication index (and not just the
top-most index nanopublication) with argument -c:
$ np get -c http://np.inn.ac/RAFa x4h0ng NXtof35Ie9pQVsAY6
Tobias Kuhn, VU University Amsterdam nanopub-java: A Java Library for Nanopublications 16 / 19
18. sign / SignNanopub (experimental)
Takes a nanopublication and digitally signs it with a given private
key.
Create a key pair:
$ np mkkeys
Digitally sign nanopublications (and make them trusty):
$ np sign nanopubfile.trig
This creates a file signed.nanopubfile.trig, which we can now
check:
$ np check signed.nanopubfile.trig
Summary: 3 signed and trusty;
Tobias Kuhn, VU University Amsterdam nanopub-java: A Java Library for Nanopublications 18 / 19
19. Thank you for your attention!
Questions?
Further information:
• Paper for this talk: http://arxiv.org/abs/1508.04977
• Nanopublications: http://nanopub.org
• Trusty URIs: http://trustyuri.net
Come to my presentation at the main conference: Thursday, 15
October, 11:00 in the Scientific Data track: Publishing without
Publishers: a Decentralized Approach to Dissemination, Retrieval,
and Archiving of Data
Tobias Kuhn, VU University Amsterdam nanopub-java: A Java Library for Nanopublications 19 / 19