Class HasValueRestrictionImpl

All Implemented Interfaces:
FrontsNode, HasValueRestriction, OntClass, OntResource, Restriction, RDFNode, Resource

public class HasValueRestrictionImpl extends RestrictionImpl implements HasValueRestriction

Implementation of the hasValue restriction abstraction.

  • Field Details

    • factory

      public static Implementation factory
      A factory for generating HasValueRestriction facets from nodes in enhanced graphs. Note: should not be invoked directly by user code: use as() instead.
  • Constructor Details

    • HasValueRestrictionImpl

      public HasValueRestrictionImpl(Node n, EnhGraph g)

      Construct a hasValue restriction node represented by the given node in the given graph.

      Parameters:
      n - The node that represents the resource
      g - The enh graph that contains n
  • Method Details

    • setHasValue

      public void setHasValue(RDFNode value)

      Assert that this restriction restricts the property to have the given value. Any existing statements for hasValue will be removed.

      Specified by:
      setHasValue in interface HasValueRestriction
      Parameters:
      value - The RDF value (an individual or a literal) that is the value that the restricted property must have to be a member of the class defined by this restriction.
      Throws:
      ProfileException - If the Profile.HAS_VALUE() property is not supported in the current language profile.
    • getHasValue

      public RDFNode getHasValue()

      Answer the RDF value that all values of the restricted property must be equal to.

      Specified by:
      getHasValue in interface HasValueRestriction
      Returns:
      An RDFNode that is the value of the restricted property
      Throws:
      ProfileException - If the Profile.HAS_VALUE() property is not supported in the current language profile.
    • hasValue

      public boolean hasValue(RDFNode value)

      Answer true if this property restriction has the given RDF value as the value which all values of the restricted property must equal.

      Specified by:
      hasValue in interface HasValueRestriction
      Parameters:
      value - An RDF value to test
      Returns:
      True if the given value is the value of the restricted property in this restriction
      Throws:
      ProfileException - If the Profile.HAS_VALUE() property is not supported in the current language profile.
    • removeHasValue

      public void removeHasValue(RDFNode value)

      Remove the statement that this restriction requires the restricted property to have the given value. If this statement is not true of the current model, nothing happens.

      Specified by:
      removeHasValue in interface HasValueRestriction
      Parameters:
      value - An RDF value that is to be removed as the required value for the restricted property