|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||
java.lang.Objectnet.fortytwo.sesametools.RdfListUtil
public class RdfListUtil
A utility for translating RDF lists to and from native Java lists.
| Field Summary | |
|---|---|
static boolean |
DEFAULT_CHECK_CYCLES
The default value for checkCycles if no other value is given. |
static boolean |
DEFAULT_CHECK_INCOMPLETE
The default value for checkIncomplete if no other value is given. |
static boolean |
DEFAULT_USE_ITERATIVE_ON_ERROR
The default value for useIterativeOnError if no other value is given. |
| Constructor Summary | |
|---|---|
RdfListUtil()
Constructs an instance of the RDF List Processing Utility using the default error checking and redundancy values. |
|
RdfListUtil(boolean checkCycles,
boolean checkIncomplete,
boolean useIterativeOnError)
Constructs an instance of the RDF List Processing Utility using the given values to define operational checking and redundancy parameters. |
|
| Method Summary | |
|---|---|
void |
addList(org.openrdf.model.Resource head,
List<org.openrdf.model.Value> nextValues,
org.openrdf.model.Graph graphToAddTo,
org.openrdf.model.Resource... contexts)
Adds an RDF List with the given elements to a graph. |
void |
addListAtNode(org.openrdf.model.Resource subject,
org.openrdf.model.URI predicate,
List<org.openrdf.model.Value> nextValues,
org.openrdf.model.Graph graphToAddTo,
org.openrdf.model.Resource... contexts)
Return the contents of the list serialized as an RDF list |
boolean |
getCheckCycles()
|
boolean |
getCheckIncomplete()
|
List<org.openrdf.model.Value> |
getList(org.openrdf.model.Resource head,
org.openrdf.model.Graph graphToSearch,
org.openrdf.model.Resource... contexts)
Fetches a simple (non-branching) list from a graph. |
List<org.openrdf.model.Value> |
getListAtNode(org.openrdf.model.Resource subject,
org.openrdf.model.URI predicate,
org.openrdf.model.Graph graphToSearch,
org.openrdf.model.Resource... contexts)
Fetches a single headed list from the graph based on the given subject and predicate Note: We silently fail if no list is detected at all and return null In addition, only the first triple matching the subject-predicate combination is used to detect the head of the list. |
Collection<List<org.openrdf.model.Value>> |
getLists(Set<org.openrdf.model.Resource> heads,
org.openrdf.model.Graph graphToSearch,
org.openrdf.model.Resource... contexts)
|
Collection<List<org.openrdf.model.Value>> |
getListsAtNode(org.openrdf.model.Resource subject,
org.openrdf.model.URI predicate,
org.openrdf.model.Graph graphToSearch,
org.openrdf.model.Resource... contexts)
Fetches a collection of generalized lists based on the given subject and predicate, where lists are allowed to branch from head to tail. |
Collection<List<org.openrdf.model.Value>> |
getListsIterative(Set<org.openrdf.model.Resource> heads,
org.openrdf.model.Graph graphToSearch,
org.openrdf.model.Resource... contexts)
Fetches a collection of generalized lists, where lists are allowed to branch from head to tail. |
Collection<List<org.openrdf.model.Value>> |
getListsRecursive(org.openrdf.model.Resource head,
org.openrdf.model.Graph graph,
org.openrdf.model.Resource... contexts)
|
boolean |
getUseIterativeOnError()
|
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Field Detail |
|---|
public static final boolean DEFAULT_CHECK_CYCLES
public static final boolean DEFAULT_CHECK_INCOMPLETE
public static final boolean DEFAULT_USE_ITERATIVE_ON_ERROR
| Constructor Detail |
|---|
public RdfListUtil()
public RdfListUtil(boolean checkCycles,
boolean checkIncomplete,
boolean useIterativeOnError)
checkCycles - Defines whether to check for cycles in lists.checkIncomplete - Defines whether to check for properly ended lists.useIterativeOnError - Defines whether to use iterative approach when recursive
approach fails with out of memory or stack overflow.| Method Detail |
|---|
public void addList(org.openrdf.model.Resource head,
List<org.openrdf.model.Value> nextValues,
org.openrdf.model.Graph graphToAddTo,
org.openrdf.model.Resource... contexts)
head - the head resource of the listnextValues - the list to add. If this list is empty, no statements will be
writtengraphToAddTo - the Graph to add the resulting list tocontexts - the graph contexts into which to add the new statements. If no
contexts are given, statements will be added to the default
(null) context.
public void addListAtNode(org.openrdf.model.Resource subject,
org.openrdf.model.URI predicate,
List<org.openrdf.model.Value> nextValues,
org.openrdf.model.Graph graphToAddTo,
org.openrdf.model.Resource... contexts)
subject - the subject of a new statement pointing to the head of the
listpredicate - the predicate of a new statement pointing to the head of the
listnextValues - the list to add. If this list is empty, only the pointer
statement will be written.graphToAddTo - the Graph to add the resulting list tocontexts - the graph contexts into which to add the new statements. If no
contexts are given, statements will be added to the default
(null) context.
public List<org.openrdf.model.Value> getList(org.openrdf.model.Resource head,
org.openrdf.model.Graph graphToSearch,
org.openrdf.model.Resource... contexts)
head - the head of the listgraphToSearch - the graph from which the list is to be fetchedcontexts - the graph contexts from which the list is to be fetched
public List<org.openrdf.model.Value> getListAtNode(org.openrdf.model.Resource subject,
org.openrdf.model.URI predicate,
org.openrdf.model.Graph graphToSearch,
org.openrdf.model.Resource... contexts)
subject - the subject of a statement pointing to the listpredicate - the predicate of a statement pointing to the listgraphToSearch - the graph from which the list is to be fetchedcontexts - the graph contexts from which the list is to be fetched
RuntimeException - if the list structure was not complete, or it had cycles
public Collection<List<org.openrdf.model.Value>> getListsIterative(Set<org.openrdf.model.Resource> heads,
org.openrdf.model.Graph graphToSearch,
org.openrdf.model.Resource... contexts)
heads - the heads of the lists to fetchgraphToSearch - the graph from which the list is to be fetchedcontexts - the graph contexts from which the list is to be fetched
public Collection<List<org.openrdf.model.Value>> getLists(Set<org.openrdf.model.Resource> heads,
org.openrdf.model.Graph graphToSearch,
org.openrdf.model.Resource... contexts)
public Collection<List<org.openrdf.model.Value>> getListsRecursive(org.openrdf.model.Resource head,
org.openrdf.model.Graph graph,
org.openrdf.model.Resource... contexts)
public Collection<List<org.openrdf.model.Value>> getListsAtNode(org.openrdf.model.Resource subject,
org.openrdf.model.URI predicate,
org.openrdf.model.Graph graphToSearch,
org.openrdf.model.Resource... contexts)
subject - the subject of a statement pointing to the listpredicate - the predicate of a statement pointing to the listgraphToSearch - the graph from which the list is to be fetchedcontexts - the graph contexts from which the list is to be fetched
public boolean getCheckCycles()
public boolean getCheckIncomplete()
public boolean getUseIterativeOnError()
|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||