Class Assertion

java.lang.Object
cz.cvut.kbss.ontodriver.model.NamedResource
cz.cvut.kbss.ontodriver.model.Assertion
All Implemented Interfaces:
Serializable

public abstract class Assertion extends NamedResource
Base assertion axiom class.

Defines just whether the assertion uses inferred values and existing types of assertions.

The usage of types may seem as not being very object-oriented, but since the hierarchy is fixed (there aren't any other kinds of assertions in ontologies) and since the subclasses essentially don't contain any behavior, we can use this way.

See Also:
  • Field Details

    • language

      protected final String language
  • Constructor Details

    • Assertion

      protected Assertion(URI identifier, boolean isInferred)
    • Assertion

      protected Assertion(URI identifier, String language, boolean isInferred)
  • Method Details

    • isInferred

      public boolean isInferred()
      Whether this assertion is based on inferred values.
      Returns:
      True if inferred, false otherwise
    • isClassAssertion

      public boolean isClassAssertion()
      Whether this assertion is a class assertion.

      This is a convenience method, its functionality could be emulated by retrieving this assertion's identifier and checking whether it equals to the rdf:type URI.

      Returns:
      True if this assertion is a class assertion, false otherwise.
    • getType

      public abstract Assertion.AssertionType getType()
      Gets type of this assertion.
      Returns:
      Assertion type
    • getLanguage

      public String getLanguage()
      Gets the language tag carried by this assertion.

      The language tag applies only to string-based literals.

      Returns:
      Language tag, e.g. en, can be null
    • hasLanguage

      public boolean hasLanguage()
      Checks whether a language tag was set for this assertion.
      Returns:
      true if a language tag was set, false otherwise
    • equals

      public boolean equals(Object o)
      Overrides:
      equals in class NamedResource
    • hashCode

      public int hashCode()
      Overrides:
      hashCode in class NamedResource
    • toString

      public String toString()
      Overrides:
      toString in class NamedResource
    • createClassAssertion

      public static Assertion createClassAssertion(boolean isInferred)
      Creates new class assertion.

      Class assertions use the rdf:type identifier.

      Parameters:
      isInferred - Whether the assertion uses inferred values
      Returns:
      Assertion
    • createUnspecifiedPropertyAssertion

      public static Assertion createUnspecifiedPropertyAssertion(boolean isInferred)
      Creates a property assertion without specifying the assertion identifier.

      Note that the returned instances have the same identifier throughout one JVM - a randomly generated URI.

      Parameters:
      isInferred - Whether the assertion uses inferred values
      Returns:
      Assertion
    • createUnspecifiedPropertyAssertion

      public static Assertion createUnspecifiedPropertyAssertion(String language, boolean isInferred)
      Creates a property assertion without specifying the assertion identifier.

      Note that the returned instances have the same identifier throughout one JVM - a randomly generated URI.

      Parameters:
      language - Language tag, optional
      isInferred - Whether the assertion uses inferred values
      Returns:
      Assertion
    • createPropertyAssertion

      public static Assertion createPropertyAssertion(URI assertionIdentifier, boolean isInferred)
      Creates new property assertion without specifying what kind of property it is.
      Parameters:
      assertionIdentifier - Assertion identifier
      isInferred - Whether the assertion uses inferred values
      Returns:
      Assertion
    • createPropertyAssertion

      public static Assertion createPropertyAssertion(URI assertionIdentifier, String language, boolean isInferred)
      Creates new property assertion without specifying what kind of property it is.
      Parameters:
      assertionIdentifier - Assertion identifier
      language - Language tag. Passing null explicitly specifies that any language tag is supported
      isInferred - Whether the assertion uses inferred values
      Returns:
      Assertion
    • createObjectPropertyAssertion

      public static Assertion createObjectPropertyAssertion(URI assertionIdentifier, boolean isInferred)
      Creates new object property assertion.
      Parameters:
      assertionIdentifier - Assertion identifier
      isInferred - Whether the assertion uses inferred values
      Returns:
      Assertion
    • createDataPropertyAssertion

      public static Assertion createDataPropertyAssertion(URI assertionIdentifier, boolean isInferred)
      Creates new data property assertion.
      Parameters:
      assertionIdentifier - Assertion identifier
      isInferred - Whether the assertion uses inferred values
      Returns:
      Assertion
    • createDataPropertyAssertion

      public static Assertion createDataPropertyAssertion(URI assertionIdentifier, String language, boolean isInferred)
      Creates new data property assertion.
      Parameters:
      assertionIdentifier - Assertion identifier
      language - Language tag. Passing null explicitly specifies that any language tag is supported
      isInferred - Whether the assertion uses inferred values
      Returns:
      Assertion
    • createAnnotationPropertyAssertion

      public static Assertion createAnnotationPropertyAssertion(URI assertionIdentifier, boolean isInferred)
      Creates new annotation property assertion.
      Parameters:
      assertionIdentifier - Assertion identifier
      isInferred - Whether the assertion uses inferred values
      Returns:
      Assertion
    • createAnnotationPropertyAssertion

      public static Assertion createAnnotationPropertyAssertion(URI assertionIdentifier, String language, boolean isInferred)
      Creates new annotation property assertion.
      Parameters:
      assertionIdentifier - Assertion identifier
      language - Language tag. Passing null explicitly specifies that any language tag is supported
      isInferred - Whether the assertion uses inferred values
      Returns:
      Assertion