@Override public OntResource doCreate( OntModel m ) { Property p = m.createObjectProperty( NS + "p" ); return m.createMinCardinalityRestriction( null, p, 1 ); } @Override
@Override public OntResource doCreate( OntModel m ) { Property p = m.createObjectProperty( NS + "p" ); return m.createCardinalityRestriction( null, p, 17 ); } @Override
@Override public OntResource doCreate( OntModel m ) { Property p = m.createObjectProperty( NS + "p" ); return m.createMaxCardinalityRestriction( null, p, 4 ); } @Override
private void addRelation( OntModel ontModel, OntClass domain, OntClass range, String property, String comment) { ObjectProperty objectProperty = ontModel.createObjectProperty(namespace + property); objectProperty.addComment(comment, EN); objectProperty.setDomain(domain); objectProperty.setRange(range); }
@Override public OntResource doCreate( OntModel m ) { Property p = m.createObjectProperty( NS + "p" ); return m.createMaxCardinalityRestriction( null, p, 4 ); } @Override
@Override public OntResource doCreate( OntModel m ) { Property p = m.createObjectProperty( NS + "p" ); OntClass c = m.createClass( NS + "C" ); return m.createAllValuesFromRestriction( null, p, c ); } @Override
@Override public OntResource doCreate( OntModel m ) { Property p = m.createObjectProperty( NS + "p" ); Resource x = m.createResource( NS + "x" ); return m.createHasValueRestriction( null, p, x ); } @Override
public void testSubPropertyDirectTransInf1a() { OntModel m = ModelFactory.createOntologyModel( ProfileRegistry.OWL_LITE_LANG ); OntProperty p = m.createObjectProperty( NS + "p" ); OntProperty q = m.createObjectProperty( NS + "q" ); OntProperty r = m.createObjectProperty( NS + "r" ); OntProperty s = m.createObjectProperty( NS + "s" ); p.addSubProperty( q ); p.addSubProperty( r ); r.addSubProperty( s ); iteratorTest( p.listSubProperties(), new Object[] {p,q,r,s} ); iteratorTest( p.listSubProperties( true ), new Object[] {q,r} ); }
@Override public OntResource doCreate( OntModel m ) { Property p = m.createObjectProperty( NS + "p" ); OntClass c = m.createClass( NS + "C" ); return m.createAllValuesFromRestriction( null, p, c ); } @Override
@Override public OntResource doCreate( OntModel m ) { Property p = m.createObjectProperty( NS + "p" ); OntClass c = m.createClass( NS + "C" ); return m.createSomeValuesFromRestriction( null, p, c ); } @Override
public void testSubPropertyDirectTransInf1a() { OntModel m = ModelFactory.createOntologyModel( ProfileRegistry.OWL_LITE_LANG ); OntProperty p = m.createObjectProperty( NS + "p" ); OntProperty q = m.createObjectProperty( NS + "q" ); OntProperty r = m.createObjectProperty( NS + "r" ); OntProperty s = m.createObjectProperty( NS + "s" ); p.addSubProperty( q ); p.addSubProperty( r ); r.addSubProperty( s ); iteratorTest( p.listSubProperties(), new Object[] {p,q,r,s} ); iteratorTest( p.listSubProperties( true ), new Object[] {q,r} ); }
public void testOwlLiteClasses() { OntModel model = ModelFactory.createOntologyModel( OntModelSpec.OWL_LITE_MEM_TRANS_INF ); OntClass b = model.createClass( NS + "B" ); OntProperty p0 = model.createOntProperty( NS + "p0" ); ObjectProperty p1 = model.createObjectProperty( NS + "p1" ); DatatypeProperty p2 = model.createDatatypeProperty( NS + "p2" ); Individual i0 = model.createIndividual( NS + "i0", b ); model.setStrictMode( true ); for (OntResource r: new OntResource[] {b,p0,p1,p2}) { assertFalse( r + " should not be an individual", r.canAs( Individual.class )); } }
public void testGetObjectProperty() { OntModel m = ModelFactory.createOntologyModel(); Resource r = m.getResource( NS + "r" ); m.add( r, RDF.type, r ); Resource s = m.createObjectProperty( NS + "s" ); assertEquals( "Result of get s", s, m.getObjectProperty( NS + "s" ) ); assertNull( "result of get q", m.getObjectProperty( NS+"q") ); assertNull( "result of get r", m.getObjectProperty( NS+"r")); }
@Override public void ontTest( OntModel m ) { Profile prof = m.getProfile(); OntProperty p = m.createObjectProperty( NS + "p" ); AllValuesFromRestriction A = m.createAllValuesFromRestriction( NS + "A", p, RDFS.Literal ); assertEquals( "Restriction should be all values from literal", RDFS.Literal, A.getAllValuesFrom() ); assertTrue( "Restriction should be all values from literal", A.hasAllValuesFrom( RDFS.Literal ) ); assertTrue( "Restriction should not be all values from decimal", !A.hasAllValuesFrom( XSD.decimal ) ); assertEquals( "cardinality should be 1 ", 1, A.getCardinality( prof.ALL_VALUES_FROM() )); } },
@Override public void ontTest( OntModel m ) { Profile prof = m.getProfile(); OntProperty p = m.createObjectProperty( NS + "p" ); SomeValuesFromRestriction A = m.createSomeValuesFromRestriction( NS + "A", p, RDFS.Literal ); assertEquals( "Restriction should be some values from literal", RDFS.Literal, A.getSomeValuesFrom() ); assertTrue( "Restriction should be some values from literal", A.hasSomeValuesFrom( RDFS.Literal ) ); assertTrue( "Restriction should not be some values from decimal", !A.hasSomeValuesFrom( XSD.decimal ) ); assertEquals( "cardinality should be 1 ", 1, A.getCardinality( prof.SOME_VALUES_FROM() )); } },
@Override public void ontTest( OntModel m ) { OntProperty p = m.createObjectProperty( NS + "p", true ); assertTrue( "isFunctionalProperty not correct", p.isFunctionalProperty() ); assertTrue( "isDatatypeProperty not correct", !p.isDatatypeProperty() ); assertTrue( "isObjectProperty not correct", p.isObjectProperty() ); assertTrue( "isTransitiveProperty not correct", !p.isTransitiveProperty() ); assertTrue( "isInverseFunctionalProperty not correct", !p.isInverseFunctionalProperty() ); if (m_owlLang) { assertTrue( "isSymmetricProperty not correct", !p.isSymmetricProperty() ); } } },
@Override public void ontTest( OntModel m ) { ObjectProperty p = m.createObjectProperty( NS + "p" ); Restriction a = m.createMaxCardinalityRestriction( null, p, 5 ); assertTrue( "all values from test not correct", !a.isAllValuesFromRestriction() ); assertTrue( "some values from test not correct", !a.isSomeValuesFromRestriction() ); assertTrue( "has value test not correct", m_owlLiteLang || !a.isHasValueRestriction() ); assertTrue( "cardinality test not correct", !a.isCardinalityRestriction() ); assertTrue( "min cardinality test not correct", !a.isMinCardinalityRestriction() ); assertTrue( "max cardinality test not correct", a.isMaxCardinalityRestriction() ); } },
@Override public void ontTest( OntModel m ) { ObjectProperty p = m.createObjectProperty( NS + "p" ); Restriction a = m.createMaxCardinalityRestriction( null, p, 5 ); assertTrue( "all values from test not correct", !a.isAllValuesFromRestriction() ); assertTrue( "some values from test not correct", !a.isSomeValuesFromRestriction() ); assertTrue( "has value test not correct", m_owlLiteLang || !a.isHasValueRestriction() ); assertTrue( "cardinality test not correct", !a.isCardinalityRestriction() ); assertTrue( "min cardinality test not correct", !a.isMinCardinalityRestriction() ); assertTrue( "max cardinality test not correct", a.isMaxCardinalityRestriction() ); } },
@Override public void ontTest( OntModel m ) { ObjectProperty p = m.createObjectProperty( NS + "p" ); Restriction a = m.createMinCardinalityRestriction( null, p, 1 ); assertTrue( "all values from test not correct", !a.isAllValuesFromRestriction() ); assertTrue( "some values from test not correct", !a.isSomeValuesFromRestriction() ); assertTrue( "has value test not correct", m_owlLiteLang || !a.isHasValueRestriction() ); assertTrue( "cardinality test not correct", !a.isCardinalityRestriction() ); assertTrue( "min cardinality test not correct", a.isMinCardinalityRestriction() ); assertTrue( "max cardinality test not correct", !a.isMaxCardinalityRestriction() ); } },
@Override public void ontTest( OntModel m ) { ObjectProperty p = m.createObjectProperty( NS + "p" ); Restriction a = m.createCardinalityRestriction( null, p, 3 ); assertTrue( "all values from test not correct", !a.isAllValuesFromRestriction() ); assertTrue( "some values from test not correct", !a.isSomeValuesFromRestriction() ); assertTrue( "has value test not correct", m_owlLiteLang || !a.isHasValueRestriction() ); assertTrue( "cardinality test not correct", a.isCardinalityRestriction() ); assertTrue( "min cardinality test not correct", !a.isMinCardinalityRestriction() ); assertTrue( "max cardinality test not correct", !a.isMaxCardinalityRestriction() ); } },