Language:

The Free and Open Productivity Suite
Apache OpenOffice 4.1.4 released

Developer's Guide

API

SDK

Tips 'n' Tricks

Miscellaneous


:: com :: sun :: star :: rdf ::

unpublished interface XRepository
Usage Restrictions
not published
Description
provides access to a set of named RDF graphs.

A repository for storing information according to the data model of the Resource Description Framework. This interface may be used e.g. for repositories that correspond to a loaded ODF document, or for repositories that are backed by some kind of database.

The RDF triples are stored as a set of named RDF graphs. Importing and exporting files in the RDF/XML format is supported. Support for other file formats is optional. Support for querying the repository with the SPARQL query language is provided.

Since
OOo 3.2
See also
XRepositorySupplier, XDocumentRepository

Methods' Summary
createBlankNode creates a fresh unique blank node.  
importGraph imports a named graph into the repository.  
exportGraph exports a named graph from the repository.  
getGraphNames gets the names of all the graphs in the repository.  
getGraph gets a graph by its name.  
createGraph creates a graph with the given name.  
destroyGraph destroys the graph with the given name, and removes it from the repository.  
getStatements gets matching RDF statements from the repository.  
querySelect executes a SPARQL "SELECT" query.  
queryConstruct executes a SPARQL "CONSTRUCT" query.  
queryAsk executes a SPARQL "ASK" query.  
Methods' Details
createBlankNode
XBlankNode
createBlankNode();

Description
creates a fresh unique blank node.
Returns
a newly generated blank node which is unique in this repository
importGraph
XNamedGraph
importGraph( [in] short  Format,
[in] ::com::sun::star::io::XInputStream  InStream,
[in] XURI  GraphName,
[in] XURI  BaseURI )
raises( ::com::sun::star::lang::IllegalArgumentException,
::com::sun::star::datatransfer::UnsupportedFlavorException,
::com::sun::star::container::ElementExistException,
ParseException,
RepositoryException,
::com::sun::star::io::IOException );

Description
imports a named graph into the repository.

Implementations must support RDF/XML format. Support for other RDF formats is optional. If the format is not supported by the implementation, an ::com::sun::star::datatransfer::UnsupportedFlavorException is raised. If the format requires use of a BaseURI, but none is given, an ::com::sun::star::lang::IllegalArgumentException is raised.

Parameter Format
the format of the input file
Parameter InStream
the input stream, containing an RDF file in the specified format
Parameter GraphName
the name of the graph that is imported
Parameter BaseURI
a base URI to resolve relative URI references
Returns
the imported graph
Throws
com::sun::star::lang::IllegalArgumentException if the given stream or the GraphName is NULL, or BaseURI is NULL and the format requires use of a base URI
Throws
com::sun::star::datatransfer::UnsupportedFlavorException if the format requested is unknown or not supported
Throws
com::sun::star::container::ElementExistException if a graph with the given GraphName already exists in the repository
Throws
ParseException if the input does not conform to the specified file format.
Throws
RepositoryException if an error occurs when accessing the repository.
Throws
com::sun::star::io::IOException if an I/O error occurs.
See also
FileFormat
exportGraph
void
exportGraph( [in] short  Format,
[in] ::com::sun::star::io::XOutputStream  OutStream,
[in] XURI  GraphName,
[in] XURI  BaseURI )
raises( ::com::sun::star::lang::IllegalArgumentException,
::com::sun::star::datatransfer::UnsupportedFlavorException,
::com::sun::star::container::NoSuchElementException,
RepositoryException,
::com::sun::star::io::IOException );

Description
exports a named graph from the repository.

Implementations must support RDF/XML format. Support for other RDF formats is optional. If the format is not supported by the implementation, an ::com::sun::star::datatransfer::UnsupportedFlavorException is raised.

Parameter Format
the format of the output file
Parameter OutStream
the target output stream
Parameter GraphName
the name of the graph that is to be exported
Parameter BaseURI
a base URI to resolve relative URI references
Throws
com::sun::star::lang::IllegalArgumentException if the given stream or the GraphName is NULL, or BaseURI is NULL and the format requires use of a base URI
Throws
com::sun::star::datatransfer::UnsupportedFlavorException if the format requested is unknown or not supported
Throws
com::sun::star::container::NoSuchElementException if a graph with the given GraphName does not exist
Throws
RepositoryException if an error occurs when accessing the repository.
Throws
com::sun::star::io::IOException if an I/O error occurs.
See also
FileFormat
getGraphNames
sequence< XURI >
getGraphNames()
raises( RepositoryException );

Description
gets the names of all the graphs in the repository.
Returns
a list containing the names of the graphs in the repository
Throws
RepositoryException if an error occurs when accessing the repository.
getGraph
XNamedGraph
getGraph( [in] XURI  GraphName )
raises( ::com::sun::star::lang::IllegalArgumentException,
RepositoryException );

Description
gets a graph by its name.
Parameter GraphName
the name of the graph that is to be returned
Returns
the graph with the given name if it exists, else NULL
Throws
com::sun::star::lang::IllegalArgumentException if the given GraphName is invalid
Throws
RepositoryException if an error occurs when accessing the repository.
createGraph
XNamedGraph
createGraph( [in] XURI  GraphName )
raises( ::com::sun::star::lang::IllegalArgumentException,
::com::sun::star::container::ElementExistException,
RepositoryException );

Description
creates a graph with the given name.

The name must be unique within the repository.

Parameter GraphName
the name of the graph that is to be created
Returns
the graph with the given name
Throws
com::sun::star::lang::IllegalArgumentException if the given GraphName is invalid
Throws
com::sun::star::container::ElementExistException if a graph with the given GraphName already exists
Throws
RepositoryException if an error occurs when accessing the repository.
destroyGraph
void
destroyGraph( [in] XURI  GraphName )
raises( ::com::sun::star::lang::IllegalArgumentException,
::com::sun::star::container::NoSuchElementException,
RepositoryException );

Description
destroys the graph with the given name, and removes it from the repository.

This invalidates any instances of XNamedGraph for the argument.

Parameter GraphName
the name of the graph that is to be destroyed
Throws
com::sun::star::lang::IllegalArgumentException if the given GraphName is invalid
Throws
com::sun::star::container::NoSuchElementException if a graph with the given GraphName does not exist
Throws
RepositoryException if an error occurs when accessing the repository.
getStatements
::com::sun::star::container::XEnumeration
getStatements( [in] XResource  Subject,
[in] XURI  Predicate,
[in] XNode  Object )
raises( RepositoryException );

Description
gets matching RDF statements from the repository.

Any parameter may be NULL, which acts as a wildcard. For example, to get all statements about myURI: getStatements(myURI, null, null)

Parameter Subject
the subject of the RDF triple.
Parameter Predicate
the predicate of the RDF triple.
Parameter Object
the object of the RDF triple.
Returns
an iterator over all RDF statements in the repository that match the parameters, represented as an enumeration of Statement
Throws
RepositoryException if an error occurs when accessing the repository.
See also
Statement, XNamedGraph::getStatements
querySelect
XQuerySelectResult
querySelect( [in] string  Query )
raises( QueryException,
RepositoryException );

Description
executes a SPARQL "SELECT" query.

This method runs a SPARQL query that returns a list of variable bindings, i.e., a query beginning with "SELECT". The result is basically a (rectangular) table with labeled columns, where individual cells may be NULL.

Parameter Query
the SPARQL query string
Returns
an enumeration, containing
  1. a list of query variable names (column labels)
  2. the query results (rows), each being a list of bindings for the above variables
Throws
QueryException if the query is malformed, or evaluation fails
Throws
RepositoryException if an error occurs when accessing the repository.
See also
XQuerySelectResult
queryConstruct
::com::sun::star::container::XEnumeration
queryConstruct( [in] string  Query )
raises( QueryException,
RepositoryException );

Description
executes a SPARQL "CONSTRUCT" query.

This method runs a SPARQL query that constructs a result graph, i.e., a query beginning with "CONSTRUCT".

Parameter Query
the SPARQL query string
Returns
an iterator over the query result graph, represented as an enumeration of Statement
Throws
QueryException if the query is malformed, or evaluation fails
Throws
RepositoryException if an error occurs when accessing the repository.
See also
Statement
queryAsk
boolean
queryAsk( [in] string  Query )
raises( QueryException,
RepositoryException );

Description
executes a SPARQL "ASK" query.

This method runs a SPARQL query that computes a boolean, i.e., a query beginning with "ASK".

Parameter Query
the SPARQL query string
Returns
the boolean query result
Throws
QueryException if the query is malformed, or evaluation fails
Throws
RepositoryException if an error occurs when accessing the repository.
Top of Page

Apache Software Foundation

Copyright & License | Privacy | Contact Us | Donate | Thanks

Apache and the Apache feather logo are trademarks of The Apache Software Foundation. OpenOffice, OpenOffice.org and the seagull logo are registered trademarks of The Apache Software Foundation. Other names appearing on the site may be trademarks of their respective owners.