Class Configurations

java.lang.Object
org.eclipse.rdf4j.model.util.Configurations

@InternalUseOnly public class Configurations extends Object
Utility functions for working with RDF4J Models representing configuration settings.
Author:
Jeen Broekstra
  • Constructor Details

    • Configurations

      public Configurations()
  • Method Details

    • useLegacyConfig

      public static boolean useLegacyConfig()
      Verifies if use of legacy configuration vocabulary is preferred. Defaults to false. Can be set by having a system property org.eclipse.rdf4j.model.vocabulary.useLegacyConfig set to true.
      Returns:
      true if org.eclipse.rdf4j.model.vocabulary.useLegacyConfig system property is set to true, false otherwise.
      Since:
      5.0.0
    • hasLegacyConfiguration

      public static boolean hasLegacyConfiguration(Model configModel)
      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 with http://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 a Resource 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 a Literal 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 a Value 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 a IRI 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.