Skip to content
forked from SynBioDex/libSBOLj

Java Library for Synthetic Biology Open Language (SBOL)

License

Notifications You must be signed in to change notification settings

goksel/libSBOLj

 
 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

libSBOLj: SBOL Java library

libSBOLj provides the core Java interfaces and their implementation for the Synthetic Biology Open Language (SBOL). The library provides an API to work with SBOL objects, the functionality to read and write SBOL documents as XML/RDF files, and a validator to check the correctness of SBOL models.

Getting the libSBOLj source

  1. Create a GitHub account. link

  2. Download and set up Git. link

  3. Fork the libSBOLj repository and clone it to your machine. link

  4. Download and set up Maven. link

  5. Change to your libSBOLj directory via the command line and execute the following command:

    mvn package

This will create the libSBOLj JAR file (libSBOLj-core-1.0.0-SNAPSHOT.jar) and place it into the core/target subdirectory. link

Using libSBOLj

libSBOLj command line

libSBOLj comes with a command-line interface (CLI) that can be used to validate SBOL files. After you build the libSBOLj-core-1.0.0-SNAPSHOT.jar as described above, you can use it to validate files as follows after changing to the core/target subdirectory:

cd core/target/
java -jar libSBOLj-core-1.0.0-SNAPSHOT.jar test-classes/test/data/BBa_I0462.xml

If validation is successful, the program will print the contents of the SBOL document. Use --quiet option if you want to suppress this output.

java -jar libSBOLj-core-1.0.0-SNAPSHOT.jar --quiet test-classes/test/data/BBa_I0462.xml

If validation fails with an error, there will be a message printed about the validation error. To see an example, try the following command:

java -jar libSBOLj-core-1.0.0-SNAPSHOT.jar test-classes/test/data/invalid01_missing_displayId.xml

Serialization in libSBOLj

libSBOLj provides support for reading and writing libSBOLj documents in XML syntax. The structure of the documents is defined in two XML schema (XSD) files that can be found in the core/src/main/resources directory.

A very simple SBOL document looks like this in XML:

<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
<rdf:RDF xmlns="http://sbols.org/v1#" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#">
    <DnaComponent rdf:about="http://example.com/MyDnaComponent">
        <displayId>MyDnaComponent</displayId>
        <name>myDNA</name>
        <description>This is a very simple example</description>
    </DnaComponent>
</rdf:RDF>

More complete examples can be found in examples/data directory.

Note that, the XML serialization of SBOL documents have been designed to be compatible with Resource Description Format (RDF). Any valid SBOL XML file can be parsed by a standard RDF tool that supports RDF/XML syntax. But different RDF serializations will not be valid if they do not match the constraints defined in the SBOL XML schema and cannot be read by libSBOLj.

libSBOLj provides also a more readable, human-friendly output format that aligns more closely with the SBOL object model defined in the specification. The above example would look as follows in this syntax:

SBOLDocument [
   DnaComponent [
      uri: http://example.com/MyDnaComponent
      displayId: MyDnaComponent
      description: This is a very simple example
   ]
]  

This format is only intended for presentation purposes and not to exchange libSBOLj structures and the library does not provide any means to read this syntax.

About

Java Library for Synthetic Biology Open Language (SBOL)

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Languages

  • Java 100.0%