Class PartialStatement

java.lang.Object
laas.openrobots.ontology.PartialStatement
All Implemented Interfaces:
com.hp.hpl.jena.graph.FrontsTriple, com.hp.hpl.jena.rdf.model.Statement

public class PartialStatement extends Object implements com.hp.hpl.jena.rdf.model.Statement
A partial statement is a statement whose at least one element (subject, predicate or object) is unknown.
To be valid, a partial statement must have at least one variable, prepended with a "?". For instance: "?mysterious oro:objProperty oro:individual"
  • Constructor Details

    • PartialStatement

      public PartialStatement(com.hp.hpl.jena.rdf.model.Resource subject, com.hp.hpl.jena.rdf.model.Property predicate, com.hp.hpl.jena.rdf.model.RDFNode object, com.hp.hpl.jena.rdf.model.impl.ModelCom model)
      Creates a partial statement from a partial triplet (subject, predicate, object). At least one of the parameter is assumed to be null.
      Parameters:
      subject - The subject of the statement
      predicate - The predicate of the statement
      object - The object of the statement
      model - The ontology this partial statement refers to.
    • PartialStatement

      public PartialStatement(String partialStatement, com.hp.hpl.jena.rdf.model.impl.ModelCom model) throws IllegalStatementException
      Create a new partial statement from its string representation.
      Works as OpenRobotsOntology.createStatement(String) except at least one variable, prepended with a "?", is expected.
      This class implements Statement, but the getSubject(), getPredicate() and getObject() method will return null if the corresponding part of the statement is unbounded.
      Parameters:
      partialStatement - The string representing the partial statement. For example, "?mysterious oro:objProperty2 ?object" or "?subject oro:dataProperty1 true" are valid.
      model - The ontology this partial statement refers to.
      Throws:
      IllegalStatementException - Currently thrown only if the statement doesn't contain three tokens.
      See Also:
  • Method Details

    • asSparqlRow

      public String asSparqlRow()
      Formats a partial statement for inclusion in a SPARQL query.
      Unbounded resources of the statement are rendered with "?" as prefixes, other parts are rendered as resources with their full URIs.
      Returns:
      the formatted partial statement.
    • isPartialStatement

      public static boolean isPartialStatement(String lex)
      Performs basic tests to determine if a statement is a partial statement, ie if the given string contains three tokens and at least one token starting with ?.
      Parameters:
      lex - a string to test
      Returns:
      whether the statement is a partial statement or not.
    • toString

      public String toString()
      Overrides:
      toString in class Object
    • getSubject

      public com.hp.hpl.jena.rdf.model.Resource getSubject()
      Specified by:
      getSubject in interface com.hp.hpl.jena.rdf.model.Statement
    • getPredicate

      public com.hp.hpl.jena.rdf.model.Property getPredicate()
      Specified by:
      getPredicate in interface com.hp.hpl.jena.rdf.model.Statement
    • getObject

      public com.hp.hpl.jena.rdf.model.RDFNode getObject()
      Specified by:
      getObject in interface com.hp.hpl.jena.rdf.model.Statement
    • changeLiteralObject

      public com.hp.hpl.jena.rdf.model.Statement changeLiteralObject(boolean o)
      Specified by:
      changeLiteralObject in interface com.hp.hpl.jena.rdf.model.Statement
    • changeLiteralObject

      public com.hp.hpl.jena.rdf.model.Statement changeLiteralObject(long o)
      Specified by:
      changeLiteralObject in interface com.hp.hpl.jena.rdf.model.Statement
    • changeLiteralObject

      public com.hp.hpl.jena.rdf.model.Statement changeLiteralObject(int o)
      Specified by:
      changeLiteralObject in interface com.hp.hpl.jena.rdf.model.Statement
    • changeLiteralObject

      public com.hp.hpl.jena.rdf.model.Statement changeLiteralObject(char o)
      Specified by:
      changeLiteralObject in interface com.hp.hpl.jena.rdf.model.Statement
    • changeLiteralObject

      public com.hp.hpl.jena.rdf.model.Statement changeLiteralObject(float o)
      Specified by:
      changeLiteralObject in interface com.hp.hpl.jena.rdf.model.Statement
    • changeLiteralObject

      public com.hp.hpl.jena.rdf.model.Statement changeLiteralObject(double o)
      Specified by:
      changeLiteralObject in interface com.hp.hpl.jena.rdf.model.Statement
    • changeObject

      public com.hp.hpl.jena.rdf.model.Statement changeObject(String o)
      Specified by:
      changeObject in interface com.hp.hpl.jena.rdf.model.Statement
    • changeObject

      public com.hp.hpl.jena.rdf.model.Statement changeObject(com.hp.hpl.jena.rdf.model.RDFNode o)
      Specified by:
      changeObject in interface com.hp.hpl.jena.rdf.model.Statement
    • changeObject

      public com.hp.hpl.jena.rdf.model.Statement changeObject(String o, boolean wellFormed)
      Specified by:
      changeObject in interface com.hp.hpl.jena.rdf.model.Statement
    • changeObject

      public com.hp.hpl.jena.rdf.model.Statement changeObject(String o, String l)
      Specified by:
      changeObject in interface com.hp.hpl.jena.rdf.model.Statement
    • changeObject

      public com.hp.hpl.jena.rdf.model.Statement changeObject(String o, String l, boolean wellFormed)
      Specified by:
      changeObject in interface com.hp.hpl.jena.rdf.model.Statement
    • createReifiedStatement

      public com.hp.hpl.jena.rdf.model.ReifiedStatement createReifiedStatement()
      Specified by:
      createReifiedStatement in interface com.hp.hpl.jena.rdf.model.Statement
    • createReifiedStatement

      public com.hp.hpl.jena.rdf.model.ReifiedStatement createReifiedStatement(String uri)
      Specified by:
      createReifiedStatement in interface com.hp.hpl.jena.rdf.model.Statement
    • getAlt

      public com.hp.hpl.jena.rdf.model.Alt getAlt()
      Specified by:
      getAlt in interface com.hp.hpl.jena.rdf.model.Statement
    • getBag

      public com.hp.hpl.jena.rdf.model.Bag getBag()
      Specified by:
      getBag in interface com.hp.hpl.jena.rdf.model.Statement
    • getBoolean

      public boolean getBoolean()
      Specified by:
      getBoolean in interface com.hp.hpl.jena.rdf.model.Statement
    • getByte

      public byte getByte()
      Specified by:
      getByte in interface com.hp.hpl.jena.rdf.model.Statement
    • getChar

      public char getChar()
      Specified by:
      getChar in interface com.hp.hpl.jena.rdf.model.Statement
    • getDouble

      public double getDouble()
      Specified by:
      getDouble in interface com.hp.hpl.jena.rdf.model.Statement
    • getFloat

      public float getFloat()
      Specified by:
      getFloat in interface com.hp.hpl.jena.rdf.model.Statement
    • getInt

      public int getInt()
      Specified by:
      getInt in interface com.hp.hpl.jena.rdf.model.Statement
    • getLanguage

      public String getLanguage()
      Specified by:
      getLanguage in interface com.hp.hpl.jena.rdf.model.Statement
    • getLiteral

      public com.hp.hpl.jena.rdf.model.Literal getLiteral()
      Specified by:
      getLiteral in interface com.hp.hpl.jena.rdf.model.Statement
    • getLong

      public long getLong()
      Specified by:
      getLong in interface com.hp.hpl.jena.rdf.model.Statement
    • getModel

      public com.hp.hpl.jena.rdf.model.Model getModel()
      Specified by:
      getModel in interface com.hp.hpl.jena.rdf.model.Statement
    • getProperty

      public com.hp.hpl.jena.rdf.model.Statement getProperty(com.hp.hpl.jena.rdf.model.Property p)
      Specified by:
      getProperty in interface com.hp.hpl.jena.rdf.model.Statement
    • getResource

      public com.hp.hpl.jena.rdf.model.Resource getResource()
      Specified by:
      getResource in interface com.hp.hpl.jena.rdf.model.Statement
    • getSeq

      public com.hp.hpl.jena.rdf.model.Seq getSeq()
      Specified by:
      getSeq in interface com.hp.hpl.jena.rdf.model.Statement
    • getShort

      public short getShort()
      Specified by:
      getShort in interface com.hp.hpl.jena.rdf.model.Statement
    • getStatementProperty

      public com.hp.hpl.jena.rdf.model.Statement getStatementProperty(com.hp.hpl.jena.rdf.model.Property p)
      Specified by:
      getStatementProperty in interface com.hp.hpl.jena.rdf.model.Statement
    • getString

      public String getString()
      Specified by:
      getString in interface com.hp.hpl.jena.rdf.model.Statement
    • hasWellFormedXML

      public boolean hasWellFormedXML()
      Specified by:
      hasWellFormedXML in interface com.hp.hpl.jena.rdf.model.Statement
    • isReified

      public boolean isReified()
      Specified by:
      isReified in interface com.hp.hpl.jena.rdf.model.Statement
    • listReifiedStatements

      public com.hp.hpl.jena.rdf.model.RSIterator listReifiedStatements()
      Specified by:
      listReifiedStatements in interface com.hp.hpl.jena.rdf.model.Statement
    • remove

      public com.hp.hpl.jena.rdf.model.Statement remove()
      Specified by:
      remove in interface com.hp.hpl.jena.rdf.model.Statement
    • removeReification

      public void removeReification()
      Specified by:
      removeReification in interface com.hp.hpl.jena.rdf.model.Statement
    • asTriple

      public com.hp.hpl.jena.graph.Triple asTriple()
      Specified by:
      asTriple in interface com.hp.hpl.jena.graph.FrontsTriple
    • getResource

      public com.hp.hpl.jena.rdf.model.Resource getResource(com.hp.hpl.jena.rdf.model.ResourceF f)
      Specified by:
      getResource in interface com.hp.hpl.jena.rdf.model.Statement