com.franz.ag
Class AllegroGraph

java.lang.Object
  extended bycom.franz.ag.AllegroGraph
All Implemented Interfaces:
ValueFactory

public class AllegroGraph
extends java.lang.Object
implements ValueFactory

Each instance of this class implements access to one AllegroGraph triple store.

There is no public constructor. Instances of this class are created by calls to methods in the AllegroGraphConnection class:

Triple Component Specification

The components of triples in update and search methods are usually declared as Object. In that case the argument may be: When a method argument may be an array, it must be an array of one of the above types.

The Context or Graph Component

AllegroGraph is a triple store implementations that allows triples to be identified by an additional component that may be a literal, a URI or a blank node. This component is sometimes called a context and sometimes a graph specifier. If this component is not specifed, triples are added to the null context, or the default graph. The terms null context and default graph are used interchangeably in the method descriptions.

In search operations, if the context is not specifed, then the search examines only the null context. If the context is specifed, then a null value is wild and matches any context, the empty string denotes the null context, any other value must be a valid Value reference.

The other components of triples may be specfied as strings in ntriple notation, Value instances, and UPI instances. In some cases null may be used to denote a wild card.


Nested Class Summary
static class AllegroGraph.V3_0_0_p1
          The name of this class identifies the version of the AllegroGraph Java implementation.
 
Constructor Summary
AllegroGraph(java.lang.String name)
          Create an unconnected AllegroGraph instance.
 
Method Summary
 void addDataMapping(java.lang.String[] map)
          Add to the table of datatype and property mappings in the triple store.
 void addIndexFlavors(java.lang.String[] flavors)
          Add some index flavors to the triple store.
 Literal addLiteral(boolean value)
          Create a typed Literal instance from a Java boolean value and add the Literal to the triple store registry.
 Literal addLiteral(byte value)
          Create a typed Literal instance from a Java byte value and add the Literal to the triple store registry.
 Literal addLiteral(double value)
          Create a typed Literal instance from a Java double value and add the Literal to the triple store registry.
 Literal addLiteral(float value)
          Create a typed Literal instance from a Java float value and add the Literal to the triple store registry.
 Literal addLiteral(int value)
          Create a typed Literal instance from a Java int value and add the Literal to the triple store registry.
 Literal addLiteral(long value)
          Create a typed Literal instance from a Java long value and add the Literal to the triple store registry.
 Literal addLiteral(short value)
          Create a typed Literal instance from a Java short value and add the Literal to the triple store registry.
 Literal addLiteral(java.lang.String value)
          Create a literal instance and add the Literal to the triple store registry.
 Literal addLiteral(java.lang.String value, java.lang.String language)
          Create a literal instance with a language tag and add the Literal to the triple store registry.
 Literal addLiteral(java.lang.String value, URI datatype)
          Create a literal instance with a datatype tag and add the Literal to the triple store registry.
 UPI[] addLiteralIds(java.lang.String[] values, java.lang.String[] datatypes, java.lang.String[] languages)
          Add a set of literal instances to the triple store registry.
 Literal[] addLiterals(java.lang.String[] values, java.lang.String[] datatypes, java.lang.String[] languages)
          Create a set of Literal instances and add the literals to the triple store registry.
 ValueNode addPart(java.lang.String part)
          Add a Literal, Node or BlankNode to the triple store.
 void addStatement(java.lang.Object subject, java.lang.Object predicate, java.lang.Object object)
          Add a Statement in the null context to the triple store.
 void addStatement(java.lang.Object subject, java.lang.Object predicate, java.lang.Object object, java.lang.Object context)
          Add a Statement to the triple store.
 void addStatements(java.lang.Object subject, java.lang.Object predicate, java.lang.Object object)
          Add several null context Statements to the triple store.
 void addStatements(java.lang.Object subject, java.lang.Object predicate, java.lang.Object object, java.lang.Object contexts)
          Add several Statements to the triple store.
 Literal addTypedLiteral(java.lang.String text, java.lang.String type)
          Create a typed Literal instance from a string and add the Literal to the triple store registry.
 Literal addTypedLiteral(java.lang.String text, UPI type)
          Create a typed Literal instance from a string and add the literal to the triple store registry.
 Literal addTypedLiteral(java.lang.String text, URI type)
          Create a typed Literal instance from a string and add the literal to the triple store registry.
 Node addURI(java.lang.String uri)
          Create a resource node with a URI label and add the resource to the triple store registry.
 UPI[] addURIIds(java.lang.String[] uri)
          Create a set of resource nodes in the triple store registry.
 URI[] addURIs(java.lang.String[] uri)
          Create a set of resource Node instances and add the resources to the triple store registry.
 void clear()
          Delete all the statements in the triple store (one-by-one).
 void closeDatabase()
          Deprecated. Use closeTripleStore() instead.
 boolean closeTripleStore()
          Close an AllegroGraph instance.
 boolean closeTripleStore(boolean doClose)
          Close an AllegroGraph instance and optionally close the triple store if this is the only reference.
 BNode createBNode()
          Create a BlankNode instance.
 BNode createBNode(java.lang.String nodeId)
          Create a BlankNode instance.
 UPI[] createBNodeIds(int n)
          Allocate a set of BlankNode ID numbers.
 BlankNode[] createBNodes(int n)
          Allocate a set of BlankNodes.
 EncodedLiteral createEncodedLiteral(double v, java.lang.String encoding)
          Create an AllegroGraph EncodedLiteral instance from a Java double value.
 EncodedLiteral createEncodedLiteral(long v, java.lang.String encoding)
          Create an AllegroGraph EncodedLiteral instance from a Java long value.
 EncodedLiteral createEncodedLiteral(java.lang.String v, java.lang.String encoding)
          Create an AllegroGraph EncodedLiteral instance from a Java string value.
 Literal createLiteral(boolean value)
          Create a typed Literal instance from a Java boolean value but do not modify the triple store.
 Literal createLiteral(byte value)
          Create a typed Literal instance from a Java byte value but do not modify the triple store.
 Literal createLiteral(double value)
          Create a typed Literal instance from a Java double value but do not modify the triple store.
 Literal createLiteral(float value)
          Create a typed Literal instance from a Java float value but do not modify the triple store.
 Literal createLiteral(int value)
          Create a typed Literal instance from a Java int value but do not modify the triple store.
 Literal createLiteral(long value)
          Create a typed Literal instance from a Java long value but do not modify the triple store.
 Literal createLiteral(short value)
          Create a typed Literal instance from a Java short value but do not modify the triple store.
 Literal createLiteral(java.lang.String value)
          Create a literal instance without updating the triple store.
 Literal createLiteral(java.lang.String value, java.lang.String language)
          Create a literal instance with a language tag but do not modify the triple store.
 Literal createLiteral(java.lang.String value, URI datatype)
          Create a literal instance with a datatype tag but do not modify the triple store.
 Statement createStatement(Resource subject, URI predicate, Value object)
          Create a Null Context Statement instance but do not update the triple store.
 Statement createStatement(Resource subject, URI predicate, Value object, Resource context)
          Create a Statement instance but do not update the triple store.
 Literal createTypedLiteral(java.lang.String text, java.lang.String type)
          Create a typed Literal instance from a string but do not modify the triple store.
 Literal createTypedLiteral(java.lang.String text, UPI type)
          Create a typed Literal instance from a string but do not modify the triple store.
 URI createURI(java.lang.String uri)
          Create a resource node with a URI label but do not modify the triple store.
 URI createURI(java.lang.String namespace, java.lang.String localName)
          Create a resource node with a URI label but do not modify the triple store.
 void dropIndexFlavors(java.lang.String[] flavors)
          Delete some indexing flavors from the triple store.
 java.lang.Object[] evalInServer(java.lang.String expression)
          Evaluate a Lisp expression in the AllegroGraph server.
 java.lang.String[] getDataMapping()
          Query the current table of datatype and property mappings in the triple store.
 java.lang.String[] getFreetextPredicates()
          Retrieve the URI labels of the registered freetext predicates.
 Cursor getFreetextStatements(java.lang.String pattern)
          Find triples that match a text pattern.
 ValueObject[] getFreetextUniqueSubjects(java.lang.String pattern)
          Collect the unique subjects from triples that match a text pattern.
 GeoExtension getGeoExtension()
          Get the GeoExtension instance of this AllegroGraph instance.
 java.lang.String[] getIndexFlavors()
          Query the range of indexing that is applied to this triple store.
 int getLookAhead()
          Query the look-ahead value.
 NamespaceRegistry getNamespaceRegistry()
          Query the namespace definitions specific to this triple store.
 java.lang.String[] getNamespaces()
          Query the namespace definitions specific to this triple store.
 java.lang.String[] getParts(UPI id)
          Retrieve the string and type information associated with a triple store part.
 void getParts(UPI[] ids, java.lang.String[] types, java.lang.String[] vals, java.lang.String[] mods)
          Like getParts(UPI) but operates on an array of UPI instances.
 int getSelectLimit()
          Get the current value of the select limit parameter.
 SNAExtension getSNAExtension()
          Get the SNAExtension instance of this AllegroGraph instance.
 Cursor getStatements(boolean includeInferred, java.lang.Object subject, java.lang.Object predicate, java.lang.Object object)
          Retrieve null context statements from the triple store.
 Cursor getStatements(boolean includeInferred, java.lang.Object subject, java.lang.Object predicate, java.lang.Object object, java.lang.Object context)
          Retrieve statements from the triple store.
 Cursor getStatements(boolean includeInferred, java.lang.Object subject, java.lang.Object predicate, java.lang.Object object, java.lang.Object obEnd, java.lang.Object context, java.lang.Object contextEnd)
          Retrieve statements from the triple store and specify a range of values for the object and/or context components of the triples.
 Cursor getStatements(boolean includeInferred, java.lang.Object subject, java.lang.Object subEnd, java.lang.Object predicate, java.lang.Object predEnd, java.lang.Object object, java.lang.Object obEnd, java.lang.Object context, java.lang.Object contextEnd)
          Retrieve statements from the triple store and specify a range of values for any of the components of the triples.
 Cursor getStatements(java.lang.Object subject, java.lang.Object predicate, java.lang.Object object)
          Retrieve null context statements from the triple store.
 Cursor getStatements(java.lang.Object subject, java.lang.Object predicate, java.lang.Object object, java.lang.Object context)
          Retrieve statements from the triple store .
 Cursor getStatements(java.lang.Object subject, java.lang.Object predicate, java.lang.Object object, java.lang.Object obEnd, java.lang.Object context, java.lang.Object contextEnd)
          Retrieve statements from the triple store and specify a range of values for the object and/or context components of the triples.
 AllegroGraph[] getStores()
          Retrieve the components of a federated triple store.
 boolean getSyncEveryTime()
          Query the synchronization mode for this AllegroGraph instance.
 UPI[] getTripleParts(long id)
          Return an array of 4 UPI instances for subject, predicate, object, and context.
 int getUnindexedThreshold()
          Query the threshold for automatic indexing of the triple store.
 int getUnindexedTripleCount()
          Query the number of unindexed triples in the triple store.
 int getUnmergedCount()
          Query the number of unmerged index chunks in the triple store.
 int getUnmergedThreshold()
          Query the threshold for automatic re-indexing of the triple store.
 boolean hasStatement(boolean includeInferred, java.lang.Object subject, java.lang.Object predicate, java.lang.Object object)
          Find out if null-context statements matching the arguments are in the triple store.
 boolean hasStatement(boolean includeInferred, java.lang.Object subject, java.lang.Object predicate, java.lang.Object object, java.lang.Object context)
          Find out if any statements matching the arguments are in the triple store.
 boolean hasStatement(java.lang.Object subject, java.lang.Object predicate, java.lang.Object object)
          Find out if null-context statements matching the arguments are in the triple store.
 boolean hasStatement(java.lang.Object subject, java.lang.Object predicate, java.lang.Object object, java.lang.Object context)
          Find out if any statements matching the arguments are in the triple store.
 void indexAll()
          Deprecated. Use indexAllTriples() instead
 void indexAllTriples()
          Index all the triples in the triple store.
 void indexAllTriples(boolean wait)
          Index all triples immediately or in the background.
 void indexNewTriples()
          Index new triples.
 void indexNewTriples(boolean wait)
          Index new triples immediately or in the background.
 void indexTriples()
          Deprecated. Use indexNewTriples() instead
 long loadNTriples(java.lang.Object names, java.lang.Object context, java.lang.Boolean save, java.lang.String ext, java.lang.Object[] place)
          Load one or more files of triple declarations.
 long loadNTriples(java.lang.String name)
          Load a file of triple declarations.
 long loadNTriples(java.lang.String[] names)
          Load several files of triple declarations.
 long loadNTriples(java.lang.String[] names, java.lang.Object context)
          Load several files of triple declarations.
 long loadNTriples(java.lang.String name, java.lang.Object context)
          Load a file of triple declarations.
 long loadRDF(java.lang.String filePath)
          Parse an XML file of RDF triple definitions and add the triples to the null context of the triple store.
 long loadRDF(java.lang.String[] filePaths)
          Parse a set of XML files of RDF triple definitions and add the triples to the null context of the triple store.
 long loadRDF(java.lang.String filePath, java.lang.Object context)
          Parse an XML file of RDF triple definitions and add the triples to the specified context of the triple store.
 long loadRDF(java.lang.String filePath, java.lang.Object context, java.lang.String baseURI)
          Parse an XML file of RDF triple definitions and add the triples to the specified context of the triple store.
static void main(java.lang.String[] args)
          Print AllegroGraph version information.
 int moreValues(java.lang.Object x)
          Determine if more results are available for a selectValues(String) result.
 Triple newTriple(java.lang.Object s, java.lang.Object p, java.lang.Object o)
          Add a new triple to the triple store.
 Triple newTriple(java.lang.Object s, java.lang.Object p, java.lang.Object o, java.lang.Object c)
          Add a new triple to the triple store.
 long newTripleId(java.lang.Object s, java.lang.Object p, java.lang.Object o)
          Add a new triple to the triple store.
 long newTripleId(java.lang.Object s, java.lang.Object p, java.lang.Object o, java.lang.Object c)
          Add a new triple to the triple store.
 long[] newTripleIds(java.lang.Object s, java.lang.Object p, java.lang.Object o)
          Add new triples to the triple store.
 long[] newTripleIds(java.lang.Object s, java.lang.Object p, java.lang.Object o, java.lang.Object c)
          Add new triples to the triple store.
 Triple[] newTriples(java.lang.Object s, java.lang.Object p, java.lang.Object o)
          Add new triples to the triple store.
 Triple[] newTriples(java.lang.Object s, java.lang.Object p, java.lang.Object o, java.lang.Object c)
          Add new triples to the triple store.
 ValueObject newValue(UPI id)
          Convert a UPI instance into a ValueObject instance.
 long numberOfTriples()
          Query the number of triples in the triple store.
 long parseNTriples(java.lang.String from)
          Parse a string and add triples to the null context of triple store.
 long parseNTriples(java.lang.String from, java.lang.Object context)
          Parse a string and add triples to the specified context of the triple store.
 long parseNTriples(java.lang.String from, java.lang.Object context, java.lang.Boolean save, java.lang.Object[] place)
          Parse a string and add triples to the specified context of the triple store.
 void registerFreetextPredicate(java.lang.Object predicate)
          Register a predicate for freetext indexing.
 void registerNamespace(java.lang.String prefix, java.lang.String full)
          Register one namespace definition for this triple store.
 void registerNamespaces(java.lang.String[] defs)
          Register several namespace definitions for this triple store.
 void removeStatement(java.lang.Object s, java.lang.Object p, java.lang.Object o)
          Remove one null-context statement from the triple store.
 void removeStatement(java.lang.Object s, java.lang.Object p, java.lang.Object o, java.lang.Object c)
          Remove one statement from the triple store.
 void removeStatements(java.lang.Object s, java.lang.Object p, java.lang.Object o)
          Remove all statement that match a pattern from the triple store.
 void removeStatements(java.lang.Object s, java.lang.Object p, java.lang.Object o, java.lang.Object c)
          Remove all statement that match a pattern from the triple store.
 Cursor select(java.lang.String query)
          Deprecated. Use selectStatements(String) instead
 Cursor select(java.lang.String query, java.lang.Object arg)
          Deprecated. Use selectStatements(String,Object) instead
 Cursor select(java.lang.String query, java.lang.Object arg, java.lang.String svar)
          Deprecated. Use selectStatements(String,Object,String) instead
 ValueObject[] selectMore(ValueObject[] sr)
          Get more results from a previous selectSingleValues query.
 ValueObject[][] selectMore(ValueObject[][] sr)
          Get more results from a previous selectValues query.
 ValueObject[] selectSingleValues(boolean includeInferred, boolean distinct, java.lang.String query, java.lang.Object[] invals, java.lang.String invars)
          Evaluate a Prolog query that retrieves a single value in each success.
 ValueObject[] selectSingleValues(java.lang.String query, java.lang.Object[] invals, java.lang.String invars)
          Evaluate a Prolog query that retrieves a single value in each success.
 Cursor selectStatements(boolean includeInferred, boolean distinct, java.lang.String query, java.lang.Object arg, java.lang.String svars)
          Search the AllegroGraph triple store with a Prolog query.
 Cursor selectStatements(java.lang.String query)
          Search the AllegroGraph triple store with a Prolog query.
 Cursor selectStatements(java.lang.String query, java.lang.Object arg)
          Search the AllegroGraph triple store with a Prolog query.
 Cursor selectStatements(java.lang.String query, java.lang.Object arg, java.lang.String svars)
          Search the AllegroGraph triple store with a Prolog query.
 ValueObject[][] selectValues(boolean includeInferred, boolean distinct, java.lang.String query)
          Evaluate a Prolog query that retrieves triples, resources, or literals from the triple store.
 ValueObject[][] selectValues(boolean includeInferred, boolean distinct, java.lang.String query, java.lang.Object[] invals, java.lang.String invars)
          Evaluate a Prolog query that retrieves triples, resources, or literals from the triple store.
 ValueObject[][] selectValues(java.lang.String query)
          Evaluate a Prolog query that retrieves triples, resources, or literals from the triple store.
 ValueObject[][] selectValues(java.lang.String query, java.lang.Object[] invals, java.lang.String invars)
          Evaluate a Prolog query that retrieves triples, resources, or literals from the triple store.
 int serverTrace(boolean onoff)
          Change the trace state in the AllegroGraph server.
 int serverTrace(java.lang.String outFile)
          Start tracing calls from Java in the AllegroGraph server.
 void setAttribute(java.lang.String name, java.lang.Object value)
          Set attributes that affect the creation of new triple stores or the accessing of existing ones.
 void setDataMapping(java.lang.String[] map)
          Replace the current table of datatype and property mappings in the triple store.
 void setIndexFlavors(java.lang.String[] flavors)
          Replace the set of indexing flavors in the triple store.
 void setLookAhead(int n)
          Set the look-ahead value for subsequent Statement search operations.
 void setNamespaceRegistry()
          Reset the namespace definition in this AllefroGraph instance to the initial default.
 void setNamespaceRegistry(NamespaceRegistry ns)
          Register several namespace definitions for this triple store.
 void setSelectLimit(int v)
          Set the value of the select limit parameter.
 void setSyncEveryTime(boolean s)
          Set the synchronization mode for this AllegroGraph instance.
 void setUnindexedThreshold(int val)
          Set the threshold for automatic indexing of the triple store.
 void setUnmergedThreshold(int val)
          Set the threshold for automatic re-indexing of the triple store.
 void syncDatabase()
          Deprecated. Use syncTripleStore() instead.
 void syncTripleStore()
          Sync an AllegroGraph triple store.
 java.lang.String toString()
          Display some details about the AllegroGraph instance.
 boolean twinqlAsk(java.lang.String query)
          Deprecated. Use the methods in SPARQLQuery instead.
 long twinqlCount(java.lang.String query, java.lang.String vars, int limit, int offset)
          Deprecated. Use the methods in SPARQLQuery instead.
 Cursor twinqlFind(java.lang.String query, int limit, int offset)
          Deprecated. Use the methods in SPARQLQuery instead.
 java.lang.String twinqlQuery(java.lang.String query, java.lang.String format, int limit, int offset)
          Deprecated. Use the methods in SPARQLQuery instead.
 ValueObject[][] twinqlSelect(boolean includeInferred, java.lang.String query, java.lang.String vars, int limit, int offset)
          Deprecated. Use the methods in SPARQLQuery instead.
 ValueObject[][] twinqlSelect(java.lang.String query, java.lang.String vars, int limit, int offset)
          Deprecated. Use the methods in SPARQLQuery instead.
 java.lang.String[] valueNames(java.lang.Object x)
          Get the names of the variables in query.
 int valuesLength(ValueObject[][] x)
          Return the number of result sets in the array returned by selectValues(String).
static java.lang.String version()
          Query the current AllegroGraph version.
static java.lang.String[] versions()
          Query the current AllegroGraph and component versions.
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

AllegroGraph

public AllegroGraph(java.lang.String name)
Create an unconnected AllegroGraph instance. This constructor is useful if attributes need to be set before the triple store is opened or created.

Parameters:
name - the pathname string for the triple store.
See Also:
setAttribute(String, Object)
Method Detail

version

public static java.lang.String version()
Query the current AllegroGraph version.

Returns:
a version string.

versions

public static java.lang.String[] versions()
Query the current AllegroGraph and component versions.

Returns:
An array of strings for the AllegroGraph version, the server protocol level, and the socket protocol level.

main

public static void main(java.lang.String[] args)
Print AllegroGraph version information.


setLookAhead

public void setLookAhead(int n)
Set the look-ahead value for subsequent Statement search operations.

Parameters:
n - an integer look-ahead value - must be positive. A zero value specifies that the defaultLookAhead value in the Cursor class should be used.

The look-ahead value determines how many Statements will be pre-loaded into a Cursor instance when it is created or advanced. The pre-loaded Statements in the Cursor are retrieved immediately in Java without a round-trip to the AllegroGraph server.

See Also:
Cursor.setLookAhead(int)

getLookAhead

public int getLookAhead()
Query the look-ahead value.

Returns:
an integer
See Also:
setLookAhead(int)

setAttribute

public void setAttribute(java.lang.String name,
                         java.lang.Object value)
Set attributes that affect the creation of new triple stores or the accessing of existing ones. These attributes must be set before one of the connection methods is called since they only take effect during the creation or opening of a triple store.

Parameters:
name - The name of the attribute.
value - The value of the attribute. Attribute names are listed below as well as the required datatype of the value:
  • "expected-unique-resouces" -- Long -- The initial size of the resource table in a new triple store.
  • "with-indices" -- String[] -- The desired indices for a new triple store.
  • "include-standard-parts" -- Boolean -- When true, create some commonly used RDF and Owl resources in a new triple store.
  • "read-only" -- Boolean -- When true, open an existing triple store in read-only mode.
  • "indirect-host" -- String -- A hostname where the server will find a remote triple store. When an inirect-host is specified, the name and directory arguments are relative to the location of the remote host.
  • "indirect-port" -- Integer -- The port number where the indirect-host is listening.

syncTripleStore

public void syncTripleStore()
                     throws AllegroGraphException
Sync an AllegroGraph triple store.

Throws:
AllegroGraphException

closeTripleStore

public boolean closeTripleStore()
                         throws AllegroGraphException
Close an AllegroGraph instance. Since many other users may be using this same triple store, closing the AllegroGraph instance does not actually close the triple store but only synchronizes the store and invalidates this access instance unless this is the only instance accessing the store.

Throws:
AllegroGraphException

closeTripleStore

public boolean closeTripleStore(boolean doClose)
                         throws AllegroGraphException
Close an AllegroGraph instance and optionally close the triple store if this is the only reference.

Parameters:
doClose - when true, close the triple-store if this is the only reference.
Returns:
true if the triple store is known to be closed.
Throws:
AllegroGraphException

loadNTriples

public long loadNTriples(java.lang.String name)
                  throws AllegroGraphException
Load a file of triple declarations. The triples are added in the null context of the triple store.

Parameters:
name - - a pathname string. The file must be in the ntriples format expected by the AllegroGraph server.

If a file is very large, the operation may take a long time. During that time, the calling thread, and the AllegroGraphConnection instance are blocked. On Windows, it is possible to see progress messages in the server console window which is normally hidden. On Unix, the server progress messages may be seen if the server is running with a log file; in that case the log file will grow as progress messages are added.

If other AllegroGraph instances of different stores are connected through different AllegroGraphConnection instances, they may continue to make queries or add triples.

Throws:
AllegroGraphException

loadNTriples

public long loadNTriples(java.lang.String name,
                         java.lang.Object context)
                  throws AllegroGraphException
Load a file of triple declarations. The triples are added in the specified context.

Parameters:
name - a pathname string pointing to the source file.
context - a triple part reference for the graph component of the new triples.

See the note about progress messages in the description of

Throws:
AllegroGraphException
See Also:
loadNTriples(String)

loadNTriples

public long loadNTriples(java.lang.String[] names)
                  throws AllegroGraphException
Load several files of triple declarations. The triples are added in the null context of the triple store.

Parameters:
names - - an array of pathname string. The files must be in the ntriples format expected by the AllegroGraph server.

See the note about progress messages in the description of

Throws:
AllegroGraphException
See Also:
loadNTriples(String)

loadNTriples

public long loadNTriples(java.lang.String[] names,
                         java.lang.Object context)
                  throws AllegroGraphException
Load several files of triple declarations. The triples are added in the specified context.

Parameters:
names - - an array of pathname string. The files must be in the ntriples format expected by the AllegroGraph server.
context - a triple part reference for the graph component of the new triples.

See the note about progress messages in the description of

Throws:
AllegroGraphException
See Also:
loadNTriples(String)

loadNTriples

public long loadNTriples(java.lang.Object names,
                         java.lang.Object context,
                         java.lang.Boolean save,
                         java.lang.String ext,
                         java.lang.Object[] place)
                  throws AllegroGraphException
Load one or more files of triple declarations. The triples are added in the specified context.

Parameters:
names - - a string pointing to one file, or an array of pathname string. The files must be in the ntriples format expected by the AllegroGraph server.
context - a triple part reference for the graph component of the new triples.
save - This argument controls how encoded literals are stored in the store. When true, if a triple triggers an ecoding of a literal, two triples are added to the store, one with the encoded literal and one with the string literal. When false, only the encoded triple is added. When null, allow the default behavior (currently to add both).
ext - A string that names the external-format used to translate octets into characters. The server default is determined by the locale of the server. Valid values are
     "1250" "1251" "1252" "1253" "1254" "1255" "1256" "1257" "1258" 
     "874"  "932"  "936"  "949"  "950"  "big5" "emacs-mule" 
     "euc"  "euc-jp"      "fat"  "fat-le"      "gb2312"      "gbk" 
     "iso-2022-jp"        "iso8859-1"          "iso8859-14"  "iso8859-15"  
     "iso8859-2"          "iso8859-3"          "iso8859-4"   "iso8859-5"  
     "iso8859-6"          "iso8859-7"          "iso8859-8"   "iso8859-9"  
     "jis"                "jvm-utf8"           "koi8-r"      "latin-14"  
     "latin-15"           "latin-2"            "latin-3"     "latin-4"  
     "latin-5"            "latin-6"            "latin-7"     "latin-8"  
     "latin-9"            "latin1"             "latin14"     "latin15"  
     "latin2"             "latin3"             "latin4"      "latin5"  
     "latin6"             "latin7"             "latin8"      "latin9"  
     "shiftjis"           "ujis"               "unicode"     "utf8"
      
The numeric strings refer to Windows Code Page encodings.
place - When non-null, must be an array of at least one Object. The array element zero is updated with the UPI of the graph component of all the triples added by the bulk load.

See the note about progress messages in the description of

Throws:
AllegroGraphException
See Also:
loadNTriples(String)

parseNTriples

public long parseNTriples(java.lang.String from)
                   throws AllegroGraphException
Parse a string and add triples to the null context of triple store. The string must be in the ntriples format expected by the AllegroGraph server.

Parameters:
from - a string in ntriples format
Throws:
AllegroGraphException

parseNTriples

public long parseNTriples(java.lang.String from,
                          java.lang.Object context)
                   throws AllegroGraphException
Parse a string and add triples to the specified context of the triple store. The string must be in the ntriples format expected by the AllegroGraph server.

Parameters:
from - a string in ntriples format
context - a string, UPI instance, Value instance or null.
Throws:
AllegroGraphException

parseNTriples

public long parseNTriples(java.lang.String from,
                          java.lang.Object context,
                          java.lang.Boolean save,
                          java.lang.Object[] place)
                   throws AllegroGraphException
Parse a string and add triples to the specified context of the triple store. The string must be in the ntriples format expected by the AllegroGraph server.

Parameters:
from - from a string in ntriples format
context - a string, UPI instance, Value instance or null.
save - if true, save both the string form and the encoded form of encoded literal. If false, save only the encoded form. Literal that are not subject ot encoding are not affected.
place - null or an Object array of length at least one. The array (if present) element zero is updated with the UPI of the actual context marker used.
Returns:
the number of triples added.
Throws:
AllegroGraphException

loadRDF

public long loadRDF(java.lang.String filePath)
             throws AllegroGraphException
Parse an XML file of RDF triple definitions and add the triples to the null context of the triple store.

Parameters:
filePath - A string that points to the file. The file must be in the RDF format expected by the AllegroGraph server.
Returns:
the number of triples added to the store

See the note about progress messages in the description of loadNTriples(String).

Throws:
AllegroGraphException

loadRDF

public long loadRDF(java.lang.String filePath,
                    java.lang.Object context)
             throws AllegroGraphException
Parse an XML file of RDF triple definitions and add the triples to the specified context of the triple store.

Parameters:
filePath - A string that points to the file. The file must be in the RDF format expected by the AllegroGraph server.
context - a String or instance that identifies a triple part to be used as the context marker for all the triples. If the context is specified as "source", a URI is constructed from the source file path.
Returns:
the number of triples added to the store

See the note about progress messages in the description of loadNTriples(String).

Throws:
AllegroGraphException

loadRDF

public long loadRDF(java.lang.String filePath,
                    java.lang.Object context,
                    java.lang.String baseURI)
             throws AllegroGraphException
Parse an XML file of RDF triple definitions and add the triples to the specified context of the triple store.

Parameters:
filePath - A string that points to the file. The file must be in the RDF format expected by the AllegroGraph server.
context - a String or instance that identifies a triple part to be used as the context marker for all the triples. If the context is specified as "source", a URI is constructed from the source file path.
baseURI - a string that specifies a base URI for the file.
Returns:
the number of triples added to the store

See the note about progress messages in the description of loadNTriples(String).

Throws:
AllegroGraphException

loadRDF

public long loadRDF(java.lang.String[] filePaths)
             throws AllegroGraphException
Parse a set of XML files of RDF triple definitions and add the triples to the null context of the triple store.

Parameters:
filePaths - an array of file pathname strings. The files are loaded in the order specified.
Returns:
the number of triples added to the store
Throws:
AllegroGraphException

numberOfTriples

public long numberOfTriples()
                     throws AllegroGraphException
Query the number of triples in the triple store.

Returns:
the number of triples in the triple store.
Throws:
AllegroGraphException

indexNewTriples

public void indexNewTriples()
                     throws AllegroGraphException
Index new triples.

Throws:
AllegroGraphException - if an error occurs during indexing.

If the current indexing chunk size is too small, it can cause too many files to be opened during indexing; in that case the AllegroGraphException exception with the string "too-many-index-chunks-error: will create nnn files" is thrown; nnn is the number of chunks. At this point, the triple store has not been indexed, but the server is in a stable state. The Application can adjust the chunk size with AllegroGraphConnection.setChunkSize() and try the indexing call again.

If the current indexing chunk size is too large, the server may run out of memory during indexing; in that case, the thrown exception will depend on where and when the out-of-memory condition occurred. The triple store may be in a partially indexed state.


indexNewTriples

public void indexNewTriples(boolean wait)
                     throws AllegroGraphException
Index new triples immediately or in the background.

Parameters:
wait - If true, then return only after indexing is completed. If false, schedule an indexing task to run in the background and return immediately.
Throws:
AllegroGraphException

indexAllTriples

public void indexAllTriples()
                     throws AllegroGraphException
Index all the triples in the triple store.

Throws:
AllegroGraphException - if an error occurs during indexing.

See the discussion of chunk size at indexNewTriples().


indexAllTriples

public void indexAllTriples(boolean wait)
                     throws AllegroGraphException
Index all triples immediately or in the background.

Parameters:
wait - If true, then return only after indexing is completed. If false, schedule an indexing task to run in the background and return immediately.
Throws:
AllegroGraphException

newValue

public ValueObject newValue(UPI id)
Convert a UPI instance into a ValueObject instance.

Parameters:
id - A UPI instance that denotes a Resource or Literal object
Returns:
The Resource or Literal object instance.
Throws:
java.lang.IllegalStateException - if the object could not be created.

getParts

public java.lang.String[] getParts(UPI id)
                            throws AllegroGraphException
Retrieve the string and type information associated with a triple store part.

Parameters:
id - A UPI instance that identifies a triple store part.
Returns:
An array of three strings:
  • A string that identifies the type of the object:
    • "anon" - A blank node
    • "node" - A resource node
    • "literal" - A literal node
    • "literal/lang" - A literal node with a language tag
    • "typed-literal" - A literal node with a type tag
    • "unknown" - The id is not in the triple store
  • A string that contains the URI or literal data associated with the object
  • A string that contains additional data, ie a language or a type tag
If the object does not have the component, then the array element is null.
Throws:
AllegroGraphException

getTripleParts

public UPI[] getTripleParts(long id)
                     throws AllegroGraphException
Return an array of 4 UPI instances for subject, predicate, object, and context.

Throws:
AllegroGraphException

getParts

public void getParts(UPI[] ids,
                     java.lang.String[] types,
                     java.lang.String[] vals,
                     java.lang.String[] mods)
              throws AllegroGraphException
Like getParts(UPI) but operates on an array of UPI instances.

Parameters:
ids - an array of UPI instances
types - a String array of the same length as ids.
vals - a String array of the same length as ids.
mods - a String array of the same length as ids.

The arrays types, vals, mods are modified to hold the string values corresponding to the id number in the ids array.

Throws:
AllegroGraphException

getSelectLimit

public int getSelectLimit()
Get the current value of the select limit parameter.

Returns:
an integer value.

This number determines the number of values transmitted in one set of results from the AllegroGraph server to the Java client. If the number of expected results is very large, but the application is interested in only a few, then a small number may improve performance. If the number is very large, there may be a long delay as the large array of results is prepared and transmitted to the client. The total numer of actual values returned depends on the number of free variables in the query.

The built-in initial value is 1000.


setSelectLimit

public void setSelectLimit(int v)
Set the value of the select limit parameter.

Parameters:
v - A positive integer.
See Also:
getSelectLimit()

createBNode

public BNode createBNode()
Create a BlankNode instance.

Specified by:
createBNode in interface ValueFactory
Returns:
a value that can be safely cast to BlankNode
Throws:
java.lang.IllegalStateException - if the creation fails.

It does not make sense to create a BNode that is not registered in the triple store because two instances of apparently identical unregistered BNodes would map to distinct BNodes in the triple store.


createBNode

public BNode createBNode(java.lang.String nodeId)
Create a BlankNode instance.

Specified by:
createBNode in interface ValueFactory
Parameters:
nodeId - the bnode identifier
Returns:
a value that can be safely cast to BlankNode
Throws:
java.lang.IllegalStateException - if the creation fails.

See note on createBNode().


createBNodes

public BlankNode[] createBNodes(int n)
                         throws AllegroGraphException
Allocate a set of BlankNodes.

Parameters:
n - the number of nodes to allocate.
Returns:
an array of BlankNode instances.
Throws:
AllegroGraphException - if there is a problem during creation.

See note on createBNode().


createEncodedLiteral

public EncodedLiteral createEncodedLiteral(long v,
                                           java.lang.String encoding)
Create an AllegroGraph EncodedLiteral instance from a Java long value.

Parameters:
v - The Java long value.
encoding - A string that specifies the AllegroGraph encoding desired. The available encodings are described in the AllegroGraph Introduction document.
Returns:
an EncodedLiteral instance that can be used in query ir update operations.

createEncodedLiteral

public EncodedLiteral createEncodedLiteral(double v,
                                           java.lang.String encoding)
Create an AllegroGraph EncodedLiteral instance from a Java double value.

Parameters:
v - The Java double value.
encoding - A string that specifies the AllegroGraph encoding desired. The available encodings are described in the AllegroGraph Introduction document.
Returns:
an EncodedLiteral instance that can be used in query ir update operations.

createEncodedLiteral

public EncodedLiteral createEncodedLiteral(java.lang.String v,
                                           java.lang.String encoding)
Create an AllegroGraph EncodedLiteral instance from a Java string value.

Parameters:
v - The Java string value.
encoding - A string that specifies the AllegroGraph encoding desired. The available encodings are described in the AllegroGraph Introduction document.
Returns:
an EncodedLiteral instance that can be used in query ir update operations.

createLiteral

public Literal createLiteral(java.lang.String value)
Create a literal instance without updating the triple store.

Specified by:
createLiteral in interface ValueFactory
Parameters:
value - The literal's value.
Returns:
a value that can be safely cast to Literal

The literal instance will have a null UPI.


addLiteral

public Literal addLiteral(java.lang.String value)
Create a literal instance and add the Literal to the triple store registry.

Returns:
a Literal instance that can be safely cast to com.franz.ag.Literal
Throws:
java.lang.IllegalStateException - if the creation fails.

createLiteral

public Literal createLiteral(java.lang.String value,
                             java.lang.String language)
Create a literal instance with a language tag but do not modify the triple store.

Specified by:
createLiteral in interface ValueFactory
Parameters:
value - The literal's value.
language - The literal's language attribute, or null if the literal doesn't have a language.
Returns:
a value that can be safely cast to Literal

The literal instance will have a null UPI.


addLiteral

public Literal addLiteral(java.lang.String value,
                          java.lang.String language)
Create a literal instance with a language tag and add the Literal to the triple store registry.

Returns:
a Literal instance that can be safely cast to com.franz.ag.Literal
Throws:
java.lang.IllegalStateException - if the creation fails.

createTypedLiteral

public Literal createTypedLiteral(java.lang.String text,
                                  java.lang.String type)
Create a typed Literal instance from a string but do not modify the triple store.

Parameters:
text - A string URI.
type - A string URI that denotes the type.
Returns:
a Literal instance.

addTypedLiteral

public Literal addTypedLiteral(java.lang.String text,
                               java.lang.String type)
Create a typed Literal instance from a string and add the Literal to the triple store registry.

Parameters:
text - A string URI.
type - A string URI that denotes the type.
Returns:
a Literal instance.
Throws:
java.lang.IllegalStateException - if the creation fails.

createTypedLiteral

public Literal createTypedLiteral(java.lang.String text,
                                  UPI type)
Create a typed Literal instance from a string but do not modify the triple store.

Parameters:
text - A string.
type - A UPI instance that identifie a Node
Returns:
a Literal instance.

addTypedLiteral

public Literal addTypedLiteral(java.lang.String text,
                               UPI type)
Create a typed Literal instance from a string and add the literal to the triple store registry.

Parameters:
text - A string.
type - A UPI instance that identifies the datatype resource.
Returns:
a Literal instance.
Throws:
java.lang.IllegalStateException - if the creation fails.

addTypedLiteral

public Literal addTypedLiteral(java.lang.String text,
                               URI type)
Create a typed Literal instance from a string and add the literal to the triple store registry.

Parameters:
text - A string.
type - A URI instance that identifies the datatype resource.
Returns:
a Literal instance.
Throws:
java.lang.IllegalStateException - if the creation fails.

createLiteral

public Literal createLiteral(java.lang.String value,
                             URI datatype)
Create a literal instance with a datatype tag but do not modify the triple store.

Specified by:
createLiteral in interface ValueFactory
Parameters:
value - The literal's value.
datatype - The literal's datatype, or null if the literal doesn't have a datatype.
Returns:
a value that can be safely cast to Literal

The literal instance will have a null UPI.


addLiteral

public Literal addLiteral(java.lang.String value,
                          URI datatype)
                   throws AllegroGraphException
Create a literal instance with a datatype tag and add the Literal to the triple store registry.

Returns:
a Literal instance that can be safely cast to com.franz.ag.Literal
Throws:
java.lang.IllegalStateException - if the creation fails.
AllegroGraphException

addLiterals

public Literal[] addLiterals(java.lang.String[] values,
                             java.lang.String[] datatypes,
                             java.lang.String[] languages)
                      throws AllegroGraphException
Create a set of Literal instances and add the literals to the triple store registry.

Parameters:
values - An array of string literal values (of length n).
datatypes - null, or an array of datatype URIs. If null, none of the new Literal instances will have a datatype qualifier. If an array, the first n elements will be used as datatype labels for the corresponding Literal. A null element specifies a Literal without a datatype label. If the length of the array is less than n, the last element is repeated as often as necessary. If a non-null value is specified in an array element, the corresponding element in the languages array is ignored.
languages - null, or an array of language labels. If null, none of the new Literal instances will have a language qualifier. If an array, the first n elements will be used as language labels for the corresponding Literal. A null element specifies a Literal without a language label. If the length of the array is less than n, the last element is repeated as often as necessary.
Returns:
An array of Literal instances of the same size as the first argument array.
Throws:
AllegroGraphException

createURI

public URI createURI(java.lang.String uri)
Create a resource node with a URI label but do not modify the triple store.

Specified by:
createURI in interface ValueFactory
Parameters:
uri -
Returns:
a URI instance tah can be cast safely to Node

addURI

public Node addURI(java.lang.String uri)
            throws AllegroGraphException
Create a resource node with a URI label and add the resource to the triple store registry.

Parameters:
uri -
Returns:
a Node instance.
Throws:
AllegroGraphException - if the creation fails.

addURIIds

public UPI[] addURIIds(java.lang.String[] uri)
                throws AllegroGraphException
Create a set of resource nodes in the triple store registry.

Parameters:
uri - An array of URI strings.
Returns:
an array of UPIs for the new nodes.
Throws:
AllegroGraphException

addURIs

public URI[] addURIs(java.lang.String[] uri)
              throws AllegroGraphException
Create a set of resource Node instances and add the resources to the triple store registry.

Parameters:
uri - An array of URI strings.
Returns:
an array of Node instances.
Throws:
AllegroGraphException

createURI

public URI createURI(java.lang.String namespace,
                     java.lang.String localName)
Create a resource node with a URI label but do not modify the triple store.

Specified by:
createURI in interface ValueFactory
Parameters:
namespace - A namespace.
localName - A legal local name. A legal local name adheres to the definition of an NCName as specified at http://www.w3.org/TR/REC-xml-names/#NT-NCName.
Returns:
a URI instance tah can be cast safely to Node
Throws:
java.lang.IllegalStateException - if the creation fails.

getStatements

public Cursor getStatements(java.lang.Object subject,
                            java.lang.Object predicate,
                            java.lang.Object object)
                     throws AllegroGraphException
Retrieve null context statements from the triple store.

Returns:
a Cursor instance
Throws:
AllegroGraphException - if there is a problem.

getStatements

public Cursor getStatements(boolean includeInferred,
                            java.lang.Object subject,
                            java.lang.Object predicate,
                            java.lang.Object object)
                     throws AllegroGraphException
Retrieve null context statements from the triple store.

Parameters:
includeInferred - if true, include inferred triples in the result. If false, return only triples that are actually present in the triple store.
Returns:
a Cursor instance
Throws:
AllegroGraphException - if there is a problem.

getStatements

public Cursor getStatements(java.lang.Object subject,
                            java.lang.Object predicate,
                            java.lang.Object object,
                            java.lang.Object context)
                     throws AllegroGraphException
Retrieve statements from the triple store .

Returns:
a Cursor instance
Throws:
AllegroGraphException - if there is a problem.

getStatements

public Cursor getStatements(boolean includeInferred,
                            java.lang.Object subject,
                            java.lang.Object predicate,
                            java.lang.Object object,
                            java.lang.Object context)
                     throws AllegroGraphException
Retrieve statements from the triple store.

Parameters:
includeInferred - if true, include inferred triples in the result. If false, return only triples that are actually present in the triple store.
context - Specifies the context or graph of the statements. Null is wild and matches any context; the empty string denotes the Null Context.
Returns:
a Cursor instance
Throws:
AllegroGraphException - if there is a problem.

getStatements

public Cursor getStatements(java.lang.Object subject,
                            java.lang.Object predicate,
                            java.lang.Object object,
                            java.lang.Object obEnd,
                            java.lang.Object context,
                            java.lang.Object contextEnd)
                     throws AllegroGraphException
Retrieve statements from the triple store and specify a range of values for the object and/or context components of the triples.

Parameters:
subject -
predicate -
object -
obEnd - a non-null value specifies the end of a range of values for the object component of the triples. A null value specifies that only the object agument will be used to match triples.
context - a null value is a wild card, the empty string specifies the null context, any other value must specify a resource that will match the context component.
contextEnd - a non-null value specifies the end of a range of values for the context component of the triples. A null value specifies that only the context agument will be used to match triples.
Returns:
a Cursor instance
Throws:
AllegroGraphException - if there is a problem.

getStatements

public Cursor getStatements(boolean includeInferred,
                            java.lang.Object subject,
                            java.lang.Object predicate,
                            java.lang.Object object,
                            java.lang.Object obEnd,
                            java.lang.Object context,
                            java.lang.Object contextEnd)
                     throws AllegroGraphException
Retrieve statements from the triple store and specify a range of values for the object and/or context components of the triples.

Parameters:
includeInferred - if true, include inferred triples in the result. If false, return only triples that are actually present in the triple store.
subject -
predicate -
object -
obEnd - a non-null value specifies the end of a range of values for the object component of the triples. A null value specifies that only the object agument will be used to match triples.
context - a null value is a wild card, the empty string specifies the null context, any other value must specify a resource that will match the context component.
contextEnd - a non-null value specifies the end of a range of values for the context component of the triples. A null value specifies that only the context agument will be used to match triples.
Returns:
a Cursor instance
Throws:
AllegroGraphException - if there is a problem.

getStatements

public Cursor getStatements(boolean includeInferred,
                            java.lang.Object subject,
                            java.lang.Object subEnd,
                            java.lang.Object predicate,
                            java.lang.Object predEnd,
                            java.lang.Object object,
                            java.lang.Object obEnd,
                            java.lang.Object context,
                            java.lang.Object contextEnd)
                     throws AllegroGraphException
Retrieve statements from the triple store and specify a range of values for any of the components of the triples.

Parameters:
includeInferred -
subject -
subEnd -
predicate -
predEnd -
object -
obEnd -
context -
contextEnd -
Returns:
Throws:
AllegroGraphException
See Also:
getStatements(boolean, Object, Object, Object, Object, Object, Object)

hasStatement

public boolean hasStatement(java.lang.Object subject,
                            java.lang.Object predicate,
                            java.lang.Object object)
                     throws AllegroGraphException
Find out if null-context statements matching the arguments are in the triple store.

Throws:
AllegroGraphException

hasStatement

public boolean hasStatement(boolean includeInferred,
                            java.lang.Object subject,
                            java.lang.Object predicate,
                            java.lang.Object object)
                     throws AllegroGraphException
Find out if null-context statements matching the arguments are in the triple store.

Parameters:
includeInferred - If false, only ground triples (triples directly stored in the triple store) are included in the search. If true, the search includes triples derived by reasoning.
Throws:
AllegroGraphException

hasStatement

public boolean hasStatement(java.lang.Object subject,
                            java.lang.Object predicate,
                            java.lang.Object object,
                            java.lang.Object context)
                     throws AllegroGraphException
Find out if any statements matching the arguments are in the triple store.

Throws:
AllegroGraphException

hasStatement

public boolean hasStatement(boolean includeInferred,
                            java.lang.Object subject,
                            java.lang.Object predicate,
                            java.lang.Object object,
                            java.lang.Object context)
                     throws AllegroGraphException
Find out if any statements matching the arguments are in the triple store.

Parameters:
includeInferred - If false, only ground triples (triples directly stored in the triple store) are included in the search. If true, the search includes triples derived by reasoning.
Throws:
AllegroGraphException

addStatement

public void addStatement(java.lang.Object subject,
                         java.lang.Object predicate,
                         java.lang.Object object)
                  throws AllegroGraphException
Add a Statement in the null context to the triple store.

Throws:
AllegroGraphException

addStatement

public void addStatement(java.lang.Object subject,
                         java.lang.Object predicate,
                         java.lang.Object object,
                         java.lang.Object context)
                  throws AllegroGraphException
Add a Statement to the triple store.

Throws:
AllegroGraphException

addStatements

public void addStatements(java.lang.Object subject,
                          java.lang.Object predicate,
                          java.lang.Object object)
                   throws AllegroGraphException
Add several null context Statements to the triple store.

Parameters:
subject - An array of Resource instances.
predicate - An array of URI instances.
object - An array of Value instances.

The number of Statements added is determined by the longest array argument. The last element in short arrays is extended to the required length. A single (not array) argument is treated as an array of one element.

Throws:
AllegroGraphException

addStatements

public void addStatements(java.lang.Object subject,
                          java.lang.Object predicate,
                          java.lang.Object object,
                          java.lang.Object contexts)
                   throws AllegroGraphException
Add several Statements to the triple store.

Parameters:
subject - An array of Resource instances.
predicate - An array of URI instances.
object - An array of Value instances.
contexts - An array of URI instances.

The number of Statements added is determined by the longest array argument. The last element in short arrays is extended to the required length. A single (not array) argument is treated as an array of one element.

Throws:
AllegroGraphException

clear

public void clear()
           throws AllegroGraphException
Delete all the statements in the triple store (one-by-one). From org.openrdf.sesame.sail.Transaction in Sesame 2.0

Throws:
AllegroGraphException

createLiteral

public Literal createLiteral(boolean value)
Create a typed Literal instance from a Java boolean value but do not modify the triple store.

Returns:
a value that can be safely cast to Literal

The literal instance will have a null UPI.


addLiteral

public Literal addLiteral(boolean value)
                   throws AllegroGraphException
Create a typed Literal instance from a Java boolean value and add the Literal to the triple store registry.

Returns:
a value that can be safely cast to com.franz.ag.Literal
Throws:
AllegroGraphException

createLiteral

public Literal createLiteral(long value)
Create a typed Literal instance from a Java long value but do not modify the triple store.

Returns:
a value that can be safely cast to Literal

The literal instance will have a null UPI.


addLiteral

public Literal addLiteral(long value)
                   throws AllegroGraphException
Create a typed Literal instance from a Java long value and add the Literal to the triple store registry.

Returns:
a value that can be safely cast to com.franz.ag.Literal
Throws:
AllegroGraphException

createLiteral

public Literal createLiteral(int value)
Create a typed Literal instance from a Java int value but do not modify the triple store.

Returns:
a value that can be safely cast to Literal

The literal instance will have a null UPI.


addLiteral

public Literal addLiteral(int value)
                   throws AllegroGraphException
Create a typed Literal instance from a Java int value and add the Literal to the triple store registry.

Returns:
a value that can be safely cast to com.franz.ag.Literal
Throws:
AllegroGraphException

createLiteral

public Literal createLiteral(short value)
Create a typed Literal instance from a Java short value but do not modify the triple store.

Returns:
a value that can be safely cast to Literal

The literal instance will have a null UPI.


addLiteral

public Literal addLiteral(short value)
                   throws AllegroGraphException
Create a typed Literal instance from a Java short value and add the Literal to the triple store registry.

Returns:
a value that can be safely cast to com.franz.ag.Literal
Throws:
AllegroGraphException

createLiteral

public Literal createLiteral(byte value)
Create a typed Literal instance from a Java byte value but do not modify the triple store.

Returns:
a value that can be safely cast to Literal

The literal instance will have a null UPI.


addLiteral

public Literal addLiteral(byte value)
                   throws AllegroGraphException
Create a typed Literal instance from a Java byte value and add the Literal to the triple store registry.

Returns:
a value that can be safely cast to com.franz.ag.Literal
Throws:
AllegroGraphException

createLiteral

public Literal createLiteral(double value)
Create a typed Literal instance from a Java double value but do not modify the triple store.

Returns:
a value that can be safely cast to Literal

The literal instance will have a null UPI.


addLiteral

public Literal addLiteral(double value)
                   throws AllegroGraphException
Create a typed Literal instance from a Java double value and add the Literal to the triple store registry.

Returns:
a value that can be safely cast to com.franz.ag.Literal
Throws:
AllegroGraphException

createLiteral

public Literal createLiteral(float value)
Create a typed Literal instance from a Java float value but do not modify the triple store.

Returns:
a value that can be safely cast to Literal

The literal instance will have a null UPI.


addLiteral

public Literal addLiteral(float value)
                   throws AllegroGraphException
Create a typed Literal instance from a Java float value and add the Literal to the triple store registry.

Returns:
a value that can be safely cast to com.franz.ag.Literal
Throws:
AllegroGraphException

createStatement

public Statement createStatement(Resource subject,
                                 URI predicate,
                                 Value object,
                                 Resource context)
Create a Statement instance but do not update the triple store.

Returns:
a Statement instance that can safely be cast to Triple.

selectStatements

public Cursor selectStatements(java.lang.String query)
                        throws AllegroGraphException
Search the AllegroGraph triple store with a Prolog query. If inferencing or distinct results are desired, use the 5 argument form selectStatements(boolean, boolean, String, Object, String).

Parameters:
query - An ACL Prolog query of the form
 (?x0 ?x1 ... ?xm) (q- ...) ...
 
Returns:
A Cursor instance that will deliver the triples found by the query. The first triple in the Cursor is the value of the first Prolog variable in the select list with a binding to a triple. Prolog variables not bound to triples are ignored. Each success i of the query produces n triples where n<=m is the number of query variables bound to triples; The results in the Cursor are ordered as follows: t00 t01 ... t0n t10 t11 ... t1n t20 t21 ...
Throws:
AllegroGraphException
See Also:
getSelectLimit()

selectStatements

public Cursor selectStatements(java.lang.String query,
                               java.lang.Object arg)
                        throws AllegroGraphException
Search the AllegroGraph triple store with a Prolog query. If inferencing or distinct results are desired, use the 5 argument form selectStatements(boolean, boolean, String, Object, String).

Parameters:
query - Like selectStatements(String)
arg - A single Value reference or an array. The AllegroGraph reference to the Value of each element is substituted for the Prolog variables "?a0", "?a1"... in the query. In this way, queries can be paramtrized with values from the Java application.
Returns:
Like selectStatements(String)
Throws:
AllegroGraphException

newTriple

public Triple newTriple(java.lang.Object s,
                        java.lang.Object p,
                        java.lang.Object o)
                 throws AllegroGraphException
Add a new triple to the triple store.

Parameters:
s - A String, UPI, or Value specifying a subject.
p - A String, UPI, or Value specifying a predicate.
o - A String, UPI, or Value specifying an object.
Returns:
a Triple instance for the new triple. All the string arguments must be in ntriples syntax.
Throws:
AllegroGraphException

newTripleId

public long newTripleId(java.lang.Object s,
                        java.lang.Object p,
                        java.lang.Object o)
                 throws AllegroGraphException
Add a new triple to the triple store.

Parameters:
s - A String, UPI, or Value specifying a subject.
p - A String, UPI, or Value specifying a predicate.
o - A String, UPI, or Value specifying an object.
Returns:
the integer id of the new triple
Throws:
AllegroGraphException

newTriple

public Triple newTriple(java.lang.Object s,
                        java.lang.Object p,
                        java.lang.Object o,
                        java.lang.Object c)
                 throws AllegroGraphException
Add a new triple to the triple store.

Parameters:
s - A String, UPI, or Value specifying a subject.
p - A String, UPI, or Value specifying a predicate.
o - A String, UPI, or Value specifying an object.
c - A String, UPI, or Value specifying a context.
Returns:
a Triple instance for the new triple. All the string arguments must be in ntriples syntax.
Throws:
AllegroGraphException

newTripleId

public long newTripleId(java.lang.Object s,
                        java.lang.Object p,
                        java.lang.Object o,
                        java.lang.Object c)
                 throws AllegroGraphException
Add a new triple to the triple store.

Parameters:
s - A String, UPI, or Value specifying a subject.
p - A String, UPI, or Value specifying a predicate.
o - A String, UPI, or Value specifying an object.
c - A String, UPI, or Value specifying a context.
Returns:
the integer id of the new triple
Throws:
AllegroGraphException

newTriples

public Triple[] newTriples(java.lang.Object s,
                           java.lang.Object p,
                           java.lang.Object o)
                    throws AllegroGraphException
Add new triples to the triple store.

Parameters:
s - An array of Strings UPIs or Value instances specifying subjects.
p - An array of Strings UPIs or Value instances specifying predicates.
o - An array of Strings UPIs or Value instances specifying objects.
Returns:
an array of Triple instances. All the string arguments must be in ntriples syntax.

The number of triples added is determined by the longest array argument. The last element in short arrays is extended to the required length.

Throws:
AllegroGraphException

newTriples

public Triple[] newTriples(java.lang.Object s,
                           java.lang.Object p,
                           java.lang.Object o,
                           java.lang.Object c)
                    throws AllegroGraphException
Add new triples to the triple store.

Parameters:
s - An array of Strings UPIs or Value instances specifying subjects.
p - An array of Strings UPIs or Value instances specifying predicates.
o - An array of Strings UPIs or Value instances specifying objects.
c - An array of Strings UPIs or Value instances specifying contexts.
Returns:
an array of Triple instances. All the string arguments must be in ntriples syntax.

The number of triples added is determined by the longest array argument. The last element in short arrays is extended to the required length.

Throws:
AllegroGraphException

newTripleIds

public long[] newTripleIds(java.lang.Object s,
                           java.lang.Object p,
                           java.lang.Object o)
                    throws AllegroGraphException
Add new triples to the triple store.

Parameters:
s - An array of Strings UPIs or Value instances specifying subjects.
p - An array of Strings UPIs or Value instances specifying predicates.
o - An array of Strings UPIs or Value instances specifying objects.
Returns:
an array of Triple id integers

The number of triples added is determined by the longest array argument. The last element in short arrays is extended to the required length.

Throws:
AllegroGraphException

newTripleIds

public long[] newTripleIds(java.lang.Object s,
                           java.lang.Object p,
                           java.lang.Object o,
                           java.lang.Object c)
                    throws AllegroGraphException
Add new triples to the triple store.

Parameters:
s - An array of Strings UPIs or Value instances specifying subjects.
p - An array of Strings UPIs or Value instances specifying predicates.
o - An array of Strings UPIs or Value instances specifying objects.
c - An array of Strings UPIs or Value instances specifying contexts.
Returns:
an array of Triple id integers

The number of triples added is determined by the longest array argument. The last element in short arrays is extended to the required length.

Throws:
AllegroGraphException

removeStatements

public void removeStatements(java.lang.Object s,
                             java.lang.Object p,
                             java.lang.Object o)
                      throws AllegroGraphException
Remove all statement that match a pattern from the triple store.

Parameters:
s - the subject pattern (Value, UPI, string)
p - the predicate pattern (Value, UPI, string)
o - the object pattern (Value, UPI, string)

The s, p, or o, arguments may also be null or an empty string to denote a wild card.

Throws:
AllegroGraphException

removeStatements

public void removeStatements(java.lang.Object s,
                             java.lang.Object p,
                             java.lang.Object o,
                             java.lang.Object c)
                      throws AllegroGraphException
Remove all statement that match a pattern from the triple store.

Parameters:
s - the subject pattern (Value, UPI, string)
p - the predicate pattern (Value, UPI, string)
o - the object pattern (Value, UPI, string)
c - the context pattern (Value, UPI, string); null denotes all contexts, the empty string denotes the null context.

The s, p, or o, arguments may also be null or an empty string to denote a wild card.

Throws:
AllegroGraphException

selectStatements

public Cursor selectStatements(java.lang.String query,
                               java.lang.Object arg,
                               java.lang.String svars)
                        throws AllegroGraphException
Search the AllegroGraph triple store with a Prolog query. If inferencing or distinct results are desired, use the 5 argument form selectStatements(boolean, boolean, String, Object, String).

Parameters:
query - like selectStatements(String)
arg - A Resource or Literal references, or an array of these. The AllegroGraph Id of the argument is substituted for the Prolog variable specified in the svar argument.
svars - A string containing one or more names of Prolog variables separated by spaces. These variables must not be any of the variables to be set by the search (because these variables will actually be constants during the search). If there are fewer variables than values then additional values will be bound to the Prolog variables ?ai where i is the index of the value in the array arg. The name of a Prolog variable in the query.
Returns:
like selectStatements(String)
Throws:
AllegroGraphException

selectStatements

public Cursor selectStatements(boolean includeInferred,
                               boolean distinct,
                               java.lang.String query,
                               java.lang.Object arg,
                               java.lang.String svars)
                        throws AllegroGraphException
Search the AllegroGraph triple store with a Prolog query.

Parameters:
includeInferred - if true, include values obtained by reasoning
distinct - if true, return only distinct sets of values
query - like selectStatements(String)
arg - A Resource or Literal references, or an array of these. The AllegroGraph Id of the argument is substituted for the Prolog variable specified in the svar argument.
svars - A string containing one or more names of Prolog variables separated by spaces. These variables must not be any of the variables to be set by the search (because these variables will actually be constants during the search). If there are fewer variables than values then additional values will be bound to the Prolog variables ?ai where i is the index of the value in the array arg. The name of a Prolog variable in the query.
Returns:
a cursor like selectStatements(String)
Throws:
AllegroGraphException

createBNodeIds

public UPI[] createBNodeIds(int n)
                     throws AllegroGraphException
Allocate a set of BlankNode ID numbers.

Parameters:
n - the number of nodes to allocate.
Returns:
an array of intege ID numbers
Throws:
AllegroGraphException - if there is a problem during creation.

removeStatement

public void removeStatement(java.lang.Object s,
                            java.lang.Object p,
                            java.lang.Object o)
                     throws AllegroGraphException
Remove one null-context statement from the triple store.

Parameters:
s - A Resource, a string in triples format, or a UPI
p - A Node, a string in triples format, or a UPI
o - A Value, a string in triples format, or a UPI
Throws:
AllegroGraphException

removeStatement

public void removeStatement(java.lang.Object s,
                            java.lang.Object p,
                            java.lang.Object o,
                            java.lang.Object c)
                     throws AllegroGraphException
Remove one statement from the triple store. From org.openrdf.sesame.sail.Transaction in Sesame 2.0

Parameters:
s - the subject of the Statement in question
p - the predicate of the Statement in question
o - the object of the Statement in question
c - the context (or graph) of the Statement in question

Each of the parameters may be a Value instance, or a UPI instance, or a string containing an ntriple format reference.

The context argument may be null to denote the Null Context (Default Graph).

Throws:
AllegroGraphException

addLiteralIds

public UPI[] addLiteralIds(java.lang.String[] values,
                           java.lang.String[] datatypes,
                           java.lang.String[] languages)
                    throws AllegroGraphException
Add a set of literal instances to the triple store registry.

Parameters:
values - an array of string literal values.
datatypes - an array of string URIs for datatypes. If an array element is null, the corresponding literal does not have a datatype qualifier. If the array argument is null, then none of the literals have datatype qualifiers.
languages - an array of strings language qualifiers. If an array element is null, the corresponding literal does not have a language qualifier. If the array argument is null, then none of the literals have language qualifiers.

If an element of the datatypes array is not null, the corresponding element in the languages array is ignored.

Returns:
an array of UPIs for the new literals.
Throws:
AllegroGraphException -

The result array is the same length as the values array. The other two argument arrays may be shorter. If shorter, the last element in each array is repeated as often as necessary.


selectValues

public ValueObject[][] selectValues(java.lang.String query,
                                    java.lang.Object[] invals,
                                    java.lang.String invars)
                             throws AllegroGraphException
Evaluate a Prolog query that retrieves triples, resources, or literals from the triple store. If inferencing or distinct results are desired, use the 5 argument form selectValues(boolean, boolean, String, Object[], String).

Parameters:
query - A string containing an AllegroGraph SELECT query. The query may contain ! notations - these are resolved with respect to the triple store associated with the calling AllegroGraph instance.
invars - A string that lists the variables to be preset to values in the query. For example "?a ?b ?c". By setting these variables in the query, the query can be paramtrized with values from the application program.
invals - An array of values for the variables mentioned in invars. The values must be all of the same type. The values may be UPI instances that denote AllegroGraph objects, String instances in ntriples format, or ValueNode instances.
Returns:
An array of n-tuples, where n is the number of query variables. Each n-tuple is an array of n ValueObject instances. The array returned by the call to selectValues may contain all the results of the query, or only a part. The method moreValues(Object) can be used to query if additional results are available.

The number of sets of results returned is the smaller of the limit value or the actual number found by the query. The limit is determined by calling setSelectLimit(int). Additional results can be retrieved by calling selectMore(ValueObject[][]).

Throws:
AllegroGraphException -

In the query selectValues("(?x ?y ?z) (q- ?a my!pred ?x)...", {subj}, "?a") The Prolog variable ?a is preset to the value of the Java variable 'subj' and therfore behaves like a constant during the query.

The result will be an array of 3-tuples. The first element in each 3-tuple will be the binding of variable ?x, the second ?y, and the third ?z

See Also:
selectMore(ValueObject[][])

selectValues

public ValueObject[][] selectValues(boolean includeInferred,
                                    boolean distinct,
                                    java.lang.String query,
                                    java.lang.Object[] invals,
                                    java.lang.String invars)
                             throws AllegroGraphException
Evaluate a Prolog query that retrieves triples, resources, or literals from the triple store.

Parameters:
includeInferred - if true, include values obtained by reasoning
distinct - if true, return only distinct sets of values
query - the query as in selectValues(String, Object[], String)
invals - see selectValues(String, Object[], String)
invars - see selectValues(String, Object[], String)
Returns:
see selectValues(String, Object[], String)
Throws:
AllegroGraphException

selectSingleValues

public ValueObject[] selectSingleValues(java.lang.String query,
                                        java.lang.Object[] invals,
                                        java.lang.String invars)
                                 throws AllegroGraphException
Evaluate a Prolog query that retrieves a single value in each success.

Parameters:
query - A query similar to the query passed to selectValues(String, Object[], String) but limited to a single result variable.
invals - null or an array of values as in selectValues(String, Object[], String)
invars - null or atring of variable names as in selectValues(String, Object[], String)
Returns:
An array of ValueObject instances. The array returned by the call may contain all the results of the query, or only a part. The method moreValues(Object) can be used to query if additional results are available.
Throws:
AllegroGraphException
See Also:
selectMore(ValueObject[])

selectSingleValues

public ValueObject[] selectSingleValues(boolean includeInferred,
                                        boolean distinct,
                                        java.lang.String query,
                                        java.lang.Object[] invals,
                                        java.lang.String invars)
                                 throws AllegroGraphException
Evaluate a Prolog query that retrieves a single value in each success.

Parameters:
includeInferred - if true, include values obtained by reasoning
distinct - if true, return only distinct sets of values
query - A query similar to the query passed to selectValues(String, Object[], String) but limited to a single result variable.
invals - null or an array of values as in selectValues(String, Object[], String)
invars - null or atring of variable names as in selectValues(String, Object[], String)
Returns:
An array of ValueObject instances. The array returned by the call may contain all the results of the query, or only a part. The method moreValues(Object) can be used to query if additional results are available.
Throws:
AllegroGraphException
See Also:
selectMore(ValueObject[])

getFreetextUniqueSubjects

public ValueObject[] getFreetextUniqueSubjects(java.lang.String pattern)
                                        throws AllegroGraphException
Collect the unique subjects from triples that match a text pattern. Search the triple store for triples where the object was indexed as freetext and the text matches the specified pattern.

Parameters:
pattern - A text pattern as described in getFreetextStatements(String)
Returns:
An array of ValueObject instances. The size of the array is bounded by the value defined with setSelectLimit(int).
Throws:
AllegroGraphException
See Also:
selectMore(ValueObject[])

getFreetextStatements

public Cursor getFreetextStatements(java.lang.String pattern)
                             throws AllegroGraphException
Find triples that match a text pattern. Search the triple store for triples where the object was indexed as freetext and the text matches the specified pattern.

Parameters:
pattern - A text pattern as described below.
Returns:
A Cursor instance that iterates over the results.
Throws:
AllegroGraphException -

The text pattern is a string containing a well-formed pattern expression defines as follows:

 pattern := atomic_pattern | composite_pattern
 composite_pattern := ( and  pattern* ) | ( or  pattern* )
 atomic_pattern := word_pattern | phrase_pattern
 word_pattern := 'char*'
 phrase pattern := [char*]
 char := /(      denotes the character [
 char := /)      denotes the character ]
 char := /!      denotes the character '
 char := //     denotes the character /
 char := /#      denotes the character "
 char := ?       denotes a wild card that matches any single character
 char := *       denotes a wild card that matches any sequence of characters
 char := any     any other character denotes itself
 

getFreetextPredicates

public java.lang.String[] getFreetextPredicates()
                                         throws AllegroGraphException
Retrieve the URI labels of the registered freetext predicates.

Returns:
an array of strings - these are the URI labels of the registered predicates.
Throws:
AllegroGraphException

registerFreetextPredicate

public void registerFreetextPredicate(java.lang.Object predicate)
                               throws AllegroGraphException
Register a predicate for freetext indexing. The text in literal objects of triples with registered predicates are indexed so that they can be searched with text patterns with getFreetextStatements(String) or with getFreetextUniqueSubjects(String). Freetext indexing predicates must be reistered before any triples are added to the triple store.

Parameters:
predicate - The predicate may be specified as a string in ntriples syntax or !-notation, a UPI instance, or a URI instance.
Throws:
AllegroGraphException

selectValues

public ValueObject[][] selectValues(java.lang.String query)
                             throws AllegroGraphException
Evaluate a Prolog query that retrieves triples, resources, or literals from the triple store. If inferencing or distinct results are desired, use the 5 argument form selectValues(boolean, boolean, String, Object[], String).

Parameters:
query - A string containing an AllegroGraph SELECT query. The query may contain ! notations - these are resolved with respect to the triple store associated with the calling AllegroGraph instance.
Returns:
An array of n-tuples, where n is the number of query variables. Each n-tuple is an array of n ValueObject instances. The array returned by the call to selectValues may contain all the results of the query, or only a part. The method moreValues(Object) can be used to query if additional results are available.

The number of results returned is the smaller of the limit value or the actual number in the triple store. The limit is determined by calling setSelectLimit(int). Additional results can be retrieved by calling selectMore(ValueObject[][]).

Throws:
AllegroGraphException -

In the query selectValues("(?x ?y ?z) (q- ...)...") The result will be an array of 3-tuples. The first element in each 3-tuple will be the binding of variable ?x, the second ?y, and the third ?z

See Also:
selectMore(ValueObject[][])

selectValues

public ValueObject[][] selectValues(boolean includeInferred,
                                    boolean distinct,
                                    java.lang.String query)
                             throws AllegroGraphException
Evaluate a Prolog query that retrieves triples, resources, or literals from the triple store.

Parameters:
includeInferred - if true, include values obtained by reasoning
distinct - if true, return only distinct sets of values
query - the query as in selectValues(String, Object[], String)
Returns:
see selectValues(String, Object[], String)
Throws:
AllegroGraphException

valuesLength

public int valuesLength(ValueObject[][] x)
Return the number of result sets in the array returned by selectValues(String).

Parameters:
x - the array of results returned by selectValues(String)
Returns:
the number of result sets. Each result set is an array of values.

moreValues

public int moreValues(java.lang.Object x)
Determine if more results are available for a selectValues(String) result.

Parameters:
x - An array returned by selectValues(String)
Returns:
Zero if all results have been returned. A positive value is the total number of additional values available. The absolute value of a negative value is a lower limit on the number of additional results.

valueNames

public java.lang.String[] valueNames(java.lang.Object x)
Get the names of the variables in query.

Parameters:
x - An object returned by a call to selectValues(), selectSingleValue(), or twinqlSelect().
Returns:
an array of strings where each element names a variable. The results are in the same order as the variable names. If the variable names are not available, return an array of zero length.

selectMore

public ValueObject[][] selectMore(ValueObject[][] sr)
                           throws AllegroGraphException
Get more results from a previous selectValues query.

Parameters:
sr - An array of values previously returned by a call to selectValues(String)
Returns:
the argument array updated with a new set of values, or a new shorter array if fewer results are available.
Throws:
AllegroGraphException
See Also:
selectValues(String, Object[], String)

selectMore

public ValueObject[] selectMore(ValueObject[] sr)
                         throws AllegroGraphException
Get more results from a previous selectSingleValues query.

Parameters:
sr - An array of values previously returned by a call to selectSingleValues(String, Object[], String)
Returns:
the argument array updated with a new set of values, or a new shorter array if fewer results are available.
Throws:
AllegroGraphException
See Also:
selectSingleValues(String, Object[], String)

twinqlAsk

public boolean twinqlAsk(java.lang.String query)
                  throws AllegroGraphException
Deprecated. Use the methods in SPARQLQuery instead.

Send a SPARQL ASK query to AllegroGraph.

Parameters:
query - A string containing a well-formed SPARQL ASK query. If the query string is not an ASK query, the result is undefined.
Returns:
true if the query pattern has a solution.
Throws:
AllegroGraphException - See SPARQLQuery for more SPARQL query options.

twinqlSelect

public ValueObject[][] twinqlSelect(java.lang.String query,
                                    java.lang.String vars,
                                    int limit,
                                    int offset)
                             throws AllegroGraphException
Deprecated. Use the methods in SPARQLQuery instead.

Send a SPARQL SELECT query to AllegroGraph.

Parameters:
query - A string containing a well-formed SPARQL SELECT query. If the query string is not a SELECT query. the result is undefined.
vars - A String containing the names of the SPARQL variables separated by spaces, to be returned from the query. The order of the names in this list is the order of the corresponding values in the result array. This argument may be null or "" to use the variables listed in the query. Note that in the case of a "SELECT *" query, the application must call valueNames(Object) to determine the names of the variables for which the bindings are returned in each result set.
limit - Overrides a LIMIT specification in the query string. The LIMIT specification in the SPARQL language places a limit on the number of results collected by the query. This limit is separate and distinct from the setSelectLimit() value. A zero or negative value is interpreted as unlimited.
offset - Overrides an OFFSET specification in the query string. A zero or negative value is interpreted as unlimited.
Returns:
An array of n-tuples containing the bindings of the query variables. The length of the array is the number of successful matches of the query. Each n-tuple contains as many elements as there were variables in the vars argument. The elements in the n-tuple are the bindings of the corresponding variable in the vars argument. If a variable does not have a binding in some n-tuple, the element is null.
Throws:
AllegroGraphException - See SPARQLQuery for more SPARQL query options.

twinqlSelect

public ValueObject[][] twinqlSelect(boolean includeInferred,
                                    java.lang.String query,
                                    java.lang.String vars,
                                    int limit,
                                    int offset)
                             throws AllegroGraphException
Deprecated. Use the methods in SPARQLQuery instead.

Send a SPARQL SELECT query to AllegroGraph. Like {@link #twinqlSelect(String, String, int, int)}

Parameters:
includeInferred - if true, include inferred triples in the result.
query -
vars -
limit -
offset -
Returns:
Throws:
AllegroGraphException - See SPARQLQuery for more SPARQL query options.

twinqlCount

public long twinqlCount(java.lang.String query,
                        java.lang.String vars,
                        int limit,
                        int offset)
                 throws AllegroGraphException
Deprecated. Use the methods in SPARQLQuery instead.

Send a SPARQL SELECT query to AllegroGraph and return only the number of results. The arguments are identical to twinqlSelect(String, String, int, int).

Returns:
the number of result sets retrieved by the query See SPARQLQuery for more SPARQL query options.
Throws:
AllegroGraphException

twinqlFind

public Cursor twinqlFind(java.lang.String query,
                         int limit,
                         int offset)
                  throws AllegroGraphException
Deprecated. Use the methods in SPARQLQuery instead.

Send a SPARQL DESCRIBE or CONSTRUCT query to AllegroGraph.

Parameters:
query - A string containing a SPARQL DESCRIBE or CONSTRUCT query that returns a set of triples.
limit - Overrides a LIMIT specification in the query string. The LIMIT specification in the SPARQL language places a limit on the number of results collected by the query. This limit is separate and distinct from the setSelectLimit() value. A zero or negative value is interpreted as unlimited.
offset - Overrides an OFFSET specification in the query string. A zero or negative value is interpreted as unlimited.
Returns:
A Cursor instance that will iterate over the set of triples.
Throws:
AllegroGraphException - See SPARQLQuery for more SPARQL query options.

twinqlQuery

public java.lang.String twinqlQuery(java.lang.String query,
                                    java.lang.String format,
                                    int limit,
                                    int offset)
                             throws AllegroGraphException
Deprecated. Use the methods in SPARQLQuery instead.

Send a SPARQL query to AllegroGraph and retrieve a serialized XML reply.

Parameters:
query - A SPARQL query string.
limit - Overrides a LIMIT specification in the query string. The LIMIT specification in the SPARQL language places a limit on the number of results collected by the query. This limit is separate and distinct from the setSelectLimit() value. A zero or negative value is interpreted as unlimited.
offset - Overrides an OFFSET specification in the query string. A zero or negative value is interpreted as unlimited.
format - A string that specifies the format of the result. Currently recognized strings are:
  • sparql-xml -- The SPARQL XML results format (SELECT and ASK queries)
  • sparql-json -- A JSON serialization of the XML format (SELECT and ASK queries)
  • rdf/xml -- RDF/XML (CONSTRUCT and DESCRIBE queries)
  • rdf-n3 -- A na�ve version of Notation3 (more like ntriples) (CONSTRUCT and DESCRIBE queries)
If an unsuitable format is specified, an exception is thrown.
Returns:
A string containing the serialized result of the query. Some serializations are not allowed with some queries.
Throws:
AllegroGraphException - See SPARQLQuery for more SPARQL query options.

createStatement

public Statement createStatement(Resource subject,
                                 URI predicate,
                                 Value object)
Create a Null Context Statement instance but do not update the triple store.

Specified by:
createStatement in interface ValueFactory
Parameters:
subject - The statement's subject.
predicate - The statement's predicate.
object - The statement's object.
Returns:
a Statement instance that can safely be cast to Triple.

getUnmergedCount

public int getUnmergedCount()
                     throws AllegroGraphException
Query the number of unmerged index chunks in the triple store. The indexTriples() method builds a new index chunk each time it is called. It takes less time to build a partial index, but when too many index chunks are present, query performance suffers. The indexAll() method builds a single unified index for the entire triple store.

Returns:
the number of index chunks in the triple store.
Throws:
AllegroGraphException

getUnindexedTripleCount

public int getUnindexedTripleCount()
                            throws AllegroGraphException
Query the number of unindexed triples in the triple store. Indexed triples can be searched more efficiently.

Returns:
the number of unindexed triples in the triple store.
Throws:
AllegroGraphException

getUnindexedThreshold

public int getUnindexedThreshold()
                          throws AllegroGraphException
Query the threshold for automatic indexing of the triple store. The built-in default value is zero to suppress automatic indexing.

Returns:
the integer value of the threshold for automatic indexing of the triple store.
Throws:
AllegroGraphException

setUnindexedThreshold

public void setUnindexedThreshold(int val)
                           throws AllegroGraphException
Set the threshold for automatic indexing of the triple store. When the number of unindexed triples in the triple store exceeds this number, then the new triples are automatically indexed into a new index chunk. A value of zero suppresses automatic indexing.

Parameters:
val - The new value for this parameter.
Throws:
AllegroGraphException

getUnmergedThreshold

public int getUnmergedThreshold()
                         throws AllegroGraphException
Query the threshold for automatic re-indexing of the triple store. The built-in default value is zero to suppress automatic re-indexing.

Returns:
the integer value of the threshold for automatic re-indexing of the triple store.
Throws:
AllegroGraphException

setUnmergedThreshold

public void setUnmergedThreshold(int val)
                          throws AllegroGraphException
Set the threshold for automatic re-indexing of the triple store. When the number of index chunks in the triple store exceeds this number, then the new triples are automatically re-indexed into a new single unified index. A value of zero suppresses automatic re-indexing.

Parameters:
val - The new value for this parameter.
Throws:
AllegroGraphException

getIndexFlavors

public java.lang.String[] getIndexFlavors()
                                   throws AllegroGraphException
Query the range of indexing that is applied to this triple store.

Returns:
an array of strings that describe the indexing flavors.
Throws:
AllegroGraphException

setIndexFlavors

public void setIndexFlavors(java.lang.String[] flavors)
                     throws AllegroGraphException
Replace the set of indexing flavors in the triple store. The changes take effect the next time an indexing operation is initiated.

Parameters:
flavors - An array of strings specifying the desired indexing flavors. Any existing flavors are discarded. Each string is a permutation of the letters "spog".
Throws:
AllegroGraphException -

Multi-user Note: The set of index flavors is a persistent property of the persistent triple store. If several users are accessing the same triple store, any changes to the index flavors are seen by all users.


addIndexFlavors

public void addIndexFlavors(java.lang.String[] flavors)
                     throws AllegroGraphException
Add some index flavors to the triple store. The changes take effect the next time an indexing operation is initiated.

Parameters:
flavors - An array of strings specifying the desired indexing flavors. These flavors are added to the existing flavors. Each string is a permutation of the letters "spog".
Throws:
AllegroGraphException -

Multi-user Note: The set of index flavors is a persistent property of the persistent triple store. If several users are accessing the same triple store, any changes to the index flavors are seen by all users.


dropIndexFlavors

public void dropIndexFlavors(java.lang.String[] flavors)
                      throws AllegroGraphException
Delete some indexing flavors from the triple store. The changes take effect the next time an indexing operation is initiated.

Parameters:
flavors - An array of strings specifying the indexing flavors to delete. These flavors are deleted from the existing flavors. Each string is a permutation of the letters "spog".
Throws:
AllegroGraphException -

Multi-user Note: The set of index flavors is a persistent property of the persistent triple store. If several users are accessing the same triple store, any changes to the index flavors are seen by all users.


addDataMapping

public void addDataMapping(java.lang.String[] map)
                    throws AllegroGraphException
Add to the table of datatype and property mappings in the triple store. These mappings are in effect only during bulk loading with loadNtriple() loadNtriples() or loadRDF(). Data converted to internal data types can be queried with range queries.

Parameters:
map - An array of strings of a length that is a multiple of 3. Each group of 3 consecutive elements defines one mapping: the first element is string URI of a datatype or predicate; the second element is a string naming an internal representation type of AllegroGraph (the valid types are listed in the AllegroGraph introduction); the third element is the string "datatype" or "predicate" to identify the kind of mapping.

The entries in the array are added to the table in the triple store. An existing entry is superseded by the new definition.

When a triple is created with a predicate matching a defined URI, then the object of the triple is parsed and converted to the internal data type.

When a literal is created with a datatype modifier that matches a defined URI, then the content of the literal is parsed and converted to the internal data type.

Throws:
AllegroGraphException

setDataMapping

public void setDataMapping(java.lang.String[] map)
                    throws AllegroGraphException
Replace the current table of datatype and property mappings in the triple store. These mappings are in effect only during bulk loading with loadNtriples().

Parameters:
map - An array of strings similar to the array returned by getDataMapping().
Throws:
AllegroGraphException
See Also:
addDataMapping(String[]), getDataMapping()

getDataMapping

public java.lang.String[] getDataMapping()
                                  throws AllegroGraphException
Query the current table of datatype and property mappings in the triple store. These mappings are in effect only during bulk loading with loadNtriple() loadNtriples() or loadRDF().

Returns:
An array of strings that describe the mappings. The length of the array is a multiple of 3. The contents of the array is a sequence of strings u1, d1, k1, u2, d2, k2, ... where ui is a URI string that identifies a predicate or Schema type, di is a string that identifies an internal AllegroGraph data type of the mapped value, and ki is the string "predicate" or "datatype" to identify the kind of mapping.
Throws:
AllegroGraphException
See Also:
addDataMapping(String[])

evalInServer

public java.lang.Object[] evalInServer(java.lang.String expression)
                                throws AllegroGraphException
Evaluate a Lisp expression in the AllegroGraph server. During the evaluation, the default triple store is the one associated with this AllegroGraph instance.

Parameters:
expression - The expression.
Returns:
An array of values returned by the call.
Throws:
AllegroGraphException -

The proper usage of this method is fully described in

See Also:
AllegroGraphConnection.evalInServer(String)

serverTrace

public int serverTrace(boolean onoff)
Change the trace state in the AllegroGraph server.

Parameters:
onoff - true to turn on tracing.

When tracing is turned on in the AllegroGraph server, every call from Java to the server causes some output on the server console. This output may be useful in diagnosing some problems. Since tracing may produce large quantities of output it should be used with caution and only around critical sections of code.

The trace state applies only to operations on this triple store.

Returns:
-1 if the call failed for some reason, 0 otherwise.

serverTrace

public int serverTrace(java.lang.String outFile)
Start tracing calls from Java in the AllegroGraph server.

Parameters:
outFile - the name and path for a file where the trace output will go.

When tracing is turned on in the AllegroGraph server, every call from Java to the server causes some output on the server console. This output may be useful in diagnosing some problems. Since tracing may produce large quantities of output it should be used with caution and only around critical sections of code.

The trace state applies only to operations on this triple store.

Returns:
-1 if the call failed for some reason, 0 otherwise.

getNamespaces

public java.lang.String[] getNamespaces()
Query the namespace definitions specific to this triple store. The definitions are not persisitent, and apply only to this AllegroGraph instance.

Returns:
An array of strings. The even numbered elements are prefixes and the following odd numbered element is the full namespace text.

getNamespaceRegistry

public NamespaceRegistry getNamespaceRegistry()
Query the namespace definitions specific to this triple store. The definitions are not persisitent, and apply only to this AllegroGraph instance.

Returns:
the current definitions.

registerNamespace

public void registerNamespace(java.lang.String prefix,
                              java.lang.String full)
                       throws AllegroGraphException
Register one namespace definition for this triple store. The new definition overrides an existing definition.

Parameters:
prefix - the prefix
full - The full namespace text. If the full text is null or "", then the prefix is removed from the table.
Throws:
AllegroGraphException

registerNamespaces

public void registerNamespaces(java.lang.String[] defs)
                        throws AllegroGraphException
Register several namespace definitions for this triple store. The new definitions overrides any existing definitions.

Parameters:
defs - An array of strings. The even numbered elements are prefixes and the following odd numbered element is the full namespace text. If the full text is null or "", then the prefix is removed from the table.
Throws:
AllegroGraphException

setNamespaceRegistry

public void setNamespaceRegistry(NamespaceRegistry ns)
                          throws AllegroGraphException
Register several namespace definitions for this triple store. The new definitions replace any existing definitions entirely.

Parameters:
ns - the new definitions.
Throws:
AllegroGraphException

setNamespaceRegistry

public void setNamespaceRegistry()
                          throws AllegroGraphException
Reset the namespace definition in this AllefroGraph instance to the initial default.

Throws:
AllegroGraphException

addPart

public ValueNode addPart(java.lang.String part)
                  throws AllegroGraphException
Add a Literal, Node or BlankNode to the triple store.

Parameters:
part - A string in ntriples syntax or !-notation that denotes a Literal, a Node, or a blank node.

NOTE: mentioning a blank node twice with the same string will still create two distinct blank node instances.

Returns:
a ValueObject instance that represents the data.
Throws:
AllegroGraphException

getStores

public AllegroGraph[] getStores()
                         throws AllegroGraphException
Retrieve the components of a federated triple store.

Returns:
null if this is not a federated triple store; otherwise, return an array of the component stores. The result array is composed of new AllegroGraph instances, one for each component.
Throws:
AllegroGraphException

getSyncEveryTime

public boolean getSyncEveryTime()
Query the synchronization mode for this AllegroGraph instance.

Returns:
true if this AllegroGraph instance is configured to synchronize automatically after every update call from Java. Return flase if it the responsibility of the application to synchronize.

setSyncEveryTime

public void setSyncEveryTime(boolean s)
Set the synchronization mode for this AllegroGraph instance. By default, each addStatement() or addStatements() call triggers a synchronization to update the persistent store. Some applications can save time by synchronizing explicitly at suitable times.

Parameters:
s - if true, the triple store will be synchronized after every update call from Java. If false, the application must call #syncTripleStore(AllegroGraph) every now and then in order to force a persistent store update. NOTE: If the synchronization mode is false, and the application terminates abruptly, any updates since the last synchronization call will be lost.

toString

public java.lang.String toString()
Display some details about the AllegroGraph instance.


getSNAExtension

public SNAExtension getSNAExtension()
Get the SNAExtension instance of this AllegroGraph instance.

Returns:
the SNAExtension instance

getGeoExtension

public GeoExtension getGeoExtension()
Get the GeoExtension instance of this AllegroGraph instance.

Returns:
the GeoExtension instance

syncDatabase

public void syncDatabase()
                  throws AllegroGraphException
Deprecated. Use syncTripleStore() instead.

Throws:
AllegroGraphException

closeDatabase

public void closeDatabase()
                   throws AllegroGraphException
Deprecated. Use closeTripleStore() instead.

Throws:
AllegroGraphException

indexAll

public void indexAll()
              throws AllegroGraphException
Deprecated. Use indexAllTriples() instead

Throws:
AllegroGraphException

indexTriples

public void indexTriples()
                  throws AllegroGraphException
Deprecated. Use indexNewTriples() instead

Throws:
AllegroGraphException

select

public Cursor select(java.lang.String query)
              throws AllegroGraphException
Deprecated. Use selectStatements(String) instead

Throws:
AllegroGraphException

select

public Cursor select(java.lang.String query,
                     java.lang.Object arg)
              throws AllegroGraphException
Deprecated. Use selectStatements(String,Object) instead

Throws:
AllegroGraphException

select

public Cursor select(java.lang.String query,
                     java.lang.Object arg,
                     java.lang.String svar)
              throws AllegroGraphException
Deprecated. Use selectStatements(String,Object,String) instead

Throws:
AllegroGraphException