Package com.hp.hpl.jena.ontology

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


    Individual bob = model.createIndividual( ns + "bob", HomeOwner );
    ObjectProperty hasNeighbor = model.createObjectProperty( ns + "hasNeighbor" );
    OntClass NeighborOfBob = model.createClass( ns + "NeighborOfBob" );
    NeighborOfBob
        .addEquivalentClass( model.createHasValueRestriction( null, hasNeighbor, bob ) );
    Individual susan = model.createIndividual( ns + "susan", HomeOwner );
    susan.setPropertyValue( hasNeighbor, bob );
    // model.write(System.out, "RDF/XML-ABBREV");

    assertTrue( "susan is not a NeighborOfBob", susan.hasRDFType( NeighborOfBob ) );
  }
View Full Code Here


    OntProperty hasFather = model.createObjectProperty( ns + "hasFather" );
    OntProperty hasBioFather = model.createObjectProperty( ns + "hasBioFather", true );
    hasBioFather.addSuperProperty( hasFather );
    Person.addSuperClass( model.createMinCardinalityRestriction( null, hasBioFather, 1 ) );

    Individual Bob = model.createIndividual( ns + "Bob", Person );
    Individual Dad = model.createIndividual( ns + "Dad", Person );
    Bob.addProperty( hasBioFather, Dad );
    Bob.addRDFType( model.createCardinalityRestriction( null, hasFather, 1 ) );

    model = ModelFactory.createOntologyModel( PelletReasonerFactory.THE_SPEC, model );
View Full Code Here

    OntProperty hasBioFather = model.createObjectProperty( ns + "hasBioFather", true );
    hasBioFather.addSuperProperty( hasFather );
    Person.addSuperClass( model.createMinCardinalityRestriction( null, hasBioFather, 1 ) );

    Individual Bob = model.createIndividual( ns + "Bob", Person );
    Individual Dad = model.createIndividual( ns + "Dad", Person );
    Bob.addProperty( hasBioFather, Dad );
    Bob.addRDFType( model.createCardinalityRestriction( null, hasFather, 1 ) );

    model = ModelFactory.createOntologyModel( PelletReasonerFactory.THE_SPEC, model );
View Full Code Here

    DatatypeProperty dp = model.createDatatypeProperty( ns + "dp" );

    ObjectProperty op = model.createObjectProperty( ns + "op" );

    OntClass C = model.createClass( ns + "C" );
    Individual a = model.createIndividual( ns + "a", C );
    Individual b = model.createIndividual( ns + "b", C );

    Literal one = model.createTypedLiteral( "1", TypeMapper.getInstance().getTypeByName(
        XSD.positiveInteger.getURI() ) );
    a.addProperty( dp, one );
View Full Code Here

    ObjectProperty op = model.createObjectProperty( ns + "op" );

    OntClass C = model.createClass( ns + "C" );
    Individual a = model.createIndividual( ns + "a", C );
    Individual b = model.createIndividual( ns + "b", C );

    Literal one = model.createTypedLiteral( "1", TypeMapper.getInstance().getTypeByName(
        XSD.positiveInteger.getURI() ) );
    a.addProperty( dp, one );
View Full Code Here

    DatatypeProperty dp = model.createDatatypeProperty( ns + "dp" );

    ObjectProperty op = model.createObjectProperty( ns + "op" );

    OntClass C = model.createClass( ns + "C" );
    Individual anon1 = model.createIndividual( C );
    Individual a = model.createIndividual( ns + "a", C );

    Literal one = model.createTypedLiteral( "1", TypeMapper.getInstance().getTypeByName(
        XSD.positiveInteger.getURI() ) );
    a.addProperty( dp, one );
View Full Code Here

    ObjectProperty op = model.createObjectProperty( ns + "op" );

    OntClass C = model.createClass( ns + "C" );
    Individual anon1 = model.createIndividual( C );
    Individual a = model.createIndividual( ns + "a", C );

    Literal one = model.createTypedLiteral( "1", TypeMapper.getInstance().getTypeByName(
        XSD.positiveInteger.getURI() ) );
    a.addProperty( dp, one );
View Full Code Here

    assertIteratorValues( a.listPropertyValues( op ), new Resource[] { anon1 } );
    // check that the update occurred and that the incremental consistency
    // was used
    assertTrue( !PelletOptions.USE_INCREMENTAL_CONSISTENCY || graph.getKB().timers.getTimer( "isIncConsistent" ).getCount() > 0 );

    Individual anon2 = model.createIndividual( C );
    anon2.addProperty( op, a );

    // check consistency
    model.prepare();
View Full Code Here

    OntClass class1 = ontmodel.createClass( nc + "C1" );
    OntClass class2 = ontmodel.createClass( nc + "C2" );

    Individual[] inds = new Individual[6];
    for( int j = 0; j < 6; j++ ) {
      inds[j] = ontmodel.createIndividual( nc + "Ind" + j, OWL.Thing );
    }

    inds[0].addRDFType( class1 );
    inds[1].addRDFType( class1 );
    inds[2].addRDFType( class1 );
View Full Code Here

    assertIteratorValues( class4.listInstances(), new Resource[] {
        inds[0], inds[1], inds[2], inds[3], inds[4], inds[5] } );

    assertEquals( 0, graph.getKB().timers.getTimer( "isIncConsistent" ).getCount() );

    Individual newind = ontmodel.createIndividual( nc + "Ind7", class4 );

    ontmodel.prepare();

    assertIteratorValues( class4.listInstances(), new Resource[] {
        inds[0], inds[1], inds[2], inds[3], inds[4], inds[5], newind } );
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.