1 /*************************************************************************
3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
5 * Copyright 2000, 2010 Oracle and/or its affiliates.
7 * OpenOffice.org - a multi-platform office productivity suite
9 * This file is part of OpenOffice.org.
11 * OpenOffice.org is free software: you can redistribute it and/or modify
12 * it under the terms of the GNU Lesser General Public License version 3
13 * only, as published by the Free Software Foundation.
15 * OpenOffice.org is distributed in the hope that it will be useful,
16 * but WITHOUT ANY WARRANTY; without even the implied warranty of
17 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
18 * GNU Lesser General Public License version 3 for more details
19 * (a copy is included in the LICENSE file that accompanied this code).
21 * You should have received a copy of the GNU Lesser General Public License
22 * version 3 along with OpenOffice.org. If not, see
23 * <http://www.openoffice.org/license.html>
24 * for a copy of the LGPLv3 License.
26 ************************************************************************/
28 #ifndef __com_sun_star_rdf_XRepository_idl__
29 #define __com_sun_star_rdf_XRepository_idl__
31 #ifndef __com_sun_star_lang_IllegalArgumentException_idl__
32 #include
<com
/sun
/star
/lang
/IllegalArgumentException.idl
>
35 #ifndef __com_sun_star_container_ElementExistException_idl__
36 #include
<com
/sun
/star
/container
/ElementExistException.idl
>
39 #ifndef __com_sun_star_container_NoSuchElementException_idl__
40 #include
<com
/sun
/star
/container
/NoSuchElementException.idl
>
43 #ifndef __com_sun_star_container_XEnumeration_idl__
44 #include
<com
/sun
/star
/container
/XEnumeration.idl
>
47 #ifndef __com_sun_star_io_IOException_idl__
48 #include
<com
/sun
/star
/io
/IOException.idl
>
51 #ifndef __com_sun_star_io_XInputStream_idl__
52 #include
<com
/sun
/star
/io
/XInputStream.idl
>
55 #ifndef __com_sun_star_io_XOutputStream_idl__
56 #include
<com
/sun
/star
/io
/XOutputStream.idl
>
59 #ifndef __com_sun_star_datatransfer_UnsupportedFlavorException_idl__
60 #include
<com
/sun
/star
/datatransfer
/UnsupportedFlavorException.idl
>
63 #ifndef __com_sun_star_rdf_FileFormat_idl__
64 #include
<com
/sun
/star
/rdf
/FileFormat.idl
>
67 #ifndef __com_sun_star_rdf_ParseException_idl__
68 #include
<com
/sun
/star
/rdf
/ParseException.idl
>
71 #ifndef __com_sun_star_rdf_QueryException_idl__
72 #include
<com
/sun
/star
/rdf
/QueryException.idl
>
75 #ifndef __com_sun_star_rdf_RepositoryException_idl__
76 #include
<com
/sun
/star
/rdf
/RepositoryException.idl
>
79 #ifndef __com_sun_star_rdf_XBlankNode_idl__
80 #include
<com
/sun
/star
/rdf
/XBlankNode.idl
>
83 #ifndef __com_sun_star_rdf_XURI_idl__
84 #include
<com
/sun
/star
/rdf
/XURI.idl
>
87 #ifndef __com_sun_star_rdf_Statement_idl__
88 #include
<com
/sun
/star
/rdf
/Statement.idl
>
91 #ifndef __com_sun_star_rdf_XQuerySelectResult_idl__
92 #include
<com
/sun
/star
/rdf
/XQuerySelectResult.idl
>
95 #ifndef __com_sun_star_rdf_XNamedGraph_idl__
96 #include
<com
/sun
/star
/rdf
/XNamedGraph.idl
>
100 //=============================================================================
102 module com
{ module sun
{ module star
{ module rdf
{
104 //=============================================================================
105 /** provides access to a set of named RDF graphs.
108 A repository for storing information according to the data model of the
109 <a href="http://www.w3.org/RDF/">Resource Description Framework</a>.
110 This interface may be used e.g. for repositories that correspond to a
111 loaded ODF document, or for repositories that are backed by some kind of
115 The RDF triples are stored as a set of named RDF graphs.
116 Importing and exporting files in the
117 <a href="http://www.w3.org/TR/rdf-syntax-grammar/">RDF/XML</a>
119 Support for other file formats is optional.
120 Support for querying the repository with the
121 <a href="http://www.w3.org/TR/rdf-sparql-query/">SPARQL</a>
122 query language is provided.
128 @see XRepositorySupplier
129 @see XDocumentRepository
131 interface XRepository
134 //-------------------------------------------------------------------------
135 /** creates a fresh unique blank node.
138 a newly generated blank node which is unique in this repository
140 XBlankNode createBlankNode
();
143 //-------------------------------------------------------------------------
144 /** imports a named graph into the repository.
147 Implementations must support RDF/XML format.
148 Support for other RDF formats is optional.
149 If the format is not supported by the implementation, an
150 <type scope="com::sun::star::datatransfer">UnsupportedFlavorException
152 If the format requires use of a BaseURI, but none is given, an
153 <type scope="com::sun::star::lang">IllegalArgumentException</type>
158 the format of the input file
161 the input stream, containing an RDF file in the specified format
164 the name of the graph that is imported
167 a base URI to resolve relative URI references
172 @throws com::sun::star::lang::IllegalArgumentException
173 if the given stream or the GraphName is <NULL/>,
174 or BaseURI is <NULL/> and the format requires use of a base URI
176 @throws com::sun::star::datatransfer::UnsupportedFlavorException
177 if the format requested is unknown or not supported
179 @throws com::sun::star::container::ElementExistException
180 if a graph with the given GraphName already exists in the
183 @throws ParseException
184 if the input does not conform to the specified file format.
186 @throws RepositoryException
187 if an error occurs when accessing the repository.
189 @throws com::sun::star::io::IOException
190 if an I/O error occurs.
194 XNamedGraph importGraph
([in] /*FileFormat*/ short Format
,
195 [in] com
::sun
::star
::io
::XInputStream InStream
,
196 [in] XURI GraphName
, [in] XURI BaseURI
)
197 raises
( com
::sun
::star
::lang
::IllegalArgumentException
,
198 com
::sun
::star
::datatransfer
::UnsupportedFlavorException
,
199 com
::sun
::star
::container
::ElementExistException
,
202 com
::sun
::star
::io
::IOException
);
204 //-------------------------------------------------------------------------
205 /** exports a named graph from the repository.
208 Implementations must support RDF/XML format.
209 Support for other RDF formats is optional.
210 If the format is not supported by the implementation, an
211 <type scope="com::sun::star::datatransfer">UnsupportedFlavorException
216 the format of the output file
219 the target output stream
222 the name of the graph that is to be exported
225 a base URI to resolve relative URI references
227 @throws com::sun::star::lang::IllegalArgumentException
228 if the given stream or the GraphName is <NULL/>,
229 or BaseURI is <NULL/> and the format requires use of a base URI
231 @throws com::sun::star::datatransfer::UnsupportedFlavorException
232 if the format requested is unknown or not supported
234 @throws com::sun::star::container::NoSuchElementException
235 if a graph with the given GraphName does not exist
237 @throws RepositoryException
238 if an error occurs when accessing the repository.
240 @throws com::sun::star::io::IOException
241 if an I/O error occurs.
245 void exportGraph
([in] /*FileFormat*/ short Format
,
246 [in] com
::sun
::star
::io
::XOutputStream OutStream
,
247 [in] XURI GraphName
, [in] XURI BaseURI
)
248 raises
( com
::sun
::star
::lang
::IllegalArgumentException
,
249 com
::sun
::star
::datatransfer
::UnsupportedFlavorException
,
250 com
::sun
::star
::container
::NoSuchElementException
,
252 com
::sun
::star
::io
::IOException
);
254 //-------------------------------------------------------------------------
255 /** gets the names of all the graphs in the repository.
258 a list containing the names of the graphs in the repository
260 @throws RepositoryException
261 if an error occurs when accessing the repository.
263 sequence
<XURI
> getGraphNames
()
264 raises
( RepositoryException
);
266 //-------------------------------------------------------------------------
267 /** gets a graph by its name.
270 the name of the graph that is to be returned
273 the graph with the given name if it exists, else <NULL/>
275 @throws com::sun::star::lang::IllegalArgumentException
276 if the given GraphName is invalid
278 @throws RepositoryException
279 if an error occurs when accessing the repository.
281 XNamedGraph getGraph
([in] XURI GraphName
)
282 raises
( com
::sun
::star
::lang
::IllegalArgumentException
,
283 RepositoryException
);
285 //-------------------------------------------------------------------------
286 /** creates a graph with the given name.
289 The name must be unique within the repository.
293 the name of the graph that is to be created
296 the graph with the given name
298 @throws com::sun::star::lang::IllegalArgumentException
299 if the given GraphName is invalid
301 @throws com::sun::star::container::ElementExistException
302 if a graph with the given GraphName already exists
304 @throws RepositoryException
305 if an error occurs when accessing the repository.
307 XNamedGraph createGraph
([in] XURI GraphName
)
308 raises
( com
::sun
::star
::lang
::IllegalArgumentException
,
309 com
::sun
::star
::container
::ElementExistException
,
310 RepositoryException
);
312 //-------------------------------------------------------------------------
313 /** destroys the graph with the given name, and removes it from the
317 This invalidates any instances of <type>XNamedGraph</type>
322 the name of the graph that is to be destroyed
324 @throws com::sun::star::lang::IllegalArgumentException
325 if the given GraphName is invalid
327 @throws com::sun::star::container::NoSuchElementException
328 if a graph with the given GraphName does not exist
330 @throws RepositoryException
331 if an error occurs when accessing the repository.
333 void destroyGraph
([in] XURI GraphName
)
334 raises
( com
::sun
::star
::lang
::IllegalArgumentException
,
335 com
::sun
::star
::container
::NoSuchElementException
,
336 RepositoryException
);
338 //-------------------------------------------------------------------------
339 /** gets matching RDF statements from the repository.
342 Any parameter may be <NULL/>, which acts as a wildcard.
343 For example, to get all statements about myURI:
344 <code>getStatements(myURI, null, null)</code>
348 the subject of the RDF triple.
351 the predicate of the RDF triple.
354 the object of the RDF triple.
357 an iterator over all RDF statements in the repository that match
358 the parameters, represented as an
359 enumeration of <type>Statement</type>
361 @throws RepositoryException
362 if an error occurs when accessing the repository.
365 @see XNamedGraph::getStatements
367 com
::sun
::star
::container
::XEnumeration
/*<Statement>*/ getStatements
(
368 [in] XResource Subject
,
371 raises
( RepositoryException
);
374 //-------------------------------------------------------------------------
375 /** executes a SPARQL "SELECT" query.
378 This method runs a SPARQL query that returns a list of variable
379 bindings, i.e., a query beginning with "SELECT".
380 The result is basically a (rectangular) table with labeled columns,
381 where individual cells may be <NULL/>.
385 the SPARQL query <atom>string</atom>
388 an enumeration, containing
390 <li>a list of query variable names (column labels)</li>
391 <li>the query results (rows),
392 each being a list of bindings for the above variables</li>
395 @throws QueryException
396 if the query is malformed, or evaluation fails
398 @throws RepositoryException
399 if an error occurs when accessing the repository.
401 @see XQuerySelectResult
403 XQuerySelectResult querySelect
([in] string Query
)
404 raises
( QueryException
,
405 RepositoryException
);
407 //-------------------------------------------------------------------------
408 /** executes a SPARQL "CONSTRUCT" query.
411 This method runs a SPARQL query that constructs a result graph,
412 i.e., a query beginning with "CONSTRUCT".
416 the SPARQL query <atom>string</atom>
419 an iterator over the query result graph, represented as an
420 enumeration of <type>Statement</type>
422 @throws QueryException
423 if the query is malformed, or evaluation fails
425 @throws RepositoryException
426 if an error occurs when accessing the repository.
430 com
::sun
::star
::container
::XEnumeration
/*<Statement>*/ queryConstruct
(
432 raises
( QueryException
,
433 RepositoryException
);
435 //-------------------------------------------------------------------------
436 /** executes a SPARQL "ASK" query.
439 This method runs a SPARQL query that computes a boolean,
440 i.e., a query beginning with "ASK".
444 the SPARQL query <atom>string</atom>
447 the boolean query result
449 @throws QueryException
450 if the query is malformed, or evaluation fails
452 @throws RepositoryException
453 if an error occurs when accessing the repository.
455 boolean queryAsk
([in] string Query
)
456 raises
( QueryException
,
457 RepositoryException
);
461 //=============================================================================