Interface RdfTermFactory

  • All Known Implementing Classes:
    TermHashMap

    public interface RdfTermFactory
    A factory interface for creating RDF terms such as resources, literals, triples, and quads.

    This interface provides methods to create different types of RDF terms, which are the building blocks of RDF statements (triples and quads). These methods help in constructing RDF resources, literals, and structured statements (triples and quads) that can be used in RDF graphs or datasets.

    • Method Detail

      • createBlankNode

        RdfResource createBlankNode​(java.lang.String value)
        Creates a blank node with the specified value.

        A blank node is an anonymous resource that does not have an IRI.

        Parameters:
        value - the value of the blank node (usually a string identifier)
        Returns:
        RdfResource representing the blank node
      • createIRI

        RdfResource createIRI​(java.lang.String value)
        Creates an IRI (Internationalized Resource Identifier) with the specified value.

        An IRI is a globally unique identifier used to refer to a resource.

        Parameters:
        value - the value of the IRI (usually a URI string)
        Returns:
        RdfResource representing the IRI
      • createTriple

        RdfTriple createTriple​(RdfResource subject,
                               RdfResource predicate,
                               RdfTerm object)
        Creates a triple consisting of a subject, predicate, and object.

        A triple is the core structure of RDF data, consisting of a subject, predicate, and object.

        Parameters:
        subject - the subject of the triple, must be a RdfResource
        predicate - the predicate of the triple, must be a RdfResource
        object - the object of the triple, can be any RdfTerm
        Returns:
        RdfTriple representing the RDF triple
      • createQuad

        RdfQuad createQuad​(RdfResource subject,
                           RdfResource predicate,
                           RdfTerm object,
                           RdfResource graph)
        Creates a quad consisting of a subject, predicate, object, and graph.

        A quad extends the triple structure by including an additional graph name, allowing RDF data to be associated with a specific graph.

        Parameters:
        subject - the subject of the quad, must be a RdfResource
        predicate - the predicate of the quad, must be a RdfResource
        object - the object of the quad, can be any RdfTerm
        graph - the graph name for the quad, must be a RdfResource
        Returns:
        RdfQuad representing the RDF quad
      • createLiteral

        RdfLiteral createLiteral​(java.lang.String lexicalValue,
                                 java.lang.String datatype)
        Creates an RDF literal with the specified lexical value and datatype.

        RDF literals are used to represent values like strings, numbers, and dates.

        Parameters:
        lexicalValue - the lexical value of the literal (e.g., "42", "hello")
        datatype - the datatype of the literal (e.g., xsd:string, xsd:int)
        Returns:
        RdfLiteral representing the RDF literal
      • createLangString

        RdfLiteral createLangString​(java.lang.String lexicalValue,
                                    java.lang.String datatype,
                                    java.lang.String langTag,
                                    RdfLiteral.Direction direction)
        Creates an RDF language-tagged string with the specified lexical value, datatype, and language tag.

        Language-tagged strings are literals that also have a language tag, e.g., "hello"@en for English.

        Parameters:
        lexicalValue - the lexical value of the language-tagged string
        datatype - the datatype of the literal (should be rdf:langString)
        langTag - the language tag (e.g., "en", "fr")
        direction - the text direction of the string (LTR or RTL)
        Returns:
        RdfLiteral representing the language-tagged string