项目作者: flekschas

项目描述 :
Convert OWL to labeled property graph and import into Neo4J
高级语言: Java
项目地址: git://github.com/flekschas/owl2neo4j.git
创建时间: 2015-07-13T17:31:07Z
项目社区:https://github.com/flekschas/owl2neo4j

开源协议:MIT License

下载


OWL 2 Neo4J Build Status

Convert OWL schema ontologies to labeled property graph and import into Neo4J.

Note: currently the tool only converts the class hierarchy; instances are ignored for now.

Build

Each release comes with a precompiled JAR, created automatically by Travis-CI. To build the JAR file manually follow the three steps below. The JAR file will be created in dist.

Requirements:

  1. git clone https://github.com/flekschas/owl2neo4j && cd owl2neo4j
  2. gradle build

Import ontology

Requirements:

A single file import is executed as follows:

  1. java -jar ./dist/owl2neo4j.jar -o ./pizza.owl -n "Pizza Ontology" -a pizza

(To get pizza.owl run curl -O https://protege.stanford.edu/ontologies/pizza/pizza.owl.)

In order to import multiple ontologies at once create a JSON file:

  1. {
  2. "server": "http://my-server:7474",
  3. "ontologies": [
  4. {
  5. "o": "./chebi.owl",
  6. "n": "Chemical Entities of Biological Interest",
  7. "a": "CHEBI"
  8. },
  9. {
  10. "o": "./cl.owl",
  11. "n": "Cell Ontology",
  12. "a": "CL",
  13. "i": true
  14. },
  15. {
  16. "o": "./efo.owl",
  17. "n": "Experimental Factor Ontology",
  18. "a": "EFO"
  19. }
  20. ]
  21. }

a, i, n and o correspond to the CLI options. The only difference is that n, i.e. the path to the OWL file to be imported, should be relative to the JSON file. server is optional; when it’s not defined, the default server url, i.e. http://127.0.0.1:7474, is used.
Next you can import the everything with the following call:

  1. $ java -jar ./dist/owl2neo4j.jar -b ./import.json

(Assuming that the file above is ./import.json.)

Command line options:

  1. usage: java -jar owl2neo4j.jar -a <String> -b <Path> [--eqp <String>] [-h]
  2. [-i] [-l] -n <String> -o <Path> [-p <String>] [-s <URL>] [-u
  3. <String>] [-v] [--version]
  4. Import OWL into Neo4J as a labeled property graph.
  5. -a,--abbreviation <String> Ontology abbreviation (E.g. go)
  6. -b,--batch <Path> Path to JSON file
  7. --eqp <String> Existential quantification property (E.g.
  8. http://www.co-ode.org/ontologies/pizza/pizza
  9. .owl#hasTopping)
  10. -h,--help Shows this help
  11. -i,--incl-imports Include import closure
  12. -l,--no-local Don't scan for locally available OWL files
  13. to ensure loading remote files.
  14. -n,--name <String> Ontology name (E.g. Gene Ontology)
  15. -o,--owl <Path> Path to OWL file
  16. -p,--password <String> Neo4J user password
  17. -s,--server <URL> Neo4J server root URL [Default:
  18. http://localhost:7474]
  19. -u,--user <String> Neo4J user name
  20. -v,--verbosity Verbose output
  21. --version Show version

For detailed instructions and help regarding the different options please refer to the wiki.

Importing large ontologies:

By default the OWLAPI XML loader has a 64,000 triple limit. To increase the limit and being able to import larger ontologies start owl2neo4j.jar with DentityExpansionLimit=<LARGE_NUMBER> flag like so:

  1. java -jar -DentityExpansionLimit=1000000 ./dist/owl2neo4j.jar -o ./extra-large-pizza.owl -n "Extra Large Pizza Ontology" -a elpo

Be sure that you have enough RAM to theoretical load 1000000 (or any other number), otherwise your system will complain.

Handshake error:

In case you see a handshake error of this form Remote host closed connection during handshake add the following parameter when calling java:

  1. java -jar -Dhttps.protocols=TLSv1.1,TLSv1.2 ...