org.openanzo.services
Interface IModelService

All Superinterfaces:
IService
All Known Implementing Classes:
EmbeddedModelService, WSModelService

public interface IModelService
extends IService

IModelService provides an endpoint that most Anzo model operations are run against.

Author:
Matthew Roy ( mroy@cambridgesemantics.com )

Method Summary
 void addInferredObject(org.openrdf.model.URI prop, org.openrdf.model.URI obj, org.openrdf.model.URI inferredObj)
          Add a mapping between a property/object pair, and the inferred property inferred object pair.
 void addInferredProperty(org.openrdf.model.URI prop, org.openrdf.model.URI inferredProp)
          Add a mapping between a property , and the inferred property.
 void close()
          Close the ModelService
 QueryResult execQuery(java.util.Set<org.openrdf.model.URI> defaultNamedGraphs, java.util.Set<org.openrdf.model.URI> namedGraphs, java.lang.String query, java.lang.String queryLanguage)
          Deprecated. use IModelService.executeQuery, no language parameter required since Sparql is now the only language
 info.aduna.collections.iterators.CloseableIterator<org.openrdf.model.Statement> execQueryIndex(java.lang.String query, int offset, int numResult)
          ExecQueryIndex runs a query against the index on the server and returns the results in a graph.
 QueryResult executeQuery(java.util.Set<org.openrdf.model.URI> defaultNamedGraphs, java.util.Set<org.openrdf.model.URI> namedGraphs, java.lang.String query)
          ExecuteQuery runs a SPARQL query on the server and returns the results in a QueryResult object.
 QueryResult executeQuery(java.util.Set<org.openrdf.model.URI> defaultNamedGraphs, java.util.Set<org.openrdf.model.URI> namedGraphs, java.lang.String query, org.openrdf.model.URI base)
          ExecuteQuery runs a SPARQL query on the server and returns the results in a QueryResult object.
 info.aduna.collections.iterators.CloseableIterator<org.openrdf.model.Statement> findStatements(org.openrdf.model.Resource subj, org.openrdf.model.URI prop, org.openrdf.model.Value obj, org.openrdf.model.Resource context)
          FindStatements returns an iterator of statements that match a Statement pattern and no inferred triples
 info.aduna.collections.iterators.CloseableIterator<org.openrdf.model.Statement> findStatements(org.openrdf.model.Resource subj, org.openrdf.model.URI prop, org.openrdf.model.Value obj, org.openrdf.model.Resource context, boolean includeInferedStatements)
          FindStatements returns an iterator of statements that match a Statement pattern
 info.aduna.collections.iterators.CloseableIterator<org.openrdf.model.Statement> findStatements(org.openrdf.model.Statement statement)
          FindStatements returns an iterator of statements that match a Statement pattern and no inferred triples
 info.aduna.collections.iterators.CloseableIterator<org.openrdf.model.Statement> findStatements(org.openrdf.model.Statement statement, boolean includeInferedStatements)
          FindStatements returns an iterator of statements that match a Statement pattern
 INamedGraphWithMetaData getCurrentNamedGraphRevision(org.openrdf.model.URI namedGraphUri)
          GetNamedGraphRevision returns a INamedGraphWithMetaData for a specific NamedGraph at the current revision
 org.openrdf.model.URI getMetadataGraphUri(org.openrdf.model.URI namedGraphUri)
           
 INamedGraphWithMetaData getNamedGraphRevision(org.openrdf.model.URI namedGraphUri, long revision)
          GetNamedGraphRevision returns a INamedGraphWithMetaData for a specific NamedGraph at a certain revision
 long getSize(org.openrdf.model.URI namedGraphUri)
           
 java.util.Set<org.openrdf.model.URI> getStoredNamedGraphs()
           
 void reset(java.util.Collection<org.openrdf.model.Statement> statements)
          Reset is a utility method that resets all data on the Anzo Server and sets system graph to some data.
 IModelUpdate updateServer(ITransaction[] transactions, boolean returnResults, boolean isIndexSynchronous)
          UpdateServer sends a set of transactions to the server to be processed.
 
Methods inherited from interface org.openanzo.services.IService
getServicePassword, getServiceUser, setServicePassword, setServiceUser
 

Method Detail

updateServer

IModelUpdate updateServer(ITransaction[] transactions,
                          boolean returnResults,
                          boolean isIndexSynchronous)
                          throws AnzoException
UpdateServer sends a set of transactions to the server to be processed.

Parameters:
transactions - Set of transactions to commit on the server.
returnResults - Should operation return the additions and deletions within the IModelUpdate object
isIndexSynchronous - Should indexer run synchronously after committal of transactions.
Returns:
IModelUpdate object containing any errors and/or results of committal if returnResults is set
Throws:
AnzoException - if there was an error updating the server

reset

void reset(java.util.Collection<org.openrdf.model.Statement> statements)
           throws AnzoException
Reset is a utility method that resets all data on the Anzo Server and sets system graph to some data. This should only be used for testing. Operation can be turned off on the server.

Parameters:
statements - Set of statements that should be added to server as initial system data
Throws:
AnzoException - if there was an error reseting the server

execQuery

QueryResult execQuery(java.util.Set<org.openrdf.model.URI> defaultNamedGraphs,
                      java.util.Set<org.openrdf.model.URI> namedGraphs,
                      java.lang.String query,
                      java.lang.String queryLanguage)
                      throws AnzoException
Deprecated. use IModelService.executeQuery, no language parameter required since Sparql is now the only language

ExecQuery runs a query on the server and returns the results in a graph.

Parameters:
defaultNamedGraphs - URIS of NamedGraphs to union together as the defaultModel for the dataset the query is run against
namedGraphs - URIS of NamedGraphs for the dataset the query is run against
query - Query string
queryLanguage - Language of query
Returns:
result of query in graph form
Throws:
AnzoException - if there was an error querying the server

executeQuery

QueryResult executeQuery(java.util.Set<org.openrdf.model.URI> defaultNamedGraphs,
                         java.util.Set<org.openrdf.model.URI> namedGraphs,
                         java.lang.String query)
                         throws AnzoException
ExecuteQuery runs a SPARQL query on the server and returns the results in a QueryResult object.

Parameters:
defaultNamedGraphs - URIS of NamedGraphs to union together as the defaultModel for the dataset the query is run against
namedGraphs - URIS of NamedGraphs for the dataset the query is run against
query - Query string
Returns:
QueryResult with results from running query
Throws:
AnzoException - if there was an error querying the server

executeQuery

QueryResult executeQuery(java.util.Set<org.openrdf.model.URI> defaultNamedGraphs,
                         java.util.Set<org.openrdf.model.URI> namedGraphs,
                         java.lang.String query,
                         org.openrdf.model.URI base)
                         throws AnzoException
ExecuteQuery runs a SPARQL query on the server and returns the results in a QueryResult object.

Parameters:
defaultNamedGraphs - URIS of NamedGraphs to union together as the defaultModel for the dataset the query is run against
namedGraphs - URIS of NamedGraphs for the dataset the query is run against
query - Query string
base - The base URI for resolving relative URIs in the SPARQL query.
Returns:
QueryResult with results from running query
Throws:
AnzoException - if there was an error querying the server

execQueryIndex

info.aduna.collections.iterators.CloseableIterator<org.openrdf.model.Statement> execQueryIndex(java.lang.String query,
                                                                                               int offset,
                                                                                               int numResult)
                                                                                               throws AnzoException
ExecQueryIndex runs a query against the index on the server and returns the results in a graph.

Parameters:
query - Query string
offset - offset into the number of results to return
numResult - number of results to return
Returns:
Iterator of statements
Throws:
AnzoException - if there was an error querying the indexer on the server

findStatements

info.aduna.collections.iterators.CloseableIterator<org.openrdf.model.Statement> findStatements(org.openrdf.model.Statement statement)
                                                                                               throws AnzoException
FindStatements returns an iterator of statements that match a Statement pattern and no inferred triples

Parameters:
statement - statement to match
Returns:
Iterator of matching statements
Throws:
AnzoException - if there was an error finding statements on the server

findStatements

info.aduna.collections.iterators.CloseableIterator<org.openrdf.model.Statement> findStatements(org.openrdf.model.Statement statement,
                                                                                               boolean includeInferedStatements)
                                                                                               throws AnzoException
FindStatements returns an iterator of statements that match a Statement pattern

Parameters:
statement - statement to match
includeInferedStatements - should inferred statements be included in find results
Returns:
Iterator of matching statements
Throws:
AnzoException - if there was an error finding statements on the server

findStatements

info.aduna.collections.iterators.CloseableIterator<org.openrdf.model.Statement> findStatements(org.openrdf.model.Resource subj,
                                                                                               org.openrdf.model.URI prop,
                                                                                               org.openrdf.model.Value obj,
                                                                                               org.openrdf.model.Resource context)
                                                                                               throws AnzoException
FindStatements returns an iterator of statements that match a Statement pattern and no inferred triples

Parameters:
subj - Subject resource to match, or wildcard if null
prop - Predicate uri to match, or wildcard if null
obj - Object value to match, or wildcard if null
context - Context values to match, or wildcard if null
Returns:
an iterator of all statements that match the pattern of subj,prop,obj,context
Throws:
AnzoException - if there was an error finding statements on the server

findStatements

info.aduna.collections.iterators.CloseableIterator<org.openrdf.model.Statement> findStatements(org.openrdf.model.Resource subj,
                                                                                               org.openrdf.model.URI prop,
                                                                                               org.openrdf.model.Value obj,
                                                                                               org.openrdf.model.Resource context,
                                                                                               boolean includeInferedStatements)
                                                                                               throws AnzoException
FindStatements returns an iterator of statements that match a Statement pattern

Parameters:
subj - Subject resource to match, or wildcard if null
prop - Predicate uri to match, or wildcard if null
obj - Object value to match, or wildcard if null
context - Context values to match, or wildcard if null
includeInferedStatements - should inferred statements be included in find results
Returns:
Iterator of matching statements
Throws:
AnzoException - if there was an error finding statements on the server

getNamedGraphRevision

INamedGraphWithMetaData getNamedGraphRevision(org.openrdf.model.URI namedGraphUri,
                                              long revision)
                                              throws AnzoException
GetNamedGraphRevision returns a INamedGraphWithMetaData for a specific NamedGraph at a certain revision

Parameters:
namedGraphUri - URI of NamedGraph to retrieve
revision - Revision of NamedGraph to retrieve
Returns:
INamedGraphWithMetaData of NamedGraph at given revision
Throws:
AnzoException - if there was an error getting NamedGraph from server

getCurrentNamedGraphRevision

INamedGraphWithMetaData getCurrentNamedGraphRevision(org.openrdf.model.URI namedGraphUri)
                                                     throws AnzoException
GetNamedGraphRevision returns a INamedGraphWithMetaData for a specific NamedGraph at the current revision

Parameters:
namedGraphUri - URI of NamedGraph to retrieve
Returns:
INamedGraphWithMetaData of NamedGraph at current revision
Throws:
AnzoException - if there was an error getting NamedGraph from server

getSize

long getSize(org.openrdf.model.URI namedGraphUri)
             throws AnzoException
Parameters:
namedGraphUri - URI of NamedGraph
Returns:
Number of triples in NamedGraph
Throws:
AnzoException - if there was an error getting size of NamedGraph from server

getMetadataGraphUri

org.openrdf.model.URI getMetadataGraphUri(org.openrdf.model.URI namedGraphUri)
                                          throws AnzoException
Parameters:
namedGraphUri - URI of NamedGraph
Returns:
the URI of the MetadataGraph for a certain NamedGraph
Throws:
AnzoException - if there was an error getting NamedGraph's metadata URI from server

close

void close()
Close the ModelService


getStoredNamedGraphs

java.util.Set<org.openrdf.model.URI> getStoredNamedGraphs()
                                                          throws AnzoException
Returns:
Set of NamedGraph URIs that user can read
Throws:
AnzoException - if there was an error getting NamedGraph's authenticated client can read from server

addInferredObject

void addInferredObject(org.openrdf.model.URI prop,
                       org.openrdf.model.URI obj,
                       org.openrdf.model.URI inferredObj)
                       throws AnzoException
Add a mapping between a property/object pair, and the inferred property inferred object pair. NOTE:Inferred data not currently used on the server

Parameters:
prop - property with inferred object
obj - object
inferredObj - inferred object
Throws:
AnzoException - if there was an error adding inferred object to server

addInferredProperty

void addInferredProperty(org.openrdf.model.URI prop,
                         org.openrdf.model.URI inferredProp)
                         throws AnzoException
Add a mapping between a property , and the inferred property. NOTE:Inferred data not currently used on the server

Parameters:
prop - property that has an inferred property
inferredProp - inferred property
Throws:
AnzoException - if there was an error adding inferred property to server


Copyright © 2007 Cambridge Semantics Inc.. All Rights Reserved.