Skip to content

Generates GraphML from OWL ontologies

License

Notifications You must be signed in to change notification settings

Onto-Med/OWL2GraphML

Repository files navigation

OWL2GraphML

Introduction

OWL2GraphML is a tool to generate a GraphML formatted graph from OWL ontologies. The tool used the OWL-API to read ontologies and it can be used as plugin for Protégé (tested for version 5). The original creator of this tool is Alexandr Uciteli from the Onto-Med research group at the Institute for Medical Informatics, Statistics and Epidemiology of the University of Leipzig.

How to use

There are two different ways to use this tool. You can add it as a new view to be used in Protégé or you can access the methods of this tool directly by adding it as dependency to your Java project.

Use as Protégé plugin

Download one of our releases and place the JAR file inside the plugins directory of Protégé. After restarting Protégé, a new entry "OWL2GraphML" appears in the Window > Views > Ontology views context menu.

Location of plugin in Protégé context menu

Usage in Java application

Add OWL2GraphMl as dependency to your project (e.g. as maven dependency in pom.xml). OWL2GraphML is available as maven package on https://maven.pkg.github.com.

<dependency>
    <groupId>de.imise.ontomed</groupId>
    <artifactId>owl2graphml</artifactId>
    <version>1.0.1</version>
</dependency>

Create an instance of the MainOntology class:

import de.imise.ontomed.owl2graphml.onto.MainOntology;

// ...

MainOntology mo = new MainOntology(
  ontology,                            // an OWLOntology instance
  "https://example.org/example#Thing", // IRI of the class you want to use as root of the graph
  "down",                              // direction in which classes should be harvested from the ontology (allowed are "up" and "down")
  5                                    // maximum depth for class harvesting
);

Set additional properties to manipulate the resulting GraphML:

mo.addTaxonomy();                         // add edges between superclass and subclass
mo.addAnnotations();                      // add annotation properties to graph
mo.addPropertyRestrictionSuperClasses();  // add superclasses of the property restrictions to the graph
mo.addEquivalentClasses();                // add equivalent classes to graph
mo.addIndividuals();                      // add individuals to graph
mo.addIndividualTypes();                  // add individual types to graph
mo.addIndividualAssertions();             // add individual assertion axioms to graph
mo.addPropertyDefinitions();              // add property definitions to graph

Write resulting GraphML to file:

mo.toXml()                 // create an XML instance
    .writeXML(outputFile); // write XML to the specified file

See also

References

- pending -