Class StatementImpl

java.lang.Object
org.apache.jena.rdf.model.impl.StatementBase
org.apache.jena.rdf.model.impl.StatementImpl
All Implemented Interfaces:
FrontsTriple, Statement

public class StatementImpl extends StatementBase implements Statement
An implementation of Statement.
  • Constructor Details

  • Method Details

    • toStatement

      public static Statement toStatement(Triple t, ModelCom eg)
      create a Statement from the triple _t_ in the enhanced graph _eg_. The Statement has subject, predicate, and object corresponding to those of _t_.
    • getSubject

      public Resource getSubject()
      Description copied from interface: Statement
      An accessor method to return the subject of the statements.
      Specified by:
      getSubject in interface Statement
      Specified by:
      getSubject in class StatementBase
      Returns:
      The subject of the statement.
    • getPredicate

      public Property getPredicate()
      Description copied from interface: Statement
      An accessor function to return the predicate of the statement.
      Specified by:
      getPredicate in interface Statement
      Specified by:
      getPredicate in class StatementBase
      Returns:
      The predicate of the statement.
    • getObject

      public RDFNode getObject()
      Description copied from interface: Statement
      An accessor funtion to return the object of the statement.
      Specified by:
      getObject in interface Statement
      Specified by:
      getObject in class StatementBase
      Returns:
      Return the object of the statement.
    • getStatementProperty

      public Statement getStatementProperty(Property p)
      Description copied from interface: Statement
      Return a property of this statement.

      The model associated with this statement is searched for a statement with this statement as subject and the specified property as predicate. If such a statement is found it is return. If more than one exists in the model, then it is undefined which is returned. If no such statement exists, an exception is thrown.

      Specified by:
      getStatementProperty in interface Statement
      Parameters:
      p - the property sought
      Returns:
      a statement representing an instance of the specified property.
    • getResource

      public Resource getResource()
      Description copied from interface: Statement
      Return the object of the statement.

      An exception will be thrown if the object is not a resource.

      Specified by:
      getResource in interface Statement
      Specified by:
      getResource in class StatementBase
      Returns:
      The Resource which is the object of the statement.
    • getProperty

      public Statement getProperty(Property p)
      Description copied from interface: Statement
      Get a property of the object of the statement.

      There is an unfortunate ambiguity here. GetProperty would normally treat the statement as a resource, and return a property about this statement. This is not what is wanted in most cases, so getProperty on a statement is defined to call getProperty on its object. If a property of the statement itself is required, getStatementProperty should be used.

      If the object of the statement is not a resource, an exception is thrown.

      Specified by:
      getProperty in interface Statement
      Parameters:
      p - the property sought
      Returns:
      a statement representing an instance of the required property
    • getLiteral

      public Literal getLiteral()
      get the object field of this statement, insisting that it be a Literal. If it isn't, throw LiteralRequiredException.
      Specified by:
      getLiteral in interface Statement
      Specified by:
      getLiteral in class StatementBase
      Returns:
      The Literal which is the object of the statement.
    • getBag

      public Bag getBag()
      Description copied from interface: Statement
      Return the object of the statement.

      An exception will be thrown if the object is not a Resource.

      Specified by:
      getBag in interface Statement
      Returns:
      The object of the statement interpreted as a value of the specified type.
    • getAlt

      public Alt getAlt()
      Description copied from interface: Statement
      Return the object of the statement.

      An exception will be thrown if the object is not a Resource.

      Specified by:
      getAlt in interface Statement
      Returns:
      The object of the statement interpreted as a value of the specified type.
    • getSeq

      public Seq getSeq()
      Description copied from interface: Statement
      Return the object of the statement.

      An exception will be thrown if the object is not a Resource.

      Specified by:
      getSeq in interface Statement
      Returns:
      The object of the statement interpreted as a value of the specified type.
    • getList

      public RDFList getList()
      Description copied from interface: Statement
      Return the object of the statement as an RDF List.

      An exception will be thrown if the object is not an RDFList.

      Specified by:
      getList in interface Statement
      Returns:
      The object of the statement interpreted as a value as RDFList.
    • equals

      public boolean equals(Object o)
      .equals() defers to .sameAs so we only get the complexity of one cast.
      Specified by:
      equals in interface Statement
      Overrides:
      equals in class Object
      Parameters:
      o - the object to be compared
      Returns:
      true if and only if the equality condition is met.
    • hashCode

      public int hashCode()
      Description copied from interface: Statement
      Returns asTriple().hashCode()
      Specified by:
      hashCode in interface Statement
      Overrides:
      hashCode in class Object
    • remove

      public Statement remove()
      Description copied from interface: Statement
      Remove this statement from its associated model.

      The statement with the same subject, predicate and object as this statement will be removed from the model associated with this statement.

      Specified by:
      remove in interface Statement
      Returns:
      this statement.
    • asTriple

      public Triple asTriple()
      Specified by:
      asTriple in interface FrontsTriple
    • asTriples

      public static Triple[] asTriples(Statement[] statements)
      returns an array of triples corresponding to the array of statements; ie the i'th element of the result is the i'th element of the input as a triple.
      Parameters:
      statements - the array of statements to convert
      Returns:
      the corresponding array of triples
    • createObject

      public static RDFNode createObject(Node n, EnhGraph g)
      create an RDF node which might be a literal, or not.