Package com.hp.hpl.jena.ontology

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


        ResourceFactory.createStatement( Bob, hasParent, Dad ),
        ResourceFactory.createStatement( Bob, hasFather, Dad ) } );

    assertIteratorValues( model.listObjectsOfProperty( Bob, hasFather ), new Resource[] { Dad } );

    assertIteratorValues( model.listObjectsOfProperty( Bob, hasMother ), new Resource[] { Mom } );
  }

  @Test
  public void testTeams() {
    String ns = "http://owl.man.ac.uk/2005/sssw/teams#";
View Full Code Here


    Bob.addProperty( hasBioFather, Dad );
    Bob.addRDFType( model.createCardinalityRestriction( null, hasFather, 1 ) );

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

    assertIteratorValues( model.listObjectsOfProperty( Bob, hasFather ), new Resource[] { Dad } );

    assertIteratorValues( model.listObjectsOfProperty( Bob, hasBioFather ),
        new Resource[] { Dad } );
  }
View Full Code Here

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

    assertIteratorValues( model.listObjectsOfProperty( Bob, hasFather ), new Resource[] { Dad } );

    assertIteratorValues( model.listObjectsOfProperty( Bob, hasBioFather ),
        new Resource[] { Dad } );
  }

  @Test
  public void testTransitive1() {
View Full Code Here

    Individual USDA = model.getIndividual( ns + "USDA" );

    assertTrue( "Forest_Service, comprises, Executive", model.contains( Forest_Service,
        comprises, Executive ) );

    assertIteratorValues( model.listObjectsOfProperty( Forest_Service, comprises ),
        new Resource[] { USDA, Executive } );

    assertIteratorValues( model.listSubjectsWithProperty( comprises, Executive ),
        new Resource[] {
            model.getIndividual( ns + "USDA" ),
View Full Code Here

    assertTrue( !model.contains( a, knows, g ) );

    assertTrue( !model.contains( a, hasRelative, g ) );

    // checking get functions
    assertIteratorValues( model.listObjectsOfProperty( a, hasRelative ), new Resource[] {
        b, c, f } );

    assertIteratorValues( model.listObjectsOfProperty( a, knows ),
        new Resource[] { b, c, d, f } );
View Full Code Here

    // checking get functions
    assertIteratorValues( model.listObjectsOfProperty( a, hasRelative ), new Resource[] {
        b, c, f } );

    assertIteratorValues( model.listObjectsOfProperty( a, knows ),
        new Resource[] { b, c, d, f } );

    assertIteratorValues( model.listObjectsOfProperty( b, knows ), new Resource[] { c, e, f } );

    assertIteratorValues( model.listSubjectsWithProperty( knows, e ), new Resource[] { b, d } );
View Full Code Here

        b, c, f } );

    assertIteratorValues( model.listObjectsOfProperty( a, knows ),
        new Resource[] { b, c, d, f } );

    assertIteratorValues( model.listObjectsOfProperty( b, knows ), new Resource[] { c, e, f } );

    assertIteratorValues( model.listSubjectsWithProperty( knows, e ), new Resource[] { b, d } );

    assertIteratorValues( model.listSubjectsWithProperty( hasRelative, f ), new Resource[] {
        a, b, c } );
View Full Code Here

    JohnDoe.addProperty( livesIn, USA );
    JohnDoe.addProperty( livesIn, UnitedStates );

    assertTrue( model.contains( JohnDoe, RDF.type, Person ) );
    assertTrue( model.contains( USA, OWL.sameAs, UnitedStates ) );
    assertIteratorValues( model.listObjectsOfProperty( JohnDoe, livesIn ), new Resource[] {
        USA, UnitedStates } );
  }

  @Test
  public void testESG() {
View Full Code Here

    Property sibling = ontModel.createProperty( "family:sibling" );
    Resource bob = ontModel.createResource( "family:bob" );
    assertTrue( ontModel.contains( alice, sibling, bob ) );
    assertTrue( ontModel.contains( bob, sibling, alice ) );

    assertEquals( Collections.singletonList(bob), ontModel.listObjectsOfProperty( alice, sibling ).toList() );
    assertEquals( Collections.singletonList(alice), ontModel.listObjectsOfProperty( bob, sibling ).toList() );
  }
}
View Full Code Here

    Resource bob = ontModel.createResource( "family:bob" );
    assertTrue( ontModel.contains( alice, sibling, bob ) );
    assertTrue( ontModel.contains( bob, sibling, alice ) );

    assertEquals( Collections.singletonList(bob), ontModel.listObjectsOfProperty( alice, sibling ).toList() );
    assertEquals( Collections.singletonList(alice), ontModel.listObjectsOfProperty( bob, sibling ).toList() );
  }
}
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.