Class MaxCardinalityRestrictionImpl

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

public class MaxCardinalityRestrictionImpl extends RestrictionImpl implements MaxCardinalityRestriction

Implementation of the max cardinality restriction abstraction.

  • Field Details

    • factory

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

    • MaxCardinalityRestrictionImpl

      public MaxCardinalityRestrictionImpl(Node n, EnhGraph g)

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

    • setMaxCardinality

      public void setMaxCardinality(int cardinality)

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

      Specified by:
      setMaxCardinality in interface MaxCardinalityRestriction
      Parameters:
      cardinality - The maximum cardinality of the restricted property
      Throws:
      ProfileException - If the Profile.MAX_CARDINALITY() property is not supported in the current language profile.
    • getMaxCardinality

      public int getMaxCardinality()

      Answer the maximum cardinality of the restricted property.

      Specified by:
      getMaxCardinality in interface MaxCardinalityRestriction
      Returns:
      The maximum cardinality of the restricted property
      Throws:
      ProfileException - If the Profile.MAX_CARDINALITY() property is not supported in the current language profile.
    • hasMaxCardinality

      public boolean hasMaxCardinality(int cardinality)

      Answer true if this property restriction has the given maximum cardinality.

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

      public void removeMaxCardinality(int cardinality)

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

      Specified by:
      removeMaxCardinality in interface MaxCardinalityRestriction
      Parameters:
      cardinality - A max cardinality value to be removed from this restriction