Package org.eclipse.rdf4j.model.util
Class Configurations
java.lang.Object
org.eclipse.rdf4j.model.util.Configurations
Utility functions for working with RDF4J Models representing configuration settings.
- Author:
- Jeen Broekstra
-
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptiongetIRIValue
(Model model, Resource subject, IRI property, IRI legacyProperty) Retrieve a property value for the supplied subject as aIRI
if present, falling back to a supplied legacy property .getLiteralValue
(Model model, Resource subject, IRI property, IRI legacyProperty) Retrieve a property value for the supplied subject as aLiteral
if present, falling back to a supplied legacy property .getPropertyValues
(Model model, Resource subject, IRI property, IRI legacyProperty) Retrieve all property values for the supplied subject as a Set of values and include all values for any legacy property.getResourceValue
(Model model, Resource subject, IRI property, IRI legacyProperty) Retrieve a property value for the supplied subject as aResource
if present, falling back to a supplied legacy property .getSubjectByType
(Model model, IRI type, IRI legacyType) Retrieve the subject of the supplied type, falling back to a supplied legacy type.Retrieve a property value for the supplied subject as aValue
if present, falling back to a supplied legacy property .static boolean
hasLegacyConfiguration
(Model configModel) Verifies if the supplied configuration model uses any legacy vocabulary by checking the IRIs of its propertiesstatic boolean
Verifies if use of legacy configuration vocabulary is preferred.
-
Constructor Details
-
Configurations
public Configurations()
-
-
Method Details
-
useLegacyConfig
public static boolean useLegacyConfig()Verifies if use of legacy configuration vocabulary is preferred. Defaults tofalse
. Can be set by having a system propertyorg.eclipse.rdf4j.model.vocabulary.useLegacyConfig
set totrue
.- Returns:
true
iforg.eclipse.rdf4j.model.vocabulary.useLegacyConfig
system property is set totrue
,false
otherwise.- Since:
- 5.0.0
-
hasLegacyConfiguration
Verifies if the supplied configuration model uses any legacy vocabulary by checking the IRIs of its properties- Parameters:
configModel
- a configuration model- Returns:
true
if any property IRIs start withhttp://www.openrdf.org/config
,false
otherwise.
-
getResourceValue
@InternalUseOnly public static Optional<Resource> getResourceValue(Model model, Resource subject, IRI property, IRI legacyProperty) Retrieve a property value for the supplied subject as aResource
if present, falling back to a supplied legacy property .This method allows querying repository config models with a mix of old and new namespaces.
- Parameters:
model
- the model to retrieve property values from.subject
- the subject of the property.property
- the property to retrieve the value of.legacyProperty
- legacy property to use if the supplied property has no value in the model.- Returns:
- the resource value for supplied subject and property (or the legacy property ), if present.
-
getLiteralValue
@InternalUseOnly public static Optional<Literal> getLiteralValue(Model model, Resource subject, IRI property, IRI legacyProperty) Retrieve a property value for the supplied subject as aLiteral
if present, falling back to a supplied legacy property .This method allows querying repository config models with a mix of old and new namespaces.
- Parameters:
model
- the model to retrieve property values from.subject
- the subject of the property.property
- the property to retrieve the value of.legacyProperty
- legacy property to use if the supplied property has no value in the model.- Returns:
- the literal value for supplied subject and property (or the legacy property ), if present.
-
getValue
@InternalUseOnly public static Optional<Value> getValue(Model model, Resource subject, IRI property, IRI legacyProperty) Retrieve a property value for the supplied subject as aValue
if present, falling back to a supplied legacy property .This method allows querying repository config models with a mix of old and new namespaces.
- Parameters:
model
- the model to retrieve property values from.subject
- the subject of the property.property
- the property to retrieve the value of.legacyProperty
- legacy property to use if the supplied property has no value in the model.- Returns:
- the literal value for supplied subject and property (or the legacy property ), if present.
-
getPropertyValues
@InternalUseOnly public static Set<Value> getPropertyValues(Model model, Resource subject, IRI property, IRI legacyProperty) Retrieve all property values for the supplied subject as a Set of values and include all values for any legacy property.This method allows querying repository config models with a mix of old and new namespaces.
- Parameters:
model
- the model to retrieve property values from.subject
- the subject of the property.property
- the property to retrieve the values of.legacyProperty
- legacy property to retrieve values of.- Returns:
- the set of values for supplied subject and property (and/or legacy property).
-
getIRIValue
@InternalUseOnly public static Optional<IRI> getIRIValue(Model model, Resource subject, IRI property, IRI legacyProperty) Retrieve a property value for the supplied subject as aIRI
if present, falling back to a supplied legacy property .This method allows querying repository config models with a mix of old and new namespaces.
- Parameters:
model
- the model to retrieve property values from.subject
- the subject of the property.property
- the property to retrieve the value of.legacyProperty
- legacy property to use if the supplied property has no value in the model.- Returns:
- the IRI value for supplied subject and property (or the legacy property ), if present.
-
getSubjectByType
@InternalUseOnly public static Optional<Resource> getSubjectByType(Model model, IRI type, IRI legacyType) Retrieve the subject of the supplied type, falling back to a supplied legacy type.- Parameters:
model
- the model to retrieve property values from.type
- the type to retrieve the value of.legacyType
- legacy type to use if the supplied type has no value in the model.- Returns:
- The subject of the supplied type (or the legacy type), if present.
-