Package com.hp.hpl.jena.ontology

Examples of com.hp.hpl.jena.ontology.DatatypeProperty


        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());
View Full Code Here


                                logger.warn("Failed to create ObjectProperty for property definition {}",
                                    propDef.getLocalname());
                            }

                        } else {
                            DatatypeProperty dtp = ontologyResourceHelper
                                    .createDatatypePropertyByPropertyDefinition(propDef,
                                        Arrays.asList(new Resource[] {nodeTypeClass}));

                            if (dtp == null) {
                                logger.warn("Failed to create DatatypeProperty for property definition {}",
View Full Code Here

    return false;
  }
 
  public boolean isDataProperty(String uri) {

    DatatypeProperty dp = ontModel.getDatatypeProperty(uri);
    if (dp != null)
      return true;
   
    return false;
  }
View Full Code Here

    OntModel autoOntology = ModelFactory.createOntologyModel( OntModelSpec.OWL_MEM );
    String ns = Namespaces.KARMA;
    autoOntology.setNsPrefix("karma", ns);
    OntClass topClass = autoOntology.createClass( ns + worksheet.getTitle().replaceAll(" ", "_")); // replace blank spaces with undrscore
    for (HNode hNode : sortedLeafHNodes){
      DatatypeProperty dp = autoOntology.createDatatypeProperty(ns+hNode.getColumnName().trim().replaceAll(" ", "_"));
      dp.addDomain(topClass);
      dp.addRange(XSD.xstring);
    }
   
//    OntClass thingClass = autoOntology.createClass(Uris.THING_URI);
    ObjectProperty op = autoOntology.createObjectProperty(ns + "relatedTo");
    op.addDomain(topClass);
View Full Code Here

          offer(nextToken, cls.getLocalName(), tree
              .getActualWeight(Weights.OBJECTPROPERTY_RANGE));
        }

      } else if (type.equals(OntologyElementTree.DATATYPEPROPERTY)) {
        DatatypeProperty dp = this.tree.getOntModel()
            .getDatatypeProperty(uri);
        for (OntClass cls : JenaUtil.getCompatibleDeclaredDomains(dp)) {
          offer(nextToken, cls.getLocalName(), tree
              .getActualWeight(Weights.OBJECTPROPERTY_DOMAIN));
        }
View Full Code Here

   
    private void doTestDatatypeRangeValidation(RDFDatatype over12Type, OntModelSpec spec) {
        String NS = "http://jena.hpl.hp.com/example#";
        OntModel ont = ModelFactory.createOntologyModel(spec);
        Resource over12 = ont.createResource( over12Type.getURI() );
        DatatypeProperty hasValue = ont.createDatatypeProperty(NS + "hasValue");
        hasValue.addRange( over12 );
       
        ont.createResource(NS + "a").addProperty(hasValue, "15", over12Type);
        ont.createResource(NS + "b").addProperty(hasValue, "16", XSDDatatype.XSDinteger);
        ont.createResource(NS + "c").addProperty(hasValue, "10", XSDDatatype.XSDinteger);
       
        ValidityReport validity = ont.validate();
        assertTrue (! validity.isValid());
       
        // Check culprit reporting
        ValidityReport.Report report = (validity.getReports().next());
        Triple culprit = (Triple)report.getExtension();
        assertEquals(culprit.getSubject().getURI(), NS + "c");
        assertEquals(culprit.getPredicate(), hasValue.asNode());
    }
View Full Code Here

   
    private void doTestDatatypeRangeValidation(RDFDatatype over12Type, OntModelSpec spec) {
        String NS = "http://jena.hpl.hp.com/example#";
        OntModel ont = ModelFactory.createOntologyModel(spec);
        Resource over12 = ont.createResource( over12Type.getURI() );
        DatatypeProperty hasValue = ont.createDatatypeProperty(NS + "hasValue");
        hasValue.addRange( over12 );
       
        ont.createResource(NS + "a").addProperty(hasValue, "15", over12Type);
        ont.createResource(NS + "b").addProperty(hasValue, "16", XSDDatatype.XSDinteger);
        ont.createResource(NS + "c").addProperty(hasValue, "10", XSDDatatype.XSDinteger);
       
        ValidityReport validity = ont.validate();
        assertTrue (! validity.isValid());
       
        // Check culprit reporting
        ValidityReport.Report report = (validity.getReports().next());
        Triple culprit = (Triple)report.getExtension();
        assertEquals(culprit.getSubject().getURI(), NS + "c");
        assertEquals(culprit.getPredicate(), hasValue.asNode());
    }
View Full Code Here

  public void testIncrementalABoxAddition() throws MalformedURLException {
    OntModel model = ModelFactory.createOntologyModel( PelletReasonerFactory.THE_SPEC, null );

    ObjectProperty p = model.createObjectProperty( "p" );
    ObjectProperty t = model.createObjectProperty( "t" );
    DatatypeProperty q = model.createDatatypeProperty( "q" );
    AnnotationProperty r = model.createAnnotationProperty( "r" );

    Individual a = model.createIndividual( "a", OWL.Thing );
    Individual b = model.createIndividual( "b", OWL.Thing );
View Full Code Here

    Individual ind5 = model.getIndividual( ns + "ind5" );
    Individual ind6 = model.getIndividual( ns + "ind6" );
    Individual ind7 = model.getIndividual( ns + "ind7" );
    Individual ind8 = model.getIndividual( ns + "ind8" );

    DatatypeProperty dp = model.getDatatypeProperty( ns + "dp" );
    ObjectProperty p = model.getObjectProperty( ns + "p" );
    ObjectProperty r = model.getObjectProperty( ns + "r" );
    ObjectProperty invR = model.getObjectProperty( ns + "invR" );
    ObjectProperty ir = model.getObjectProperty( ns + "ir" );
    ObjectProperty as = model.getObjectProperty( ns + "as" );
View Full Code Here

    OntModel model = ModelFactory.createOntologyModel( PelletReasonerFactory.THE_SPEC );

    OntClass C1 = model.createClass( ns + "C1" );
    OntClass C2 = model.createClass( ns + "C2" );

    DatatypeProperty p = model.createDatatypeProperty( ns + "p" );
    p.addRange( XSD.xboolean );

    C1.addSuperClass( model.createMinCardinalityRestriction( null, p, 2 ) );
    C2.addSuperClass( model.createMinCardinalityRestriction( null, p, 3 ) );

    model.prepare();
View Full Code Here

TOP

Related Classes of com.hp.hpl.jena.ontology.DatatypeProperty

Copyright © 2018 www.massapicom. 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.