xsmeral.semnet.query
Class QueryInterface

java.lang.Object
  extended by xsmeral.semnet.query.QueryInterface

public class QueryInterface
extends Object

Simple interface for querying of the Sesame Database. Configuration is the same as in SesameWriter.


Field Summary
static String QUERY_DESCRIBE
           
static String QUERY_DIRECTTYPE
           
static String QUERY_FULLTYPE
           
static String QUERY_WHAT
           
 
Constructor Summary
QueryInterface(Properties props)
          Initializes the repository from the given configuration.
 
Method Summary
 void close()
          Closes connection and shuts down repository.
 boolean containsLiteral(String literal)
          Indicates, whether a statement with the given String literal as object is in the repository.
 long count()
          Returns number of explicit statements in the repository.
 Collection<BindingSet> describe(URI uri)
          Similarly to DESCRIBE in SPARQL, this method returns collection of statements (as binding sets) in which the given URI is either a subject or an object.
 Collection<Value> fullType(URI uri)
          Returns full type of the resource represented by the given URI.
 RepositoryConnection getConnection()
          Returns a connection to the underlying repository.
 Repository getRepository()
          Returns the underlying repository.
 ValueFactory getValueFactory()
          Returns a value factory instance.
static void main(String[] args)
           
static void printUsage()
           
 List<BindingSet> query(String query)
          Evaluates a supplied SeRQL tuple query and returns resulting binding sets.
 Collection<Value> type(URI uri)
          Returns direct type of the resource represented by the given URI.
 Collection<Value> what(String label)
          Returns such resource X for which holds X rdfs:label Y, where Y is the given label.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

QUERY_DESCRIBE

public static final String QUERY_DESCRIBE
See Also:
Constant Field Values

QUERY_FULLTYPE

public static final String QUERY_FULLTYPE
See Also:
Constant Field Values

QUERY_DIRECTTYPE

public static final String QUERY_DIRECTTYPE
See Also:
Constant Field Values

QUERY_WHAT

public static final String QUERY_WHAT
See Also:
Constant Field Values
Constructor Detail

QueryInterface

public QueryInterface(Properties props)
               throws ConfigurationException,
                      MalformedQueryException
Initializes the repository from the given configuration.

Throws:
ConfigurationException
MalformedQueryException
Method Detail

getValueFactory

public ValueFactory getValueFactory()
Returns a value factory instance.


getRepository

public Repository getRepository()
Returns the underlying repository.


getConnection

public RepositoryConnection getConnection()
Returns a connection to the underlying repository.


containsLiteral

public boolean containsLiteral(String literal)
                        throws RepositoryException
Indicates, whether a statement with the given String literal as object is in the repository.

Throws:
RepositoryException

count

public long count()
           throws RepositoryException
Returns number of explicit statements in the repository.

Throws:
RepositoryException

type

public Collection<Value> type(URI uri)
                       throws RepositoryException,
                              MalformedQueryException,
                              QueryEvaluationException
Returns direct type of the resource represented by the given URI. A resource X is of direct type Y iff:
  1. X rdf:type Y.
  2. There is no class Z (Z != Y) such that X rdf:type Z and Z rdfs:subClassOf Y.

Throws:
RepositoryException
MalformedQueryException
QueryEvaluationException

fullType

public Collection<Value> fullType(URI uri)
                           throws RepositoryException,
                                  MalformedQueryException,
                                  QueryEvaluationException
Returns full type of the resource represented by the given URI.
That is every resource Y such that X rdf:type Y.

Throws:
RepositoryException
MalformedQueryException
QueryEvaluationException

describe

public Collection<BindingSet> describe(URI uri)
                                throws RepositoryException,
                                       MalformedQueryException,
                                       QueryEvaluationException
Similarly to DESCRIBE in SPARQL, this method returns collection of statements (as binding sets) in which the given URI is either a subject or an object.

Throws:
RepositoryException
MalformedQueryException
QueryEvaluationException

what

public Collection<Value> what(String label)
                       throws RepositoryException,
                              MalformedQueryException,
                              QueryEvaluationException
Returns such resource X for which holds X rdfs:label Y, where Y is the given label.

Throws:
RepositoryException
MalformedQueryException
QueryEvaluationException

query

public List<BindingSet> query(String query)
                       throws RepositoryException,
                              MalformedQueryException,
                              QueryEvaluationException
Evaluates a supplied SeRQL tuple query and returns resulting binding sets.

Throws:
RepositoryException
MalformedQueryException
QueryEvaluationException

close

public void close()
           throws RepositoryException
Closes connection and shuts down repository.

Throws:
RepositoryException

printUsage

public static void printUsage()

main

public static void main(String[] args)