OntModel model = ModelFactory.createOntologyModel( PelletReasonerFactory.THE_SPEC );
model.read( base + "teams.owl" );
Individual t1 = model.getIndividual( ns + "OntologyFC" );
OntClass Male = model.getOntClass( ns + "Male" );
OntClass Female = model.getOntClass( ns + "Female" );
Individual Sam = model.getIndividual( ns + "Sam" );
Individual Chris = model.getIndividual( ns + "Chris" );
OntClass Team = model.getOntClass( ns + "Team" );
OntClass MixedTeam = model.getOntClass( ns + "MixedTeam" );
OntClass NonSingletonTeam = model.getOntClass( ns + "NonSingletonTeam" );
OntClass SingletonTeam = model.getOntClass( ns + "SingletonTeam" );
model.prepare();
assertTrue( Sam.isDifferentFrom( Chris ) );
assertTrue( Chris.isDifferentFrom( Sam ) );
assertTrue( MixedTeam.hasSuperClass( Team ) );
assertFalse( MixedTeam.hasSuperClass( SingletonTeam ) );
assertIteratorValues( MixedTeam.listSuperClasses(), new Resource[] {
Team, NonSingletonTeam, OWL.Thing } );
assertIteratorValues( MixedTeam.listSuperClasses( true ),
new Resource[] { NonSingletonTeam } );
assertTrue( NonSingletonTeam.hasSubClass( MixedTeam ) );
assertIteratorValues( NonSingletonTeam.listSubClasses(), new Resource[] {
MixedTeam, OWL.Nothing } );
assertIteratorValues( NonSingletonTeam.listSubClasses( true ), new Resource[] { MixedTeam } );
assertTrue( t1.hasRDFType( MixedTeam ) );
assertTrue( t1.hasRDFType( MixedTeam, true ) );
assertIteratorValues( t1.listRDFTypes( false ), new Resource[] {
Team, NonSingletonTeam, MixedTeam, OWL.Thing } );
assertIteratorValues( t1.listRDFTypes( true ), new Resource[] { MixedTeam } );
Male.removeDisjointWith( Female );
Female.removeDisjointWith( Male );
Sam.removeDifferentFrom( Chris );
Chris.removeDifferentFrom( Sam );
assertTrue( !Sam.isDifferentFrom( Chris ) );
assertTrue( !Chris.isDifferentFrom( Sam ) );
assertTrue( MixedTeam.hasSuperClass( Team ) );
assertIteratorValues( MixedTeam.listSuperClasses(), new Resource[] { Team, OWL.Thing } );
assertTrue( !NonSingletonTeam.hasSuperClass( MixedTeam ) );