📄 testclassexpression.java
字号:
assertTrue( "intersection class test not correct", !a.isIntersectionClass() );
assertTrue( "union class test not correct", m_owlLiteLang || !a.isUnionClass() );
assertTrue( "complement class test not correct", m_owlLiteLang || !a.isComplementClass() );
assertTrue( "restriction test not correct", !a.isRestriction() );
OntClass b = m.createClass( NS + "B" );
OntClass c = m.createClass( NS + "C" );
a = a.convertToIntersectionClass( m.createList( new RDFNode[] {b,c} ) );
assertTrue( "enumerated class test not correct", m_owlLiteLang || !a.isEnumeratedClass() );
assertTrue( "intersection class test not correct", a.isIntersectionClass() );
assertTrue( "union class test not correct", m_owlLiteLang || !a.isUnionClass() );
assertTrue( "complement class test not correct", m_owlLiteLang || !a.isComplementClass() );
assertTrue( "restriction test not correct", !a.isRestriction() );
}
},
new OntTestCase( "OntClass.toUnionClass", true, false, true, false ) {
public void ontTest( OntModel m ) throws Exception {
OntClass a = m.createClass( NS + "A" );
assertTrue( "enumerated class test not correct", !a.isEnumeratedClass() );
assertTrue( "intersection class test not correct", !a.isIntersectionClass() );
assertTrue( "union class test not correct", !a.isUnionClass() );
assertTrue( "complement class test not correct", !a.isComplementClass() );
assertTrue( "restriction test not correct", !a.isRestriction() );
OntClass b = m.createClass( NS + "B" );
OntClass c = m.createClass( NS + "C" );
a = a.convertToUnionClass( m.createList( new RDFNode[] {b,c} ) );
assertTrue( "enumerated class test not correct", m_owlLiteLang || !a.isEnumeratedClass() );
assertTrue( "intersection class test not correct", !a.isIntersectionClass() );
assertTrue( "union class test not correct", m_owlLiteLang || a.isUnionClass() );
assertTrue( "complement class test not correct", m_owlLiteLang || !a.isComplementClass() );
assertTrue( "restriction test not correct", !a.isRestriction() );
}
},
new OntTestCase( "OntClass.toComplementClass", true, false, true, false ) {
public void ontTest( OntModel m ) throws Exception {
OntClass a = m.createClass( NS + "A" );
assertTrue( "enumerated class test not correct", !a.isEnumeratedClass() );
assertTrue( "intersection class test not correct", !a.isIntersectionClass() );
assertTrue( "union class test not correct", !a.isUnionClass() );
assertTrue( "complement class test not correct", !a.isComplementClass() );
assertTrue( "restriction test not correct", !a.isRestriction() );
OntClass b = m.createClass( NS + "B" );
a = a.convertToComplementClass( b );
assertTrue( "enumerated class test not correct", m_owlLiteLang || !a.isEnumeratedClass() );
assertTrue( "intersection class test not correct", !a.isIntersectionClass() );
assertTrue( "union class test not correct", m_owlLiteLang || !a.isUnionClass() );
assertTrue( "complement class test not correct", m_owlLiteLang || a.isComplementClass() );
assertTrue( "restriction test not correct", !a.isRestriction() );
}
},
new OntTestCase( "OntClass.toRestriction", true, true, true, false ) {
public void ontTest( OntModel m ) throws Exception {
OntClass a = m.createClass( NS + "A" );
assertTrue( "enumerated class test not correct", m_owlLiteLang || !a.isEnumeratedClass() );
assertTrue( "intersection class test not correct", !a.isIntersectionClass() );
assertTrue( "union class test not correct", m_owlLiteLang || !a.isUnionClass() );
assertTrue( "complement class test not correct", m_owlLiteLang || !a.isComplementClass() );
assertTrue( "restriction test not correct", !a.isRestriction() );
ObjectProperty p = m.createObjectProperty( NS + "p" );
a = a.convertToRestriction( p );
assertTrue( "enumerated class test not correct", m_owlLiteLang || !a.isEnumeratedClass() );
assertTrue( "intersection class test not correct", !a.isIntersectionClass() );
assertTrue( "union class test not correct", m_owlLiteLang || !a.isUnionClass() );
assertTrue( "complement class test not correct", m_owlLiteLang || !a.isComplementClass() );
assertTrue( "restriction test not correct", a.isRestriction() );
}
},
// restriction type testing
new OntTestCase( "Restriction.isAllValuesFrom", true, true, true, false ) {
public void ontTest( OntModel m ) throws Exception {
OntClass b = m.createClass( NS + "B" );
ObjectProperty p = m.createObjectProperty( NS + "p" );
Restriction a = m.createAllValuesFromRestriction( null, p, b );
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() );
}
},
new OntTestCase( "Restriction.isSomeValuesFrom", true, true, true, false ) {
public void ontTest( OntModel m ) throws Exception {
OntClass b = m.createClass( NS + "B" );
ObjectProperty p = m.createObjectProperty( NS + "p" );
Restriction a = m.createSomeValuesFromRestriction( null, p, b );
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() );
}
},
new OntTestCase( "Restriction.isHasValue", true, false, true, false ) {
public void ontTest( OntModel m ) throws Exception {
OntClass b = m.createClass( NS + "B" );
Individual x = m.createIndividual( b );
ObjectProperty p = m.createObjectProperty( NS + "p" );
Restriction a = m.createHasValueRestriction( null, p, x );
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() );
}
},
new OntTestCase( "Restriction.isCardinality", true, true, true, false ) {
public void ontTest( OntModel m ) throws Exception {
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() );
}
},
new OntTestCase( "Restriction.isMinCardinality", true, true, true, false ) {
public void ontTest( OntModel m ) throws Exception {
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() );
}
},
new OntTestCase( "Restriction.isMaxCardinality", true, true, true, false ) {
public void ontTest( OntModel m ) throws Exception {
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() );
}
},
// restriction conversions
new OntTestCase( "Restriction.convertToAllValuesFrom", true, true, true, false ) {
public void ontTest( OntModel m ) throws Exception {
ObjectProperty p = m.createObjectProperty( NS + "p" );
Restriction a = m.createRestriction( p );
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() );
OntClass b = m.createClass( NS + "B" );
a = a.convertToAllValuesFromRestriction( b );
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() );
}
},
new OntTestCase( "Restriction.convertToSomeValuesFrom", true, true, true, false ) {
public void ontTest( OntModel m ) throws Exception {
ObjectProperty p = m.createObjectProperty( NS + "p" );
Restriction a = m.createRestriction( p );
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() );
OntClass b = m.createClass( NS + "B" );
a = a.convertToSomeValuesFromRestriction( b );
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.isCardinalit
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -