Examples of JenaToOwlConvert


Examples of org.apache.stanbol.commons.owl.transformation.JenaToOwlConvert

                }

  }

  public void testDataPropJenaToOwl() {
            JenaToOwlConvert j2o = new JenaToOwlConvert();
            OntModel model = ModelFactory.createOntologyModel();
            DatatypeProperty jp = model.createDatatypeProperty(DP.toString());
            OWLDataProperty wp = null;
            try{
                wp = j2o.DataPropJenaToOwl(jp, RDFXML);
                if(wp==null){
                    fail("Some problem accours");
                }else{
                      assertEquals(wp.getIRI().toURI().toString(), jp.getURI().toString());
                }
View Full Code Here

Examples of org.apache.stanbol.commons.owl.transformation.JenaToOwlConvert

                    assertNotNull(wp);
                }
  }

  public void testDataPropOwlToJena() {
    JenaToOwlConvert j2o = new JenaToOwlConvert();
    OWLOntologyManager mgr = OWLManager.createOWLOntologyManager();
    OWLDataFactory factory = mgr.getOWLDataFactory();
    OWLDataProperty dp = factory.getOWLDataProperty(IRI.create(DP));
    DatatypeProperty jdp = null;
    try {
                    jdp = j2o.DataPropOwlToJena(dp, RDFXML);
                    if(jdp == null){
                        fail("Some errors accour");
                    }else{
                        assertEquals(jdp.getURI(), dp.getIRI().toString());
                    }
View Full Code Here

Examples of org.apache.stanbol.commons.owl.transformation.JenaToOwlConvert

                   assertNotNull(jdp);
               
  }

  public void testModelJenaToOwlConvert() {
            JenaToOwlConvert j2o = new JenaToOwlConvert();
            OntModel model = ModelFactory.createOntologyModel();
            OWLOntologyManager mgr = OWLManager.createOWLOntologyManager();
            OWLDataFactory factory = mgr.getOWLDataFactory();
            String dul = "http://www.loa-cnr.it/ontologies/DUL.owl";
            OWLOntology owl = null;

            try{
                model.read(dul,RDFXML);
            }catch (Exception e){
              e.printStackTrace();
              fail("Could not load ontology");
            }

            try{
                owl = j2o.ModelJenaToOwlConvert(model, RDFXML);
                if(owl == null){
                    fail("Some errors occur");
                }else{

                    ExtendedIterator<OntClass> jenaclass = model.listNamedClasses();
View Full Code Here

Examples of org.apache.stanbol.commons.owl.transformation.JenaToOwlConvert

                assertNotNull(owl);
            }
  }

  public void testModelOwlToJenaConvert() {
    JenaToOwlConvert j2o = new JenaToOwlConvert();
    OWLOntologyManager mgr = OWLManager.createOWLOntologyManager();
                OWLOntologyManager mgrf = OWLManager.createOWLOntologyManager();
                OWLDataFactory factory = mgrf.getOWLDataFactory();
    String dul = "http://www.loa-cnr.it/ontologies/DUL.owl";
    OWLOntology owl = null;
    OntModel jena = null;
    try {
      owl = mgr.loadOntologyFromOntologyDocument(IRI.create(dul));
    } catch (OWLOntologyCreationException e) {
      e.printStackTrace();
      fail("Could not load ontology");
    }
    try {
      jena = j2o.ModelOwlToJenaConvert(owl, "RDF/XML");
                        if(jena == null){
                            fail("Some errors occur");
                        }else{
                   
                    ExtendedIterator<OntClass> jenaclass = jena.listNamedClasses();
View Full Code Here

Examples of org.apache.stanbol.commons.owl.transformation.JenaToOwlConvert

                    assertNotNull(jena);
                }
  }

  public void testObjPropJenaToOwl() {
            JenaToOwlConvert j2o = new JenaToOwlConvert();
            OntModel model = ModelFactory.createOntologyModel();
            ObjectProperty jp = model.createObjectProperty(OP.toString());
            OWLObjectProperty wp = null;
            try{
            wp = j2o.ObjPropJenaToOwl(jp, RDFXML);
                if(wp == null){
                    fail("Some errors occurs");
                }else{
                  assertEquals(wp.getIRI().toURI().toString(), jp.getURI().toString());
                }
View Full Code Here

Examples of org.apache.stanbol.commons.owl.transformation.JenaToOwlConvert

                assertNotNull(wp);
            }
  }

  public void testObjPropOwlToJena() {
    JenaToOwlConvert j2o = new JenaToOwlConvert();
    OWLOntologyManager mgr = OWLManager.createOWLOntologyManager();
    OWLDataFactory factory = mgr.getOWLDataFactory();
    OWLObjectProperty op = factory.getOWLObjectProperty(IRI.create(OP));
    ObjectProperty jop = null;
    try {
                    jop = j2o.ObjPropOwlToJena(op, RDFXML);
                    if(jop == null){
                        fail("Some errore occurs");
                    }else{
                        assertEquals(jop.getURI(), op.getIRI().toString());
                    }    
View Full Code Here

Examples of org.apache.stanbol.commons.owl.transformation.JenaToOwlConvert

   
  }

  public void testResourceJenaToOwlAxiom() {
   
            JenaToOwlConvert j2o = new JenaToOwlConvert();
            OntModel model = ModelFactory.createOntologyModel();

            OntClass jenaclass = model.createClass(CLAZZ.toString());
            ObjectProperty jenaobprop = model.createObjectProperty(OP.toString());
            DatatypeProperty jenadataprop = model.createDatatypeProperty(DP.toString());
            Individual jenasub = model.createIndividual(SUBJECT.toString(), jenaclass);
            Individual jenaobj = model.createIndividual(OBJECT.toString(), jenaclass);
            AnnotationProperty jenaanno = model.createAnnotationProperty(label.toString());
            Literal value = model.createTypedLiteral(VALUE,DATATYPE.toString());

            model.add(jenasub, jenaobprop, jenaobj);
            model.add(jenasub,jenadataprop,value);
            model.add(jenasub,jenaanno,"Lucy","en");

            Set<OWLAxiom> owlaxiom = null;

            try{
                owlaxiom = j2o.ResourceJenaToOwlAxiom(jenasub, RDFXML);
                if(owlaxiom==null){
                    fail("Some errors occur");
                }else{

                StmtIterator str = model.listStatements();
View Full Code Here

Examples of org.apache.stanbol.commons.owl.transformation.JenaToOwlConvert

            }
  }

        public void testEntityOwlToJenaResource() {

            JenaToOwlConvert j2o = new JenaToOwlConvert();
            OWLOntologyManager mgr = OWLManager.createOWLOntologyManager();
            OWLOntology ont = null;
            StmtIterator resource = null;

            try{
             ont = mgr.createOntology();
            } catch (OWLOntologyCreationException e) {
      e.printStackTrace();
      fail("Could not load ontology");
            }

                OWLDataFactory factory = mgr.getOWLDataFactory();

                OWLClass cls = factory.getOWLClass(IRI.create(CLAZZ));
                OWLDataProperty dp = factory.getOWLDataProperty(IRI.create(DP));
                OWLObjectProperty op = factory.getOWLObjectProperty(IRI.create(OP));
                OWLAnnotationProperty oa = factory.getOWLAnnotationProperty(IRI.create(label));
                OWLAnnotation     oav = factory.getOWLAnnotation(oa, factory.getOWLStringLiteral(clazzlabel,"en"));
                OWLDatatype dt = factory.getOWLDatatype(IRI.create(DATATYPE));
                OWLNamedIndividual sub = factory.getOWLNamedIndividual(IRI.create(SUBJECT));
                OWLNamedIndividual obj = factory.getOWLNamedIndividual(IRI.create(OBJECT));
                OWLLiteral literal1 = factory.getOWLTypedLiteral(VALUE,dt);
                OWLDeclarationAxiom daxiomcls = factory.getOWLDeclarationAxiom(cls); //Classe
                OWLDeclarationAxiom daxiomop = factory.getOWLDeclarationAxiom(op); //obj prop
                OWLDeclarationAxiom daxiomdp = factory.getOWLDeclarationAxiom(dp); //data prop
                OWLDeclarationAxiom daxiomsub = factory.getOWLDeclarationAxiom(sub); //subject
                OWLDeclarationAxiom daxiomobj = factory.getOWLDeclarationAxiom(obj); //object

                OWLClassAssertionAxiom axiomsub = factory.getOWLClassAssertionAxiom(cls,sub); //Istanza
                OWLClassAssertionAxiom axiomobj = factory.getOWLClassAssertionAxiom(cls,obj); //Istanza
                OWLObjectPropertyAssertionAxiom axiomop = factory.getOWLObjectPropertyAssertionAxiom(op, sub, obj); //Obj prop tra individui
                OWLDataPropertyAssertionAxiom axiomvalue = factory.getOWLDataPropertyAssertionAxiom(dp, sub,literal1); //Dataprop all'istanza;
                OWLAnnotationAssertionAxiom axioman = factory.getOWLAnnotationAssertionAxiom(cls.getIRI(), oav); //Annotazione

                mgr.addAxiom(ont,daxiomcls);
                mgr.addAxiom(ont,daxiomop);
                mgr.addAxiom(ont,daxiomdp);
                mgr.addAxiom(ont,daxiomsub);
                mgr.addAxiom(ont,daxiomobj);
                mgr.addAxiom(ont,axiomsub);
                mgr.addAxiom(ont,axiomobj);
                mgr.addAxiom(ont,axiomop);
                mgr.addAxiom(ont,axiomvalue);
                mgr.addAxiom(ont,axioman);

                Set<OWLIndividualAxiom> ind = ont.getAxioms(sub);

                try{
                    resource = j2o.EntityOwlToJenaResource(daxiomsub.getEntity(), ont, RDFXML);
                    if(resource == null){
                        fail("Some errors accour");
                    }else{

                    int cont = 0;
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.