Skip to content

Nanopublication/nanopub-java

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

nanopub-java

This is a Java library for nanopublications (see http://nanopub.net) based on RDF4J.

It implements the formal structure defined in the official nanopublication guidelines.

Publication

Usage as Java Library

The easiest way to use this library in your project is to let Maven download it from The Central Repository. Just include the following lines in your pom.xml file:

<dependency>
  <groupId>org.nanopub</groupId>
  <artifactId>nanopub</artifactId>
  <version>1.46</version>
</dependency>

Alternatively, you might want to use one of the pre-built jar files.

Usage on Unix Command-Line

To use this library on the command line, just download the np script. Make sure it is executable and then you can invoke it with ./np, for example:

./np check nanopubfile.trig

This automatically downloads the latest release as a jar file on the first run. You can also directly use the prebuilt jar files:

java -jar nanopub-1.30-jar-with-dependencies.jar check nanopubfile.trig

Note: For Mac users, before running np ensure that the GNU version of curl is installed (not the default BSD versions), and are the ones being used when the curl command is invoked.

Usage with Docker

You can use this image from DockerHub.

Sign a nanopublication (nanopub.trig file in current dir here):

docker run -it --rm -v ~/.nanopub:/root/.nanopub -v $(pwd):/data umids/nanopub-java sign /data/nanopub.trig

Publish a signed nanopublication:

docker run -it --rm -v ~/.nanopub:/root/.nanopub -v $(pwd):/data umids/nanopub-java publish /data/signed.nanopub.trig

Build the Docker image:

docker build -t umids/nanopub-java .

Compilation

Maven has to be installed to compile the library:

mvn clean package

The library features can then be accessed by calling scripts/run.sh (with the same commands as for the np script above, but using the locally compiled code and not the jar file).

Developers

License

nanopub-java is free software under the MIT License. See LICENSE.txt.

Usage Tracking

This is an incomplete (and outdated) list of software projects using this library: