Package com.hp.hpl.jena.ontology

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


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

    // add one instance relation
    OntClass cls = model.createClass( ns + "C" );
    Individual a = model.createIndividual( ns + "a", cls );

    // load everything and check consistency
    assertTrue( model.validate().isValid() );

    // add a type relation for an existing individual
View Full Code Here


    // check for direct types to make sure we don't get results from base
    // graph
    assertIteratorValues( cls.listInstances( true ), new Resource[] { a } );

    // add a new instance relation to a new individual
    Individual b = model.createIndividual( ns + "b", cls );

    // verify inference
    assertTrue( model.contains( b, RDF.type, cls ) );
    assertIteratorValues( cls.listInstances( false ), new Resource[] { a, b } );
    // check for direct types to make sure we don't get results from base
View Full Code Here

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

    ObjectProperty p = model.createObjectProperty( ns + "p" );
    ObjectProperty q = model.createObjectProperty( ns + "q" );
    Individual a = model.createIndividual( ns + "a", OWL.Thing );
    Individual b = model.createIndividual( ns + "b", OWL.Thing );

    // use a subproperty to make sure we get inferred results and not just
    // results from raw graph
    p.addSubProperty( q );
View Full Code Here

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

    ObjectProperty p = model.createObjectProperty( ns + "p" );
    ObjectProperty q = model.createObjectProperty( ns + "q" );
    Individual a = model.createIndividual( ns + "a", OWL.Thing );
    Individual b = model.createIndividual( ns + "b", OWL.Thing );

    // use a subproperty to make sure we get inferred results and not just
    // results from raw graph
    p.addSubProperty( q );
View Full Code Here

    inferences = ModelFactory.createDefaultModel();
    inferences.add( a, p, b );
    assertPropertyValues( model, p, inferences );

    // add a new property assertion using a new individual
    Individual c = model.createIndividual( ns + "c", OWL.Thing );
    model.add( a, q, c );

    // verify inference using super property
    inferences = ModelFactory.createDefaultModel();
    inferences.add( a, p, b );
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

                                       * functional
                                       * =
                                       */true );

    Individual s1 = ont.createIndividual( ns + "s1", OWL.Thing );
    Individual s2 = ont.createIndividual( ns + "s2", OWL.Thing );
    s1.addDifferentFrom( s2 );
    Individual o1 = ont.createIndividual( ns + "o1", OWL.Thing );
    Individual o2 = ont.createIndividual( ns + "o2", OWL.Thing );
    s1.addProperty( p, o1 );
    s2.addProperty( p, o2 );
View Full Code Here

                                       */true );

    Individual s1 = ont.createIndividual( ns + "s1", OWL.Thing );
    Individual s2 = ont.createIndividual( ns + "s2", OWL.Thing );
    s1.addDifferentFrom( s2 );
    Individual o1 = ont.createIndividual( ns + "o1", OWL.Thing );
    Individual o2 = ont.createIndividual( ns + "o2", OWL.Thing );
    s1.addProperty( p, o1 );
    s2.addProperty( p, o2 );

    Model values = ModelFactory.createDefaultModel();
View Full Code Here

    Individual s1 = ont.createIndividual( ns + "s1", OWL.Thing );
    Individual s2 = ont.createIndividual( ns + "s2", OWL.Thing );
    s1.addDifferentFrom( s2 );
    Individual o1 = ont.createIndividual( ns + "o1", OWL.Thing );
    Individual o2 = ont.createIndividual( ns + "o2", OWL.Thing );
    s1.addProperty( p, o1 );
    s2.addProperty( p, o2 );

    Model values = ModelFactory.createDefaultModel();
    addStatements( values, s1, OWL.differentFrom, s2 );
View Full Code Here

    OntModel ont = ModelFactory.createOntologyModel( PelletReasonerFactory.THE_SPEC, null );

    ObjectProperty p = ont.createObjectProperty( ns + "p", /* functional = */true );

    Individual s = ont.createIndividual( ns + "s", OWL.Thing );
    Individual o1 = ont.createIndividual( ns + "o1", OWL.Thing );
    Individual o2 = ont.createIndividual( ns + "o2", OWL.Thing );
    s.addProperty( p, o1 );
    s.addProperty( p, o2 );

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.