Interface RdfTripleConsumer

  • All Known Implementing Classes:
    RdfQuadAdapter, RdfQuadEmitter

    interface RdfTripleConsumer
    An RDF triple consumer interface designed for high-speed processing and seamless integration with third-party libraries. Intended to be used in cases where triples are emitted in bulk as a set belonging to the same graph, and where a producer keeps triple sets associated with graphs. This interface minimizes unnecessary object instantiation, enhancing efficiency in RDF data processing.
    • Method Summary

      All Methods Instance Methods Abstract Methods 
      Modifier and Type Method Description
      RdfTripleConsumer defaultGraph()
      Sets the default graph as the active scope.
      RdfTripleConsumer namedGraph​(java.lang.String graph)
      Sets a named graph as the active scope.
      RdfTripleConsumer triple​(java.lang.String subject, java.lang.String predicate, java.lang.String object)
      Accepts an RDF triple where the object is an IRI or a blank node.
      RdfTripleConsumer triple​(java.lang.String subject, java.lang.String predicate, java.lang.String literal, java.lang.String datatype)
      Accepts an RDF triple where the object is a literal with a datatype.
      RdfTripleConsumer triple​(java.lang.String subject, java.lang.String predicate, java.lang.String literal, java.lang.String language, java.lang.String direction)
      Accepts an RDF triple where the object is a localized string value.
    • Method Detail

      • defaultGraph

        RdfTripleConsumer defaultGraph()
                                throws com.apicatalog.rdf.api.RdfConsumerException
        Sets the default graph as the active scope. This method is invoked when triples belong to the unnamed default graph.
        Returns:
        An instance enabling fluent programming; never null.
        Throws:
        com.apicatalog.rdf.api.RdfConsumerException - if an error occurs while processing the N-Quad statement
      • namedGraph

        RdfTripleConsumer namedGraph​(java.lang.String graph)
                              throws com.apicatalog.rdf.api.RdfConsumerException
        Sets a named graph as the active scope. Ensures that subsequent triples are associated with the specified graph.
        Parameters:
        graph - The name of the graph (IRI or blank node identifier prefixed with "_:"); never null.
        Returns:
        An instance enabling fluent programming; never null.
        Throws:
        com.apicatalog.rdf.api.RdfConsumerException - if an error occurs while processing the N-Quad statement
      • triple

        RdfTripleConsumer triple​(java.lang.String subject,
                                 java.lang.String predicate,
                                 java.lang.String object)
                          throws com.apicatalog.rdf.api.RdfConsumerException
        Accepts an RDF triple where the object is an IRI or a blank node. The triple is processed within the currently active graph scope.
        Parameters:
        subject - The subject of the triple (IRI or blank node identifier prefixed with "_:"); never null.
        predicate - The predicate of the triple (IRI); never null.
        object - The object of the triple (IRI or blank node identifier prefixed with "_:"); never null.
        Returns:
        An instance enabling fluent programming; never null.
        Throws:
        com.apicatalog.rdf.api.RdfConsumerException - if an error occurs while processing the N-Quad statement
      • triple

        RdfTripleConsumer triple​(java.lang.String subject,
                                 java.lang.String predicate,
                                 java.lang.String literal,
                                 java.lang.String datatype)
                          throws com.apicatalog.rdf.api.RdfConsumerException
        Accepts an RDF triple where the object is a literal with a datatype. Optimized for efficient handling of typed literals. The triple is processed within the currently active graph scope.
        Parameters:
        subject - The subject of the triple (IRI or blank node identifier prefixed with "_:"); never null.
        predicate - The predicate of the triple (IRI); never null.
        literal - The literal value of the object; never null.
        datatype - The datatype IRI of the literal; never null.
        Returns:
        An instance enabling fluent programming; never null.
        Throws:
        com.apicatalog.rdf.api.RdfConsumerException - if an error occurs while processing the N-Quad statement
      • triple

        RdfTripleConsumer triple​(java.lang.String subject,
                                 java.lang.String predicate,
                                 java.lang.String literal,
                                 java.lang.String language,
                                 java.lang.String direction)
                          throws com.apicatalog.rdf.api.RdfConsumerException
        Accepts an RDF triple where the object is a localized string value. Optimized for efficient handling of language-tagged literals. The triple is processed within the currently active graph scope.
        Parameters:
        subject - The subject of the triple (IRI or blank node identifier prefixed with "_:"); never null.
        predicate - The predicate of the triple (IRI); never null.
        literal - The literal value of the object; never null.
        language - The language tag of the literal; never null.
        direction - The text direction of the literal (optional, may be null).
        Returns:
        An instance enabling fluent programming; never null.
        Throws:
        com.apicatalog.rdf.api.RdfConsumerException - if an error occurs while processing the N-Quad statement