Search in sources :

Example 6 with OWLDeclarationAxiom

use of org.semanticweb.owlapi.model.OWLDeclarationAxiom in project stanbol by apache.

the class JenaToOwlConvert method ClassOwlToJena.

// //////////////////////////////////////////////////////////////////////////////
/**
     * This function converts a single OWLClass of OWLAPI to an OntClass of Jena
     * 
     * @param data
     *            {An OWLClass}
     * @param format
     *            {RDF/XML or TURTLE}
     * @return {An OntClass}
     */
public synchronized OntClass ClassOwlToJena(OWLClass data, String format) {
    while (available == false) {
        try {
            wait();
        } catch (InterruptedException e) {
            System.err.println("ClassOwlToJena::: " + e);
        }
    }
    available = false;
    try {
        OWLOntologyManager manager = OWLManager.createOWLOntologyManager();
        OWLOntology ontology = manager.createOntology(IRI.create("http://www.semanticweb.org/owlapi/ontologies/ontology"));
        OWLDataFactory factory = manager.getOWLDataFactory();
        OWLDeclarationAxiom declarationAxiom = factory.getOWLDeclarationAxiom(data);
        manager.addAxiom(ontology, declarationAxiom);
        OntModel jenamodel = ModelOwlToJenaConvert(ontology, format);
        available = true;
        notifyAll();
        return jenamodel.getOntClass(data.getIRI().toString());
    } catch (OWLOntologyCreationException eoc) {
        System.err.print("ClassOwlToJena::: ");
        eoc.printStackTrace();
        return null;
    }
}
Also used : OWLOntologyCreationException(org.semanticweb.owlapi.model.OWLOntologyCreationException) OWLDeclarationAxiom(org.semanticweb.owlapi.model.OWLDeclarationAxiom) OWLOntology(org.semanticweb.owlapi.model.OWLOntology) OntModel(com.hp.hpl.jena.ontology.OntModel) OWLOntologyManager(org.semanticweb.owlapi.model.OWLOntologyManager) OWLDataFactory(org.semanticweb.owlapi.model.OWLDataFactory)

Aggregations

OWLDataFactory (org.semanticweb.owlapi.model.OWLDataFactory)6 OWLDeclarationAxiom (org.semanticweb.owlapi.model.OWLDeclarationAxiom)6 OWLOntology (org.semanticweb.owlapi.model.OWLOntology)6 OWLOntologyCreationException (org.semanticweb.owlapi.model.OWLOntologyCreationException)6 OWLOntologyManager (org.semanticweb.owlapi.model.OWLOntologyManager)6 OntModel (com.hp.hpl.jena.ontology.OntModel)4 Statement (com.hp.hpl.jena.rdf.model.Statement)2 StmtIterator (com.hp.hpl.jena.rdf.model.StmtIterator)2 OWLAnnotation (org.semanticweb.owlapi.model.OWLAnnotation)2 OWLAnnotationAssertionAxiom (org.semanticweb.owlapi.model.OWLAnnotationAssertionAxiom)2 OWLAnnotationProperty (org.semanticweb.owlapi.model.OWLAnnotationProperty)2 OWLClass (org.semanticweb.owlapi.model.OWLClass)2 OWLClassAssertionAxiom (org.semanticweb.owlapi.model.OWLClassAssertionAxiom)2 OWLDataProperty (org.semanticweb.owlapi.model.OWLDataProperty)2 OWLDataPropertyAssertionAxiom (org.semanticweb.owlapi.model.OWLDataPropertyAssertionAxiom)2 OWLDatatype (org.semanticweb.owlapi.model.OWLDatatype)2 OWLLiteral (org.semanticweb.owlapi.model.OWLLiteral)2 OWLNamedIndividual (org.semanticweb.owlapi.model.OWLNamedIndividual)2 OWLObjectProperty (org.semanticweb.owlapi.model.OWLObjectProperty)2 OWLObjectPropertyAssertionAxiom (org.semanticweb.owlapi.model.OWLObjectPropertyAssertionAxiom)2