lgrozinger / rdfscript

1 stars 0 forks source link

RDFScript

A scripting language for creating RDF graphs.

Get Started

Dependencies

RDFScript requires Python 3.x.

Python package dependencies are listed in setup.py.

Install

  1. Download or clone repository. git clone https://github.com/lgrozinger/rdfscript.git
  2. Navigate to RDFScript directory. cd rdfscript

(This method requires setuptools, which can be installed from your package manager on most *nix systems, and is probably called python3-setuptools or similar) 3a. As a non-root user. python setup.py install --user

(This method requires pip) 3b.python -m pip install rdflib lxml requests ply pathlib pysbolgraph

Example usage

Running the example in examples/templates.rdfsh

python run.py -s rdfxml examples/templates.rdfsh -o <output-file>

Run the REPL

python run.py -s rdfxml -o <output-file>

Display command line options, including available serialisations.

python run.py -h

The example files in examples/ are commented with some explaination of the language.

SBOL example

  1. Get the ShortBOL2 template libraries. In a suitable directory git clone https://github.com/lgrozinger/ShortBOL2
  2. In the rdfscript directory python run.py -s sbolxml <YOUR_SHORTBOL2_DIR>/example.rdfsh -o <output-file>
  3. output-file is an SBOL file.

Contributing

dev is for the latest code that should work.

Extensions

Extensions provide a way to execute Python code to do additional, more complex processing of the RDF triples generated by expanding templates.

Extensions intended as built-ins should be added to the extensions package. 'Third party' extensions can also be added at the command line, as long as they are in the Python PATH.

For an example of an extension, see AtLeastOne in https://github.com/lgrozinger/rdfscript/blob/dev/extensions/cardinality.py

Language

Please branch off of dev for feature development, or work directly on dev for bug-fixes.

Testing

A test suite using the Python3 unittest package is under the test/ directory.

Run the tests from the project root using python -m unittest

Acknowledgements

The concept, design and implementation draws heavily on work from Matt Pocock on ShortBOL. Many thanks to Matt