AGValueFactory (agraph-java-client 5.0.4-SNAPSHOT API)
Description: declaration: package: com.franz.agraph.repository, class: AGValueFactory

Package com.franz.agraph.repository

# Class AGValueFactory

java.lang.Object
org.eclipse.rdf4j.model.base.AbstractValueFactory
org.eclipse.rdf4j.model.impl.SimpleValueFactory
com.franz.agraph.repository.AGValueFactory

All Implemented Interfaces:
  `org.eclipse.rdf4j.model.ValueFactory`

public class AGValueFactory extends org.eclipse.rdf4j.model.impl.SimpleValueFactory
Implements the Sesame ValueFactory interface for AllegroGraph.

- ## Field Summary

  Fields
  Modifier and Type
  Field
  Description
  `String`
  `PREFIX_FOR_EXTERNAL_BNODES`

- ## Constructor Summary

  Constructors
  Constructor
  Description
  `AGValueFactory(AGRepository repository)`
  `AGValueFactory(AGRepository repository, AGRepositoryConnection conn)`

- ## Method Summary

  Modifier and Type
  Method
  Description
  `org.eclipse.rdf4j.model.Resource`
  `asResource(Node node)`
  `org.eclipse.rdf4j.model.IRI`
  `asURI(Node node)`
  `org.eclipse.rdf4j.model.Value`
  `asValue(Node node)`
  Creates an OpenRDF Value from a concrete Jena Node.
  `org.eclipse.rdf4j.model.BNode`
  `createBNode()`
  Returns a new blank node.
  `org.eclipse.rdf4j.model.BNode`
  `createBNode(String nodeID)`
  Returns a new blank node with the given id.
  `org.eclipse.rdf4j.model.IRI`
  `generateURI(String registeredEncodableNamespace)`
  Returns a unique URI within the specified encodable namespace.
  `org.eclipse.rdf4j.model.IRI[]`
  `generateURIs(String namespace, int amount)`
  Returns unique URIs within the specified encodable namespace.
  `String[]`
  `getBlankNodeIds()`
  Returns the array of fetched blank node ids
  `int`
  `getBlankNodesPerRequest()`
  Gets the number of blank nodes fetched per request.
  `AGHTTPClient`
  `getHTTPClient()`
  `AGRepository`
  `getRepository()`
  `boolean`
  `isAGBlankNodeId(String id)`
  Returns true iff id looks like an AG blank node id.
  `boolean`
  `isURIForExternalBlankNode(org.eclipse.rdf4j.model.Value v)`
  `void`
  `setBlankNodesPerRequest(int amount)`
  Sets the number of blank nodes to fetch per request.

  ### Methods inherited from class org.eclipse.rdf4j.model.impl.SimpleValueFactory

  `createIRI, createIRI, createLiteral, createLiteral, createLiteral, createLiteral, createLiteral, createLiteral, createLiteral, createLiteral, createLiteral, createLiteral, createLiteral, createLiteral, createLiteral, createLiteral, createStatement, createStatement, createTriple, getInstance`

  ### Methods inherited from class org.eclipse.rdf4j.model.base.AbstractValueFactory

  `createLiteral, createLiteral, createLiteral, createLiteral`

  ### Methods inherited from class java.lang.Object

  `equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

- ## Field Details

  - ### PREFIX_FOR_EXTERNAL_BNODES

    public String PREFIX_FOR_EXTERNAL_BNODES

- ## Constructor Details

  - ### AGValueFactory

    public AGValueFactory(AGRepository repository)

  - ### AGValueFactory

    public AGValueFactory(AGRepository repository, AGRepositoryConnection conn)

- ## Method Details

  - ### getRepository

    public AGRepository getRepository()

  - ### getHTTPClient

    public AGHTTPClient getHTTPClient()

  - ### getBlankNodesPerRequest

    public int getBlankNodesPerRequest()
    Gets the number of blank nodes fetched per request.
    Returns:
      int the number of blank nodes fetched per request

  - ### setBlankNodesPerRequest

    public void setBlankNodesPerRequest(int amount)
    Sets the number of blank nodes to fetch per request.

    This can be used to control the number and frequency of HTTP requests made when automatically obtaining new sets of blank node ids from the server.

    Defaults to the value of System property com.franz.agraph.repository.blankNodesPerRequest or to 100 if that property has not been set.

    Parameters:
      `amount` - a positive integer

  - ### getBlankNodeIds

    public String[] getBlankNodeIds()
    Returns the array of fetched blank node ids

    Primarily for testing purposes, not for use in apps.

    Returns:
      the array of fetched blank node ids

  - ### createBNode

    public org.eclipse.rdf4j.model.BNode createBNode(String nodeID)
    Returns a new blank node with the given id.

    Consider using createBNode() instead to get an AG-allocated id, it is safer (avoids unintended blank node conflicts) and can be stored more efficiently.

    If id is null or empty, returns a unique BNode with AG-allocated id; otherwise, returns a BNode with the given (a.k.a. "external") id (careful to avoid blank node conflicts). See the javadoc for allowing external blank nodes for more discussion.

    Specified by:
      `createBNode` in interface `org.eclipse.rdf4j.model.ValueFactory`
    Overrides:
      `createBNode` in class `org.eclipse.rdf4j.model.impl.SimpleValueFactory`
    See Also:
      - `AGHttpRepoClient.setAllowExternalBlankNodeIds(boolean)`
      - `AGRepositoryConnection.prepareHttpRepoClient()`

  - ### createBNode

    public org.eclipse.rdf4j.model.BNode createBNode()
    Returns a new blank node.

    If this value factory is for an AGRepository, returns a new BNode with an AG-allocated id; otherwise, returns a new BNode with an "external" id (using ValueFactoryImpl). See also the javadoc for allowing external blank nodes for more discussion.

    Specified by:
      `createBNode` in interface `org.eclipse.rdf4j.model.ValueFactory`
    Overrides:
      `createBNode` in class `org.eclipse.rdf4j.model.impl.SimpleValueFactory`
    See Also:
      - `AGHttpRepoClient.setAllowExternalBlankNodeIds(boolean)`
      - `AGRepositoryConnection.prepareHttpRepoClient()`

  - ### asValue

    public org.eclipse.rdf4j.model.Value asValue(Node node)
    Creates an OpenRDF Value from a concrete Jena Node.
    Parameters:
      `node` - a concrete Jena node
    Returns:
      the corresponding Value

  - ### isAGBlankNodeId

    public boolean isAGBlankNodeId(String id)
    Returns true iff id looks like an AG blank node id.

    AG blank node ids currently have the following form:

    b[store ID in hex]x[blank node number].

    There is nothing sacrosanct about this but it is unlikely to change.

    Parameters:
      `id` - the string to be tested
    Returns:
      true iff id looks like an AG blank node id

  - ### isURIForExternalBlankNode

    public boolean isURIForExternalBlankNode(org.eclipse.rdf4j.model.Value v)

  - ### asResource

    public org.eclipse.rdf4j.model.Resource asResource(Node node)

  - ### asURI

    public org.eclipse.rdf4j.model.IRI asURI(Node node)

  - ### generateURIs

    public org.eclipse.rdf4j.model.IRI[] generateURIs(String namespace, int amount) throws org.eclipse.rdf4j.repository.RepositoryException
    Returns unique URIs within the specified encodable namespace.

    The generated URIs will conform to the format that was specified when the encodable namespace was registered, and are guaranteed to be unique for this namespace generator. Note that this does not prevent other parties from independently using URIs that involve this namespace, however.

    If amount cannot be generated, up to amount URIs will be returned, or an exception will be thrown if none are available.

    Parameters:
      `namespace` - encodable namespace from which the URIs will be generated
      `amount` - the number of URIs to generate
    Returns:
      a unique URI within the specified namespace.
    Throws:
      `org.eclipse.rdf4j.repository.RepositoryException` - if there is an error with this request
    See Also:
      - `AGRepositoryConnection.registerEncodableNamespace(String, String)`
      - `generateURI(String)`

  - ### generateURI

    public org.eclipse.rdf4j.model.IRI generateURI(String registeredEncodableNamespace) throws org.eclipse.rdf4j.repository.RepositoryException
    Returns a unique URI within the specified encodable namespace.

    The generated URI will conform to the format that was specified when the encodable namespace was registered, and is guaranteed to be unique for this namespace generator. Note that this does not prevent other parties from independently using URIs that involve this namespace, however.

    Parameters:
      `registeredEncodableNamespace` - encodable namespace from which the URI will be generated
    Returns:
      a unique URI within the specified namespace.
    Throws:
      `org.eclipse.rdf4j.repository.RepositoryException` - if there is an error with this request
    See Also:
      - `AGRepositoryConnection.registerEncodableNamespace(String, String)`
      - `generateURIs(String, int)`