Interface ValueFactory

All Known Implementing Classes:
AbstractValueFactory, MemValueFactory, SimpleValueFactory, ValidatingValueFactory, ValueStore

public interface ValueFactory
A factory for creating IRIs, blank nodes, literals and statements based on the RDF-1.1 Concepts and Abstract Syntax, a W3C Recommendation.
Author:
Arjohn Kampman
See Also:
  • Method Details

    • createIRI

      IRI createIRI(String iri)
      Creates a new IRI from the supplied string-representation.
      Parameters:
      iri - A string-representation of a IRI.
      Returns:
      An object representing the IRI.
      Throws:
      IllegalArgumentException - If the supplied string does not resolve to a legal (absolute) IRI.
    • createIRI

      IRI createIRI(String namespace, String localName)
      Creates a new IRI from the supplied namespace and local name. Calling this method is funtionally equivalent to calling createIRI(namespace+localName), but allows the ValueFactory to reuse supplied namespace and local name strings whenever possible. Note that the values returned by IRI.getNamespace() and IRI.getLocalName() are not necessarily the same as the values that are supplied to this method.
      Parameters:
      namespace - The IRI's namespace.
      localName - The IRI's local name.
      Throws:
      IllegalArgumentException - If the supplied namespace and localname do not resolve to a legal (absolute) IRI.
    • createBNode

      BNode createBNode()
      Creates a new bNode.
      Returns:
      An object representing the bNode.
    • createBNode

      BNode createBNode(String nodeID)
      Creates a new blank node with the given node identifier.
      Parameters:
      nodeID - The blank node identifier.
      Returns:
      An object representing the blank node.
    • createLiteral

      Literal createLiteral(String label)
      Creates a new literal with the supplied label. The return value of Literal.getDatatype() for the returned object must be xsd:string.
      Parameters:
      label - The literal's label, must not be null.
      Returns:
      A literal for the specified value.
    • createLiteral

      Literal createLiteral(String label, String language)
      Creates a new literal with the supplied label and language attribute. The return value of Literal.getDatatype() for the returned object must be rdf:langString.
      Parameters:
      label - The literal's label, must not be null.
      language - The literal's language attribute, must not be null.
      Returns:
      A literal for the specified value and language attribute.
    • createLiteral

      Literal createLiteral(String label, IRI datatype)
      Creates a new literal with the supplied label and datatype.
      Parameters:
      label - The literal's label, must not be null.
      datatype - The literal's datatype. If it is null, the datatype xsd:string will be assigned to this literal.
      Returns:
      A literal for the specified value and type.
    • createLiteral

      Literal createLiteral(String label, CoreDatatype datatype)
      Creates a new literal with the supplied label and datatype.
      Parameters:
      label - The literal's label, must not be null.
      datatype - The literal's datatype. It may not be null.
    • createLiteral

      Literal createLiteral(String label, IRI datatype, CoreDatatype coreDatatype)
      Creates a new literal with the supplied label and datatype.
      Parameters:
      label - The literal's label, must not be null.
      datatype - The literal's datatype. If it is null, the datatype xsd:string will be assigned to this literal.
    • createLiteral

      Literal createLiteral(boolean value)
      Creates a new xsd:boolean-typed literal representing the specified value.
      Parameters:
      value - The value for the literal.
      Returns:
      An xsd:boolean-typed literal for the specified value.
    • createLiteral

      Literal createLiteral(byte value)
      Creates a new xsd:byte-typed literal representing the specified value.
      Parameters:
      value - The value for the literal.
      Returns:
      An xsd:byte-typed literal for the specified value.
    • createLiteral

      Literal createLiteral(short value)
      Creates a new xsd:short-typed literal representing the specified value.
      Parameters:
      value - The value for the literal.
      Returns:
      An xsd:short-typed literal for the specified value.
    • createLiteral

      Literal createLiteral(int value)
      Creates a new xsd:int-typed literal representing the specified value.
      Parameters:
      value - The value for the literal.
      Returns:
      An xsd:int-typed literal for the specified value.
    • createLiteral

      Literal createLiteral(long value)
      Creates a new xsd:long-typed literal representing the specified value.
      Parameters:
      value - The value for the literal.
      Returns:
      An xsd:long-typed literal for the specified value.
    • createLiteral

      Literal createLiteral(float value)
      Creates a new xsd:float-typed literal representing the specified value.
      Parameters:
      value - The value for the literal.
      Returns:
      An xsd:float-typed literal for the specified value.
    • createLiteral

      Literal createLiteral(double value)
      Creates a new xsd:double-typed literal representing the specified value.
      Parameters:
      value - The value for the literal.
      Returns:
      An xsd:double-typed literal for the specified value.
    • createLiteral

      Literal createLiteral(BigDecimal bigDecimal)
      Creates a new literal representing the specified bigDecimal that is typed as an xsd:decimal.
      Parameters:
      bigDecimal - The value for the literal.
      Returns:
      An xsd:decimal-typed literal for the specified value.
    • createLiteral

      Literal createLiteral(BigInteger bigInteger)
      Creates a new literal representing the specified bigInteger that is typed as an xsd:integer.
      Parameters:
      bigInteger - The value for the literal.
      Returns:
      An xsd:integer-typed literal for the specified value.
    • createLiteral

      default Literal createLiteral(TemporalAccessor value)
      Creates a new literal representing a temporal accessor value.
      Parameters:
      value - the temporal accessor value for the literal
      Returns:
      a literal representing the specified temporal accessor value with the appropriate XML Schema date/time datatype
      Throws:
      NullPointerException - if value is null
      IllegalArgumentException - if value cannot be represented by an XML Schema date/time datatype
      Since:
      3.5.0
    • createLiteral

      default Literal createLiteral(TemporalAmount value)
      Creates a new literal representing a temporal amount value.
      Parameters:
      value - the temporal amount value for the literal
      Returns:
      a literal representing the specified temporal amount value with the appropriate XML Schema duration datatype
      Throws:
      NullPointerException - if value is null
      IllegalArgumentException - if value cannot be represented by an XML Schema duration datatype
      Since:
      3.5.0
    • createLiteral

      Literal createLiteral(XMLGregorianCalendar calendar)
      Creates a new literal representing the specified calendar that is typed using the appropriate XML Schema date/time datatype.
      Parameters:
      calendar - The value for the literal.
      Returns:
      A typed literal for the specified calendar.
    • createLiteral

      Literal createLiteral(Date date)
      Creates a new literal representing the specified date that is typed using the appropriate XML Schema date/time datatype.
      Parameters:
      date - The value for the literal.
      Returns:
      A typed literal for the specified date.
    • createStatement

      Statement createStatement(Resource subject, IRI predicate, Value object)
      Creates a new statement with the supplied subject, predicate and object.
      Parameters:
      subject - The statement's subject.
      predicate - The statement's predicate.
      object - The statement's object.
      Returns:
      The created statement.
    • createStatement

      Statement createStatement(Resource subject, IRI predicate, Value object, Resource context)
      Creates a new statement with the supplied subject, predicate and object and associated context.
      Parameters:
      subject - The statement's subject.
      predicate - The statement's predicate.
      object - The statement's object.
      context - The statement's context.
      Returns:
      The created statement.
    • createTriple

      default Triple createTriple(Resource subject, IRI predicate, Value object)
      Creates a new RDF-star triple with the supplied subject, predicate and object.
      Parameters:
      subject - The statement's subject.
      predicate - The statement's predicate.
      object - The statement's object.
      Returns:
      The created triple.
      Since:
      3.2.0