- All Implemented Interfaces:
FrontsNode,OntClass,OntResource,Restriction,RDFNode,Resource
- Direct Known Subclasses:
AllValuesFromRestrictionImpl,CardinalityRestrictionImpl,HasValueRestrictionImpl,MaxCardinalityRestrictionImpl,MinCardinalityRestrictionImpl,QualifiedRestrictionImpl,SomeValuesFromRestrictionImpl
Implementation of the ontology abstraction representing restrictions.
-
Field Summary
FieldsModifier and TypeFieldDescriptionstatic ImplementationA factory for generating Restriction facets from nodes in enhanced graphs.Fields inherited from class org.apache.jena.ontology.impl.OntResourceImpl
KNOWN_LANGUAGESFields inherited from class org.apache.jena.rdf.model.impl.ResourceImpl
rdfNodeFactory -
Constructor Summary
ConstructorsConstructorDescriptionRestrictionImpl(Node n, EnhGraph g) Construct a restriction node represented by the given node in the given graph. -
Method Summary
Modifier and TypeMethodDescriptionAnswer a view of this restriction as an all values from expressionAnswer a view of this restriction as a cardinality restriction class expressionAnswer a view of this restriction as a has value expressionAnswer a view of this restriction as a max cardinality restriction class expressionAnswer a view of this restriction as a min cardinality restriction class expressionAnswer a view of this restriction as a some values from expressionConvert this restriction to an all values from class expression.convertToCardinalityRestriction(int cardinality) Convert this restriction to a cardinality restriction class expressionConvert this restriction to a has value class expressionconvertToMaxCardinalityRestriction(int cardinality) Convert this restriction to a max cardinality restriction class expressionconvertToMinCardinalityRestriction(int cardinality) Convert this restriction to a min cardinality restriction class expressionConvert this restriction to a some values from class expressionAnswer the property that this property restriction applies to.booleanAnswer true if this restriction is an all values from restrictionbooleanAnswer true if this restriction is a cardinality restriction (ie is a property restriction constructed with anowl:cardinalityoperator, or similar).booleanAnswer true if this restriction is a has value restrictionbooleanAnswer true if this restriction is a max cardinality restriction (ie is a property restriction constructed with anowl:maxCardinalityoperator, or similar).booleanAnswer true if this restriction is a min cardinality restriction (ie is a property restriction constructed with anowl:minCardinalityoperator, or similar).booleanAnswer true if this restriction is a some values from restrictionbooleanonProperty(Property prop) Answer true if this restriction is a property restriction on the given property.voidremoveOnProperty(Property prop) Remove the given property as the property that this restriction applies to.voidsetOnProperty(Property prop) Assert that the property that this restriction applies to is the given property.Methods inherited from class org.apache.jena.ontology.impl.OntClassImpl
addDisjointWith, addEquivalentClass, addSubClass, addSuperClass, asComplementClass, asEnumeratedClass, asIntersectionClass, asRestriction, asUnionClass, convertToComplementClass, convertToEnumeratedClass, convertToIntersectionClass, convertToRestriction, convertToUnionClass, createIndividual, createIndividual, dropIndividual, getDisjointWith, getEquivalentClass, getSubClass, getSuperClass, hasDeclaredProperty, hasEquivalentClass, hasSubClass, hasSubClass, hasSubClass, hasSuperClass, hasSuperClass, hasSuperClass, isComplementClass, isDisjointWith, isEnumeratedClass, isHierarchyRoot, isIntersectionClass, isRestriction, isUnionClass, listDeclaredProperties, listDeclaredProperties, listDisjointWith, listEquivalentClasses, listInstances, listInstances, listSubClasses, listSubClasses, listSuperClasses, listSuperClasses, removeDisjointWith, removeEquivalentClass, removeSubClass, removeSuperClass, setDisjointWith, setEquivalentClass, setSubClass, setSuperClassMethods inherited from class org.apache.jena.ontology.impl.OntResourceImpl
addComment, addComment, addDifferentFrom, addIsDefinedBy, addLabel, addLabel, addRDFType, addSameAs, addSeeAlso, addVersionInfo, asAllDifferent, asAnnotationProperty, asClass, asDataRange, asDatatypeProperty, asIndividual, asObjectProperty, asOntology, asProperty, getCardinality, getComment, getDifferentFrom, getIsDefinedBy, getLabel, getOntModel, getProfile, getPropertyValue, getRDFType, getRDFType, getSameAs, getSeeAlso, getVersionInfo, hasComment, hasComment, hasLabel, hasLabel, hasRDFType, hasRDFType, hasRDFType, hasSeeAlso, hasVersionInfo, isAllDifferent, isAnnotationProperty, isClass, isDataRange, isDatatypeProperty, isDefinedBy, isDifferentFrom, isIndividual, isObjectProperty, isOntLanguageTerm, isOntology, isProperty, isSameAs, listComments, listDifferentFrom, listIsDefinedBy, listLabels, listPropertyValues, listRDFTypes, listSameAs, listSeeAlso, listVersionInfo, remove, removeComment, removeComment, removeDefinedBy, removeDifferentFrom, removeLabel, removeLabel, removeProperty, removeRDFType, removeSameAs, removeSeeAlso, removeVersionInfo, setComment, setDifferentFrom, setIsDefinedBy, setLabel, setPropertyValue, setRDFType, setSameAs, setSeeAlso, setVersionInfoMethods inherited from class org.apache.jena.rdf.model.impl.ResourceImpl
abort, addLiteral, addLiteral, addLiteral, addLiteral, addLiteral, addLiteral, addLiteral, addProperty, addProperty, addProperty, addProperty, addProperty, addProperty, addProperty, asLiteral, asResource, asStatementTerm, begin, commit, getId, getLocalName, getModel, getNameSpace, getProperty, getProperty, getPropertyResourceValue, getRequiredProperty, getRequiredProperty, getURI, hasLiteral, hasLiteral, hasLiteral, hasLiteral, hasLiteral, hasLiteral, hasProperty, hasProperty, hasProperty, hasProperty, hasURI, inModel, listProperties, listProperties, listProperties, removeAll, removeProperties, toString, visitWithMethods inherited from class org.apache.jena.enhanced.EnhNode
as, asNode, canAs, equals, getGraph, hashCode, isAnon, isLiteral, isResource, isStatementTerm, isURIResource, isValid, viewAsMethods inherited from class org.apache.jena.enhanced.Polymorphic
addView, supportsMethods inherited from interface org.apache.jena.graph.FrontsNode
asNodeMethods inherited from interface org.apache.jena.ontology.OntClass
addDisjointWith, addEquivalentClass, addSubClass, addSuperClass, asComplementClass, asEnumeratedClass, asIntersectionClass, asRestriction, asUnionClass, convertToComplementClass, convertToEnumeratedClass, convertToIntersectionClass, convertToRestriction, convertToUnionClass, createIndividual, createIndividual, dropIndividual, getDisjointWith, getEquivalentClass, getSubClass, getSuperClass, hasDeclaredProperty, hasEquivalentClass, hasSubClass, hasSubClass, hasSubClass, hasSuperClass, hasSuperClass, hasSuperClass, isComplementClass, isDisjointWith, isEnumeratedClass, isHierarchyRoot, isIntersectionClass, isRestriction, isUnionClass, listDeclaredProperties, listDeclaredProperties, listDisjointWith, listEquivalentClasses, listInstances, listInstances, listSubClasses, listSubClasses, listSuperClasses, listSuperClasses, removeDisjointWith, removeEquivalentClass, removeSubClass, removeSuperClass, setDisjointWith, setEquivalentClass, setSubClass, setSuperClassMethods inherited from interface org.apache.jena.ontology.OntResource
addComment, addComment, addDifferentFrom, addIsDefinedBy, addLabel, addLabel, addRDFType, addSameAs, addSeeAlso, addVersionInfo, asAllDifferent, asAnnotationProperty, asClass, asDataRange, asDatatypeProperty, asIndividual, asObjectProperty, asOntology, asProperty, getCardinality, getComment, getDifferentFrom, getIsDefinedBy, getLabel, getOntModel, getProfile, getPropertyValue, getRDFType, getRDFType, getSameAs, getSeeAlso, getVersionInfo, hasComment, hasComment, hasLabel, hasLabel, hasRDFType, hasRDFType, hasRDFType, hasSeeAlso, hasVersionInfo, isAllDifferent, isAnnotationProperty, isClass, isDataRange, isDatatypeProperty, isDefinedBy, isDifferentFrom, isIndividual, isObjectProperty, isOntLanguageTerm, isOntology, isProperty, isSameAs, listComments, listDifferentFrom, listIsDefinedBy, listLabels, listPropertyValues, listRDFTypes, listSameAs, listSeeAlso, listVersionInfo, remove, removeComment, removeComment, removeDefinedBy, removeDifferentFrom, removeLabel, removeLabel, removeProperty, removeRDFType, removeSameAs, removeSeeAlso, removeVersionInfo, setComment, setDifferentFrom, setIsDefinedBy, setLabel, setPropertyValue, setRDFType, setSameAs, setSeeAlso, setVersionInfoMethods inherited from interface org.apache.jena.rdf.model.RDFNode
as, asLiteral, asResource, asStatementTerm, canAs, getModel, isAnon, isLiteral, isResource, isStatementTerm, isURIResource, visitWithMethods inherited from interface org.apache.jena.rdf.model.Resource
abort, addLiteral, addLiteral, addLiteral, addLiteral, addLiteral, addLiteral, addLiteral, addProperty, addProperty, addProperty, addProperty, begin, commit, equals, getId, getLocalName, getNameSpace, getProperty, getProperty, getPropertyResourceValue, getRequiredProperty, getRequiredProperty, getURI, hasLiteral, hasLiteral, hasLiteral, hasLiteral, hasLiteral, hasLiteral, hasProperty, hasProperty, hasProperty, hasProperty, hasURI, inModel, listProperties, listProperties, listProperties, removeAll, removeProperties, toString
-
Field Details
-
factory
A factory for generating Restriction facets from nodes in enhanced graphs. Note: should not be invoked directly by user code: useas()instead.
-
-
Constructor Details
-
RestrictionImpl
Construct a restriction node represented by the given node in the given graph.
- Parameters:
n- The node that represents the resourceg- The enh graph that contains n
-
-
Method Details
-
setOnProperty
Assert that the property that this restriction applies to is the given property. Any existing statements for
onPropertywill be removed.- Specified by:
setOnPropertyin interfaceRestriction- Parameters:
prop- The property that this restriction applies to- Throws:
ProfileException- If theProfile.ON_PROPERTY()property is not supported in the current language profile.
-
getOnProperty
Answer the property that this property restriction applies to. If there is more than one such resource, an arbitrary selection is made (though well-defined property restrictions should not have more than one
onPropertystatement.- Specified by:
getOnPropertyin interfaceRestriction- Returns:
- The property that this property restriction applies to
- Throws:
ProfileException- If theProfile.ON_PROPERTY()property is not supported in the current language profile.
-
onProperty
Answer true if this restriction is a property restriction on the given property.
- Specified by:
onPropertyin interfaceRestriction- Parameters:
prop- A property to test against- Returns:
- True if this restriction is a restriction on
prop - Throws:
ProfileException- If theProfile.ON_PROPERTY()property is not supported in the current language profile.
-
removeOnProperty
Remove the given property as the property that this restriction applies to. If this statement is not true of the current model, nothing happens.
- Specified by:
removeOnPropertyin interfaceRestriction- Parameters:
prop- The property to be removed as a the property that this restriction applies to
-
asAllValuesFromRestriction
Answer a view of this restriction as an all values from expression
- Specified by:
asAllValuesFromRestrictionin interfaceRestriction- Returns:
- This class, but viewed as an AllValuesFromRestriction node
- Throws:
ConversionException- if the class cannot be converted to an all values from restriction given the lanuage profile and the current state of the underlying model.
-
asSomeValuesFromRestriction
Answer a view of this restriction as a some values from expression
- Specified by:
asSomeValuesFromRestrictionin interfaceRestriction- Returns:
- This class, but viewed as a SomeValuesFromRestriction node
- Throws:
ConversionException- if the class cannot be converted to an all values from restriction given the lanuage profile and the current state of the underlying model.
-
asHasValueRestriction
Answer a view of this restriction as a has value expression
- Specified by:
asHasValueRestrictionin interfaceRestriction- Returns:
- This class, but viewed as a HasValueRestriction node
- Throws:
ConversionException- if the class cannot be converted to a has value restriction given the lanuage profile and the current state of the underlying model.
-
asCardinalityRestriction
Answer a view of this restriction as a cardinality restriction class expression
- Specified by:
asCardinalityRestrictionin interfaceRestriction- Returns:
- This class, but viewed as a CardinalityRestriction node
- Throws:
ConversionException- if the class cannot be converted to a cardinality restriction given the lanuage profile and the current state of the underlying model.
-
asMinCardinalityRestriction
Answer a view of this restriction as a min cardinality restriction class expression
- Specified by:
asMinCardinalityRestrictionin interfaceRestriction- Returns:
- This class, but viewed as a MinCardinalityRestriction node
- Throws:
ConversionException- if the class cannot be converted to a min cardinality restriction given the lanuage profile and the current state of the underlying model.
-
asMaxCardinalityRestriction
Answer a view of this restriction as a max cardinality restriction class expression
- Specified by:
asMaxCardinalityRestrictionin interfaceRestriction- Returns:
- This class, but viewed as a MaxCardinalityRestriction node
- Throws:
ConversionException- if the class cannot be converted to a max cardinality restriction given the lanuage profile and the current state of the underlying model.
-
isAllValuesFromRestriction
public boolean isAllValuesFromRestriction()Answer true if this restriction is an all values from restriction
- Specified by:
isAllValuesFromRestrictionin interfaceRestriction- Returns:
- True if this is an allValuesFrom property restriction
- Throws:
ProfileException- ifProfile.ALL_VALUES_FROM()is not supported in the current profile
-
isSomeValuesFromRestriction
public boolean isSomeValuesFromRestriction()Answer true if this restriction is a some values from restriction
- Specified by:
isSomeValuesFromRestrictionin interfaceRestriction- Returns:
- True if this is a someValuesFrom property restriction
- Throws:
ProfileException- ifProfile.SOME_VALUES_FROM()is not supported in the current profile
-
isHasValueRestriction
public boolean isHasValueRestriction()Answer true if this restriction is a has value restriction
- Specified by:
isHasValueRestrictionin interfaceRestriction- Returns:
- True if this is a hasValue property restriction
- Throws:
ProfileException- ifProfile.HAS_VALUE()is not supported in the current profile
-
isCardinalityRestriction
public boolean isCardinalityRestriction()Answer true if this restriction is a cardinality restriction (ie is a property restriction constructed with an
owl:cardinalityoperator, or similar). This is not a test for a restriction that tests cardinalities in general.- Specified by:
isCardinalityRestrictionin interfaceRestriction- Returns:
- True if this is a cardinality property restriction
- Throws:
ProfileException- ifProfile.CARDINALITY()is not supported in the current profile
-
isMinCardinalityRestriction
public boolean isMinCardinalityRestriction()Answer true if this restriction is a min cardinality restriction (ie is a property restriction constructed with an
owl:minCardinalityoperator, or similar). This is not a test for a restriction that tests cardinalities in general.- Specified by:
isMinCardinalityRestrictionin interfaceRestriction- Returns:
- True if this is a minCardinality property restriction
- Throws:
ProfileException- ifProfile.MIN_CARDINALITY()is not supported in the current profile
-
isMaxCardinalityRestriction
public boolean isMaxCardinalityRestriction()Answer true if this restriction is a max cardinality restriction (ie is a property restriction constructed with an
owl:maxCardinalityoperator, or similar). This is not a test for a restriction that tests cardinalities in general.- Specified by:
isMaxCardinalityRestrictionin interfaceRestriction- Returns:
- True if this is a maxCardinality property restriction
- Throws:
ProfileException- ifProfile.MAX_CARDINALITY()is not supported in the current profile
-
convertToAllValuesFromRestriction
Convert this restriction to an all values from class expression.
- Specified by:
convertToAllValuesFromRestrictionin interfaceRestriction- Parameters:
cls- The class to which all values of the restricted property must belong, to be in the extension of this restriction- Returns:
- This class, but converted to a AllValuesFromRestriction class expression
- Throws:
ProfileException- ifProfile.ALL_VALUES_FROM()is not supported in the current profile
-
convertToSomeValuesFromRestriction
Convert this restriction to a some values from class expression
- Specified by:
convertToSomeValuesFromRestrictionin interfaceRestriction- Parameters:
cls- The class to which at least one value of the restricted property must belong, to be in the extension of this restriction- Returns:
- This class, but converted to a SomeValuesFromRestriction node
- Throws:
ProfileException- ifProfile.SOME_VALUES_FROM()is not supported in the current profile
-
convertToHasValueRestriction
Convert this restriction to a has value class expression
- Specified by:
convertToHasValueRestrictionin interfaceRestriction- Parameters:
value- The value which the restricted property must have, for resource to be in the extension of this restriction- Returns:
- This class, but converted to a HasValueRestriction
- Throws:
ProfileException- ifProfile.HAS_VALUE()is not supported in the current profile
-
convertToCardinalityRestriction
Convert this restriction to a cardinality restriction class expression
- Specified by:
convertToCardinalityRestrictionin interfaceRestriction- Parameters:
cardinality- The exact cardinality for the restricted property- Returns:
- This class, but converted to a CardinalityRestriction node
- Throws:
ProfileException- ifProfile.CARDINALITY()is not supported in the current profile
-
convertToMinCardinalityRestriction
Convert this restriction to a min cardinality restriction class expression
- Specified by:
convertToMinCardinalityRestrictionin interfaceRestriction- Parameters:
cardinality- The minimum cardinality for the restricted property- Returns:
- This class, but converted to a MinCardinalityRestriction node
- Throws:
ProfileException- ifProfile.MIN_CARDINALITY()is not supported in the current profile
-
convertToMaxCardinalityRestriction
Convert this restriction to a max cardinality restriction class expression
- Specified by:
convertToMaxCardinalityRestrictionin interfaceRestriction- Parameters:
cardinality- The maximum cardinality for the restricted property- Returns:
- This class, but converted to a MaxCardinalityRestriction node
- Throws:
ProfileException- ifProfile.MAX_CARDINALITY()is not supported in the current profile
-