ONT-API is an RDF-centric Java library to work with OWL2.
For more info about the library see the project wiki.
- Apache Jena (4.x.x)
- OWL-API (5.x.x)
- Java 11+
- Apache License Version 2.0
- GNU LGPL Version 3.0
import com.github.owlcs.ontapi.OntManagers;
import com.github.owlcs.ontapi.Ontology;
import vocabulary.com.github.sszuev.jena.ontapi.OWL;
import org.apache.jena.rdf.model.Model;
import org.semanticweb.owlapi.model.IRI;
import org.semanticweb.owlapi.model.OWLDataFactory;
public class Examples {
public static void main(String... args) {
String iri = "https://example.com";
OWLDataFactory df = OntManagers.getDataFactory();
Ontology owl = OntManagers.createManager().createOntology(IRI.create(iri));
owl.addAxiom(df.getOWLDeclarationAxiom(df.getOWLClass(iri + "#Class1")));
Model jena = owl.asGraphModel();
jena.createResource(iri + "#Class2", OWL.Class);
owl.axioms().forEach(System.out::println);
jena.write(System.out, "ttl");
}
}