Class CardinalityRestrictionImpl

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

public class CardinalityRestrictionImpl extends RestrictionImpl implements CardinalityRestriction

Implementation of the cardinality restriction abstraction.

  • Field Details

    • factory

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

    • CardinalityRestrictionImpl

      public CardinalityRestrictionImpl(Node n, EnhGraph g)

      Construct a cardinality 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

    • setCardinality

      public void setCardinality(int cardinality)

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

      Specified by:
      setCardinality in interface CardinalityRestriction
      Parameters:
      cardinality - The cardinality of the restricted property
      Throws:
      ProfileException - If the Profile.CARDINALITY() property is not supported in the current language profile.
    • getCardinality

      public int getCardinality()

      Answer the cardinality of the restricted property.

      Specified by:
      getCardinality in interface CardinalityRestriction
      Returns:
      The cardinality of the restricted property
      Throws:
      ProfileException - If the Profile.CARDINALITY() property is not supported in the current language profile.
    • hasCardinality

      public boolean hasCardinality(int cardinality)

      Answer true if this property restriction has the given cardinality.

      Specified by:
      hasCardinality in interface CardinalityRestriction
      Parameters:
      cardinality - The cardinality to test against
      Returns:
      True if the given cardinality is the cardinality of the restricted property in this restriction
      Throws:
      ProfileException - If the Profile.CARDINALITY() property is not supported in the current language profile.
    • removeCardinality

      public void removeCardinality(int cardinality)

      Remove the statement that this restriction has the given cardinality for the restricted property. If this statement is not true of the current model, nothing happens.

      Specified by:
      removeCardinality in interface CardinalityRestriction
      Parameters:
      cardinality - A cardinality value to be removed from this restriction