Class RestrictionImpl

java.lang.Object
org.aksw.jena_sparql_api.restriction.RestrictionImpl
All Implemented Interfaces:
Cloneable, Restriction

public class RestrictionImpl extends Object implements 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 Details

    • RestrictionImpl

      public RestrictionImpl()
    • RestrictionImpl

      public RestrictionImpl(RdfTermType type)
    • RestrictionImpl

      public RestrictionImpl(PrefixSet prefixSet)
    • RestrictionImpl

      public RestrictionImpl(org.apache.jena.graph.Node node)
    • RestrictionImpl

      public RestrictionImpl(RestrictionImpl other)
  • Method Details

    • subsumesOrIsEqual

      public boolean subsumesOrIsEqual(RestrictionImpl other)
      Return true if 'this' is equal to or less restrictive than other
      Parameters:
      other -
      Returns:
    • clone

      public RestrictionImpl clone()
      Specified by:
      clone in interface Restriction
      Overrides:
      clone in class Object
    • hasConstant

      public boolean hasConstant()
      Description copied from interface: Restriction
      State a URI regex pattern. To be done.
      Specified by:
      hasConstant in interface Restriction
    • hasPrefix

      public boolean hasPrefix()
    • getType

      @Deprecated public RdfTermType getType()
      Deprecated.
      Get the rdf term type of this restriction. Deprecated because this can be a set.
      Returns:
    • getRdfTermTypes

      public EnumSet<RdfTermType> getRdfTermTypes()
      Description copied from interface: Restriction
      The set of possible RDF term types this restriction may have.
      Specified by:
      getRdfTermTypes in interface Restriction
      Returns:
    • getNode

      public org.apache.jena.graph.Node getNode()
      Description copied from interface: Restriction
      Retrieve the node if it has been set. Implies an RDF term type consistent with the node value.s
      Specified by:
      getNode in interface Restriction
      Returns:
      The set node. Null if not set.
    • getUriPrefixes

      public PrefixSet getUriPrefixes()
      Description copied from interface: Restriction
      Retrieve the set of possible URI prefixes. Implies Type.URI
      Specified by:
      getUriPrefixes in interface Restriction
      Returns:
    • stateRestriction

      public boolean stateRestriction(Restriction that)
      Specified by:
      stateRestriction in interface Restriction
    • stateType

      public boolean stateType(RdfTermType newType)
      Description copied from interface: Restriction
      State whether the resource is a URI or a Literal
      Specified by:
      stateType in interface Restriction
      Returns:
    • getNodeType

      public static RdfTermType getNodeType(org.apache.jena.graph.Node node)
    • stateNode

      public boolean stateNode(org.apache.jena.graph.Node newNode)
      Description copied from interface: Restriction
      Stating a node implies stating the type
      Specified by:
      stateNode in interface Restriction
      Returns:
    • stateUriPrefixes

      public boolean stateUriPrefixes(PrefixSet prefixes)
      Description copied from interface: Restriction
      States 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:
      stateUriPrefixes in interface Restriction
    • getSatisfiability

      public Boolean 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()
      Overrides:
      hashCode in class Object
    • equals

      public boolean equals(Object obj)
      Overrides:
      equals in class Object
    • toString

      public String toString()
      Overrides:
      toString in class Object
    • isUnsatisfiable

      public boolean isUnsatisfiable()
      Description copied from interface: Restriction
      Test wether the restriction is unsatisfiable
      Specified by:
      isUnsatisfiable in interface Restriction
      Returns: