org.grinvin

Class GraphURI


public final class GraphURI
extends java.lang.Object

Utility class provides a method load(URI,GraphBundle) to load a graph that corresponds to an URI. Currently the following URIs are supported: An graph: URI has the following form:
graph:graph_factory-id[?name-value-pairs]

The graph factory id identifies an object of type GraphFactory. If present, the name/value pairs indicate additional parameters for that factory. They are formatted in a style similar to that of HTTP query strings:

name1=value1&name2=value2&...&name3=value3
E.g., the following represents the complete graph of order 4
     graph:org.grinvin.factories.CompleteGraphFactory?order=4
 

Method Summary

static URI
createFactory(String ssp)
static URI
createSession(String ssp)
static GraphURIType
getType(URI uri)
Return the type corresponding to the given URI.
static boolean
isClasspath(URI uri)
static boolean
isFactoryGenerated(URI uri)
static boolean
isFile(URI uri)
static boolean
isGlobal(URI uri)
static boolean
isLocal(URI uri)
static boolean
isSession(URI uri)
Is this a null URI or an URI with a 'session' scheme.
static void
load(URI uri, GraphBundle graphBundle)
Load the graph that corresponds to the given URI into the given graph bundle.
static URI
translateSessionURI(URI uri, File directory)
Translate a relative session URI to an absolute file URI with the given base directory.

Method Details

createFactory

public static URI createFactory(String ssp)
            throws URISyntaxException

createSession

public static URI createSession(String ssp)
            throws URISyntaxException

getType

public static GraphURIType getType(URI uri)
Return the type corresponding to the given URI.

isClasspath

public static boolean isClasspath(URI uri)

isFactoryGenerated

public static boolean isFactoryGenerated(URI uri)

isFile

public static boolean isFile(URI uri)

isGlobal

public static boolean isGlobal(URI uri)

isLocal

public static boolean isLocal(URI uri)

isSession

public static boolean isSession(URI uri)
Is this a null URI or an URI with a 'session' scheme. URIs of this type correspond to graphs that reside in memory only (and can be persisted to a workspace).

load

public static void load(URI uri,
                        GraphBundle graphBundle)
            throws GraphURIException
Load the graph that corresponds to the given URI into the given graph bundle.
Parameters:
uri - URI that represents the graph
graphBundle - Graph bundle which will hold the result. Preferably empty.
Throws:
GraphURIException - when the graph could not be obtained from the given URI.

translateSessionURI

public static URI translateSessionURI(URI uri,
                                      File directory)
Translate a relative session URI to an absolute file URI with the given base directory. Other URIs are left intact