Class RestrictionImpl
java.lang.Object
org.aksw.jena_sparql_api.restriction.RestrictionImpl
- All Implemented Interfaces:
Cloneable,Restriction
This class represents restrictions to be used on variables.
Rules
. Stating a constant value (node) must be consistent with at least one prefix (if there are any), or equivalent to a previous value.
Additionally all prefixes are removed in that case.
. If a restriction is inconsistent, retrieving fields is meaningless, as their values are not defined.
.) Methods return true if a change occurred
. TODO More details
Further statements could be:
statePattern()
stateRange(min, max)
stateDatatype()
I really hope I am not ending up with my own Datalog+Constraints engine :/
TODO: Maybe the set of uriPrefixes should be replaced with a single prefix -
so that an instance of restriction really only states a single restriction.
So my problem is how to deal with dis/conjunctions of restrictions efficiently
- Author:
- Claus Stadler <cstadler@informatik.uni-leipzig.de>
-
Constructor Summary
ConstructorsConstructorDescriptionRestrictionImpl(RestrictionImpl other) RestrictionImpl(PrefixSet prefixSet) RestrictionImpl(RdfTermType type) RestrictionImpl(org.apache.jena.graph.Node node) -
Method Summary
Modifier and TypeMethodDescriptionclone()booleanorg.apache.jena.graph.NodegetNode()Retrieve the node if it has been set.static RdfTermTypegetNodeType(org.apache.jena.graph.Node node) The set of possible RDF term types this restriction may have.If the restriction is unconstrained, we return true If it is inconsistent false, and null otherwisegetType()Deprecated.Retrieve the set of possible URI prefixes.booleanState a URI regex pattern.inthashCode()booleanbooleanbooleanTest wether the restriction is unsatisfiablebooleanstateNode(org.apache.jena.graph.Node newNode) Stating a node implies stating the typebooleanstateRestriction(Restriction that) booleanstateType(RdfTermType newType) State whether the resource is a URI or a LiteralbooleanstateUriPrefixes(PrefixSet prefixes) States a set of valid prefixes.booleansubsumesOrIsEqual(RestrictionImpl other) Return true if 'this' is equal to or less restrictive than othertoString()
-
Constructor Details
-
RestrictionImpl
public RestrictionImpl() -
RestrictionImpl
-
RestrictionImpl
-
RestrictionImpl
public RestrictionImpl(org.apache.jena.graph.Node node) -
RestrictionImpl
-
-
Method Details
-
subsumesOrIsEqual
Return true if 'this' is equal to or less restrictive than other- Parameters:
other-- Returns:
-
clone
- Specified by:
clonein interfaceRestriction- Overrides:
clonein classObject
-
hasConstant
public boolean hasConstant()Description copied from interface:RestrictionState a URI regex pattern. To be done.- Specified by:
hasConstantin interfaceRestriction
-
hasPrefix
public boolean hasPrefix() -
getType
Deprecated.Get the rdf term type of this restriction. Deprecated because this can be a set.- Returns:
-
getRdfTermTypes
Description copied from interface:RestrictionThe set of possible RDF term types this restriction may have.- Specified by:
getRdfTermTypesin interfaceRestriction- Returns:
-
getNode
public org.apache.jena.graph.Node getNode()Description copied from interface:RestrictionRetrieve the node if it has been set. Implies an RDF term type consistent with the node value.s- Specified by:
getNodein interfaceRestriction- Returns:
- The set node. Null if not set.
-
getUriPrefixes
Description copied from interface:RestrictionRetrieve the set of possible URI prefixes. Implies Type.URI- Specified by:
getUriPrefixesin interfaceRestriction- Returns:
-
stateRestriction
- Specified by:
stateRestrictionin interfaceRestriction
-
stateType
Description copied from interface:RestrictionState whether the resource is a URI or a Literal- Specified by:
stateTypein interfaceRestriction- Returns:
-
getNodeType
-
stateNode
public boolean stateNode(org.apache.jena.graph.Node newNode) Description copied from interface:RestrictionStating a node implies stating the type- Specified by:
stateNodein interfaceRestriction- Returns:
-
stateUriPrefixes
Description copied from interface:RestrictionStates a set of valid prefixes. Note: Stating an empty set implies that no URI can be used as a value. If you do not want to constrain the prefixes, don't call this method. If the set of prefixes becomes empty after stating more prefixes, the constraint becomes inconsistent.- Specified by:
stateUriPrefixesin interfaceRestriction
-
getSatisfiability
If the restriction is unconstrained, we return true If it is inconsistent false, and null otherwise- Returns:
-
isConsistent
public boolean isConsistent() -
hashCode
public int hashCode() -
equals
-
toString
-
isUnsatisfiable
public boolean isUnsatisfiable()Description copied from interface:RestrictionTest wether the restriction is unsatisfiable- Specified by:
isUnsatisfiablein interfaceRestriction- Returns:
-