Examples of JenaToOwlConvert


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

                    throw new UnsupportedOperationException("Cannot remove statements from the iterator");
                }

            };
        } else if (type.isAssignableFrom(Statement.class)) {
            final OntModel input = new JenaToOwlConvert().ModelOwlToJenaConvert(o, "RDF/XML");
            final StmtIterator iterator = input.listStatements();
            return new Iterator<T>() {

                @Override
                public boolean hasNext() {
View Full Code Here

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

     */
    public RunSingleSPARQL(OWLOntology owl){
        this.owlmodel = owl;

        try{
        JenaToOwlConvert j2o = new JenaToOwlConvert();
        this.jenamodel = j2o.ModelOwlToJenaConvert(owlmodel,"RDF/XML");
        Iterator<String> iter = jenamodel.getNsPrefixMap().keySet().iterator();
        Map<String, String> map = jenamodel.getNsPrefixMap();
        this.sparqlprefix = (HashMap<String, String>) map;
  
        while(iter.hasNext()){
View Full Code Here

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

     * @param owl {The OWLOntology to be querying}
     * @param prefix {The map where the keys are the prefix label and the value the IRI of the prefix on the form: http://www.w3.org/2000/01/rdf-schema#.}
     */
    public RunSingleSPARQL(OWLOntology owl, HashMap<String,String> prefix){
        this.owlmodel = owl;
        JenaToOwlConvert j2o = new JenaToOwlConvert();
        this.jenamodel = j2o.ModelOwlToJenaConvert(owlmodel,"RDF/XML");
        Iterator<String> keys = prefix.keySet().iterator();
        this.sparqlprefix = new HashMap();
        while(keys.hasNext()){
            String key = keys.next();
            String pre = prefix.get(key);
View Full Code Here

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

        } catch (ParseException e) {
            log.error("Unable to execute SPARQL. ", e);
        }

        Model om = JenaToClerezzaConverter.clerezzaMGraphToJenaModel(mGraph);
        JenaToOwlConvert converter = new JenaToOwlConvert();

        return converter.ModelJenaToOwlConvert(om, "RDF/XML");
    }
View Full Code Here

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

                    throw new UnsupportedOperationException("Cannot remove statements from the iterator");
                }

            };
        } else if (type.isAssignableFrom(Statement.class)) {
            final OntModel input = new JenaToOwlConvert().ModelOwlToJenaConvert(o, "RDF/XML");
            final StmtIterator iterator = input.listStatements();
            return new Iterator<T>() {

                @Override
                public boolean hasNext() {
View Full Code Here

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

  private static final URI OBJECT = URI.create(_BASE + "#" + "Linus");

        public void testAxiomOwlToJenaResource(){

    JenaToOwlConvert j2o = new JenaToOwlConvert();

                OWLOntologyManager mgr = OWLManager.createOWLOntologyManager();
                OWLOntology ont = null;
                try{
                    ont = mgr.createOntology();
                } catch(OWLOntologyCreationException e){
                    e.printStackTrace();
                    fail("Can not create ontology");
                }

                OWLDataFactory factory = mgr.getOWLDataFactory();

                StmtIterator resource = null;

                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, obj,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<OWLAxiom> setaxiom = ont.getAxioms();

                try{
                    resource = j2o.AxiomOwlToJenaResource(setaxiom, RDFXML);
                    if(resource == null){
                        fail("Some errors occur");
                    }else{
                        String statment = "[http://www.w3.org/2000/01/rdf-schema#label, http://www.w3.org/2000/01/rdf-schema#range, http://www.w3.org/2000/01/rdf-schema#Literal] "+
                        "[http://example.org/dummy#hasAge, http://www.w3.org/1999/02/22-rdf-syntax-ns#type, http://www.w3.org/2002/07/owl#DatatypeProperty] "+
View Full Code Here

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

                    assertNotNull(resource);
                }
  }

  public void testAnnotationPropJenaToOwl() {
            JenaToOwlConvert j2o = new JenaToOwlConvert();
            OntModel model = ModelFactory.createOntologyModel();
            AnnotationProperty jp = model.createAnnotationProperty(label.toString());
            OWLAnnotationProperty wp = null;
            try{
                wp = j2o.AnnotationPropJenaToOwl(jp, RDFXML);
                if(wp==null){
                    fail("Some errors occur");
                }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 testAnnotationPropOwlToJena() {
            JenaToOwlConvert j2o = new JenaToOwlConvert();
            OWLOntologyManager mgr = OWLManager.createOWLOntologyManager();
            OWLDataFactory factory = mgr.getOWLDataFactory();
            OWLAnnotationProperty wp = factory.getOWLAnnotationProperty(IRI.create(label));
            AnnotationProperty jp = null;
            try{
                jp = j2o.AnnotationPropOwlToJena(wp, RDFXML);
                if(jp==null){
                    fail("Some errors occur");
                }else{
                    assertEquals(wp.getIRI().toURI().toString(), jp.getURI().toString());
                }
View Full Code Here

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

               assertNotNull(jp);
            }
  }

  public void testClassJenaToOwl() {
            JenaToOwlConvert j2o = new JenaToOwlConvert();
            OntModel model = ModelFactory.createOntologyModel();
            OntClass jc = model.createClass(CLAZZ.toString());
            OWLClass wc = null;
            try{
                wc = j2o.ClassJenaToOwl(jc, RDFXML);
                if(wc==null)
                    fail("Some problems accours");
                else{
                    assertEquals(wc.getIRI().toURI().toString(), jc.getURI().toString());
                }
View Full Code Here

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

      assertNotNull(wc);
            }
  }

  public void testClassOwlToJena() {
    JenaToOwlConvert j2o = new JenaToOwlConvert();
    OWLOntologyManager mgr = OWLManager.createOWLOntologyManager();
    OWLDataFactory factory = mgr.getOWLDataFactory();
    OWLClass c = factory.getOWLClass(IRI.create(CLAZZ));
    OntClass jc = null;
    try {
                    jc = j2o.ClassOwlToJena(c, RDFXML);
                    if(jc==null){
                        fail("Some problem accours");
                    }else{
                      assertEquals(jc.getURI(), c.getIRI().toString());
                    }
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.