Package com.apicatalog.rdf.api
Interface RdfQuadConsumer
-
- Functional Interface:
- This is a functional interface and can therefore be used as the assignment target for a lambda expression or method reference.
@FunctionalInterface public interface RdfQuadConsumerRDF quad consumer interface designed for high-performance processing and seamless integration with third-party libraries.This interface minimizes unnecessary object instantiation, improving efficiency when handling RDF data at scale.
Use the provided static helper methods to analyze and validate consumer parameters.
-
-
Method Summary
All Methods Static Methods Instance Methods Abstract Methods Modifier and Type Method Description static booleanisBlank(java.lang.String resource)Checks whether the provided resource identifier represents a blank node.static booleanisDirLangString(java.lang.String datatype, java.lang.String language, java.lang.String direction)Determines if the provided combination ofdatatype,language, anddirectionqualifies the object as an RDF directional language-tagged string literal with a specified direction.static booleanisLangString(java.lang.String datatype, java.lang.String language, java.lang.String direction)Determines if the provided combination ofdatatype,language, anddirectionqualifies the object as an RDF language-tagged string literal with no specified direction.static booleanisLiteral(java.lang.String datatype, java.lang.String language, java.lang.String direction)Determines if the provided combination ofdatatype,language, anddirectionqualifies the object as RDF literal.static booleanisValidObject(java.lang.String datatype, java.lang.String language, java.lang.String direction)Validates whether the object is a valid RDF object based on the presence ofdatatype,language, anddirection.RdfQuadConsumerquad(java.lang.String subject, java.lang.String predicate, java.lang.String object, java.lang.String datatype, java.lang.String language, java.lang.String direction, java.lang.String graph)Consumes an RDF quad where theobjectmay be an IRI, blank node, typed literal, or language-tagged literal.
-
-
-
Method Detail
-
quad
RdfQuadConsumer quad(java.lang.String subject, java.lang.String predicate, java.lang.String object, java.lang.String datatype, java.lang.String language, java.lang.String direction, java.lang.String graph) throws RdfConsumerException
Consumes an RDF quad where theobjectmay be an IRI, blank node, typed literal, or language-tagged literal.This method provides fine-grained control over RDF quad data, allowing precise handling of datatypes, language tags, and text direction.
- Parameters:
subject- the subject of the quad; must be an IRI or blank node identifier prefixed with "_:". Must not benull.predicate- the predicate of the quad; must be an IRI. Must not benull.object- the object of the quad; must be either:- an IRI
- a blank node identifier prefixed with
"
_:" - a literal value, when
datatypeis notnull
null.Use
isValidObject(String, String, String),isLiteral(String, String, String),isLangString(String, String, String), andisDirLangString(String, String, String)to validate and classify the input.datatype- the datatype IRI of the literal. Must benullifobjectis not a literal. Must not benullwhenlanguageordirectionis provided.language- the language tag of the literal. May benull, but must not benullifdirectionis provided.direction- the text direction of the literal. Optional; may benull.graph- the graph name of the quad; must be an IRI or blank node identifier prefixed with "_:". May benullto indicate the default graph.- Returns:
- a reference to this consumer, enabling fluent chaining; never
null. - Throws:
RdfConsumerException- if an error occurs while processing the quad statement.
-
isLiteral
static boolean isLiteral(java.lang.String datatype, java.lang.String language, java.lang.String direction)Determines if the provided combination ofdatatype,language, anddirectionqualifies the object as RDF literal.- Parameters:
datatype- the datatype IRIlanguage- the language tagdirection- the text direction- Returns:
trueindicating a literal, otherwisefalse.
-
isLangString
static boolean isLangString(java.lang.String datatype, java.lang.String language, java.lang.String direction)Determines if the provided combination ofdatatype,language, anddirectionqualifies the object as an RDF language-tagged string literal with no specified direction.- Parameters:
datatype- the datatype IRIlanguage- the language tagdirection- the text direction- Returns:
trueif the provided object is RDF language-tagged literal, otherwisefalse.
-
isDirLangString
static boolean isDirLangString(java.lang.String datatype, java.lang.String language, java.lang.String direction)Determines if the provided combination ofdatatype,language, anddirectionqualifies the object as an RDF directional language-tagged string literal with a specified direction.- Parameters:
datatype- the datatype IRIlanguage- the language tagdirection- the text direction- Returns:
trueif the provided object is RDF directional language-tagged literal, otherwisefalse.
-
isValidObject
static boolean isValidObject(java.lang.String datatype, java.lang.String language, java.lang.String direction)Validates whether the object is a valid RDF object based on the presence ofdatatype,language, anddirection.- Parameters:
datatype- the datatype IRIlanguage- the language tagdirection- the text direction- Returns:
trueif the object is valid according to RDF term rules.
-
isBlank
static boolean isBlank(java.lang.String resource)
Checks whether the provided resource identifier represents a blank node. A blank node identifier must start with "_:".- Parameters:
resource- the resource identifier to check; may benull.- Returns:
trueif the resource is a non-null blank node identifier; otherwisefalse.
-
-