Package com.hp.hpl.jena.ontology

Examples of com.hp.hpl.jena.ontology.OntModel.createIndividual()


    String ns = "urn:test:";

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

    OntClass Country = model.createClass( ns + "Country" );
    Individual USA = model.createIndividual( ns + "USA", Country );
    Individual UnitedStates = model.createIndividual( ns + "UnitedStates", Country );

    OntProperty livesIn = model.createObjectProperty( ns + "livesIn" );
    livesIn.convertToFunctionalProperty();
View Full Code Here


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

    OntClass Country = model.createClass( ns + "Country" );
    Individual USA = model.createIndividual( ns + "USA", Country );
    Individual UnitedStates = model.createIndividual( ns + "UnitedStates", Country );

    OntProperty livesIn = model.createObjectProperty( ns + "livesIn" );
    livesIn.convertToFunctionalProperty();

    OntClass Person = model.createClass( ns + "Person" );
View Full Code Here

    OntProperty livesIn = model.createObjectProperty( ns + "livesIn" );
    livesIn.convertToFunctionalProperty();

    OntClass Person = model.createClass( ns + "Person" );
    Individual JohnDoe = model.createIndividual( ns + "JohnDoe", Person );
    JohnDoe.addProperty( livesIn, USA );
    JohnDoe.addProperty( livesIn, UnitedStates );

    assertTrue( model.contains( JohnDoe, RDF.type, Person ) );
    assertTrue( model.contains( USA, OWL.sameAs, UnitedStates ) );
View Full Code Here

        XSD.integer, "77", XSD.xlong, "214", XSD.negativeInteger, "-123",
        XSD.nonNegativeInteger, "2", XSD.nonPositiveInteger, "0", XSD.positiveInteger,
        "500", XSD.xshort, "476", XSD.xstring, "Test", XSD.time, "13:02:00", };

    OntModel model = ModelFactory.createOntologyModel( PelletReasonerFactory.THE_SPEC );
    Individual ind = model.createIndividual( ns + "test", OWL.Thing );
    for( int i = 0; i < datatypes.length; ) {
      Resource datatype = (Resource) datatypes[i++];
      OntProperty p = model.createDatatypeProperty( ns + "prop_" + datatype.getLocalName() );
      p.addRange( datatype );
View Full Code Here

        Resource datatype = (Resource) datatypes[i++];

        while( i < datatypes.length && datatypes[i] instanceof String ) {
          OntModel model = ModelFactory
              .createOntologyModel( PelletReasonerFactory.THE_SPEC );
          Individual ind = model.createIndividual( ns + "test", OWL.Thing );

          OntProperty p = model.createDatatypeProperty( ns + "prop_"
              + datatype.getLocalName() );
          if( addRangeRestriction ) {
                      p.addRange( datatype );
View Full Code Here

      OntClass C = model.createClass( ns + "C" );
      int cardinality = datatype.equals( XSD.xboolean )
        ? 2
        : 10;
      C.addSuperClass( model.createCardinalityRestriction( null, prop, cardinality ) );
      model.createIndividual( ns + "x", C );

      model.prepare();

      assertTrue( ((PelletInfGraph) model.getGraph()).isConsistent() );
    }
View Full Code Here

      OntProperty p = model.createDatatypeProperty( ns + "prop" );
      p.addRange( datatype );

      int start = i;
      while( i < datatypes.length && datatypes[i] instanceof String ) {
        Individual ind = model.createIndividual( ns + "testInd" + i, OWL.Thing );
        Literal value = model.createTypedLiteral( (String) datatypes[i], datatype.getURI() );
        ind.addProperty( p, value );

        OntClass c = model.createClass( ns + "testCls" + i );
        c.addEquivalentClass( model.createHasValueRestriction( null, p, value ) );
View Full Code Here

    OntClass C1 = model.createClass( ns + "C1" );
    OntClass C2 = model.createClass( ns + "C2" );
   
    C1.addSubClass( C2 );
   
    Individual ind = model.createIndividual( ns + "ind", C2 );
     
    assertFalse( model.contains( ind, ReasonerVocabulary.directRDFType, C1 ) );
    assertTrue( model.contains( ind, ReasonerVocabulary.directRDFType, C2 ) );
   
    assertTrue( model.contains( C1, ReasonerVocabulary.directSubClassOf, OWL.Thing ) );
View Full Code Here

    long e = System.currentTimeMillis();
    System.out.println( "Consistent? " + consistent + " (" + (e - s) + "ms)" );

    // perform ABox addition which results in a consistent KB
    Resource concept = model.getResource( mindswap + "GraduateStudent" );
    Individual individual = model.createIndividual( mindswappers + "JohnDoe", concept );

    // perform incremental consistency check
    s = System.currentTimeMillis();
    consistent = pelletJenaGraph.isConsistent();
    e = System.currentTimeMillis();
View Full Code Here

    System.out.println( "Total time " + (e - s) + " ms)" );
    JenaReasoner.printIterator( model.validate().getReports(), "Validation Results" );

    // perform ABox addition which results in a consistent KB
    Resource concept = model.getResource( mindswap + "GraduateStudent" );
    Individual individual = model.createIndividual( mindswappers + "JohnDoe", concept );

    // perform incremental consistency check
    s = System.currentTimeMillis();
    model.prepare();
    e = System.currentTimeMillis();
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.