Update ooo320-m1
[ooovba.git] / offapi / com / sun / star / rdf / XRepository.idl
blob6f6e12a2ea5be73c152aa06445bf9372fd80ca91
1 /*************************************************************************
3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
5 * Copyright 2008 by Sun Microsystems, Inc.
7 * OpenOffice.org - a multi-platform office productivity suite
9 * $RCSfile: XRepository.idl,v $
10 * $Revision: 1.2 $
12 * This file is part of OpenOffice.org.
14 * OpenOffice.org is free software: you can redistribute it and/or modify
15 * it under the terms of the GNU Lesser General Public License version 3
16 * only, as published by the Free Software Foundation.
18 * OpenOffice.org is distributed in the hope that it will be useful,
19 * but WITHOUT ANY WARRANTY; without even the implied warranty of
20 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
21 * GNU Lesser General Public License version 3 for more details
22 * (a copy is included in the LICENSE file that accompanied this code).
24 * You should have received a copy of the GNU Lesser General Public License
25 * version 3 along with OpenOffice.org. If not, see
26 * <http://www.openoffice.org/license.html>
27 * for a copy of the LGPLv3 License.
29 ************************************************************************/
31 #ifndef __com_sun_star_rdf_XRepository_idl__
32 #define __com_sun_star_rdf_XRepository_idl__
34 #ifndef __com_sun_star_lang_IllegalArgumentException_idl__
35 #include <com/sun/star/lang/IllegalArgumentException.idl>
36 #endif
38 #ifndef __com_sun_star_container_ElementExistException_idl__
39 #include <com/sun/star/container/ElementExistException.idl>
40 #endif
42 #ifndef __com_sun_star_container_NoSuchElementException_idl__
43 #include <com/sun/star/container/NoSuchElementException.idl>
44 #endif
46 #ifndef __com_sun_star_container_XEnumeration_idl__
47 #include <com/sun/star/container/XEnumeration.idl>
48 #endif
50 #ifndef __com_sun_star_io_IOException_idl__
51 #include <com/sun/star/io/IOException.idl>
52 #endif
54 #ifndef __com_sun_star_io_XInputStream_idl__
55 #include <com/sun/star/io/XInputStream.idl>
56 #endif
58 #ifndef __com_sun_star_io_XOutputStream_idl__
59 #include <com/sun/star/io/XOutputStream.idl>
60 #endif
62 #ifndef __com_sun_star_datatransfer_UnsupportedFlavorException_idl__
63 #include <com/sun/star/datatransfer/UnsupportedFlavorException.idl>
64 #endif
66 #ifndef __com_sun_star_rdf_FileFormat_idl__
67 #include <com/sun/star/rdf/FileFormat.idl>
68 #endif
70 #ifndef __com_sun_star_rdf_ParseException_idl__
71 #include <com/sun/star/rdf/ParseException.idl>
72 #endif
74 #ifndef __com_sun_star_rdf_QueryException_idl__
75 #include <com/sun/star/rdf/QueryException.idl>
76 #endif
78 #ifndef __com_sun_star_rdf_RepositoryException_idl__
79 #include <com/sun/star/rdf/RepositoryException.idl>
80 #endif
82 #ifndef __com_sun_star_rdf_XBlankNode_idl__
83 #include <com/sun/star/rdf/XBlankNode.idl>
84 #endif
86 #ifndef __com_sun_star_rdf_XURI_idl__
87 #include <com/sun/star/rdf/XURI.idl>
88 #endif
90 #ifndef __com_sun_star_rdf_Statement_idl__
91 #include <com/sun/star/rdf/Statement.idl>
92 #endif
94 #ifndef __com_sun_star_rdf_XQuerySelectResult_idl__
95 #include <com/sun/star/rdf/XQuerySelectResult.idl>
96 #endif
98 #ifndef __com_sun_star_rdf_XNamedGraph_idl__
99 #include <com/sun/star/rdf/XNamedGraph.idl>
100 #endif
103 //=============================================================================
105 module com { module sun { module star { module rdf {
107 //=============================================================================
108 /** provides access to a set of named RDF graphs.
111 A repository for storing information according to the data model of the
112 <a href="http://www.w3.org/RDF/">Resource Description Framework</a>.
113 This interface may be used e.g. for repositories that correspond to a
114 loaded ODF document, or for repositories that are backed by some kind of
115 database.
116 </p>
118 The RDF triples are stored as a set of named RDF graphs.
119 Importing and exporting files in the
120 <a href="http://www.w3.org/TR/rdf-syntax-grammar/">RDF/XML</a>
121 format is supported.
122 Support for other file formats is optional.
123 Support for querying the repository with the
124 <a href="http://www.w3.org/TR/rdf-sparql-query/">SPARQL</a>
125 query language is provided.
126 </p>
129 @since OOo 3.2
131 @see XRepositorySupplier
132 @see XDocumentRepository
134 interface XRepository
137 //-------------------------------------------------------------------------
138 /** creates a fresh unique blank node.
140 @returns
141 a newly generated blank node which is unique in this repository
143 XBlankNode createBlankNode();
146 //-------------------------------------------------------------------------
147 /** imports a named graph into the repository.
150 Implementations must support RDF/XML format.
151 Support for other RDF formats is optional.
152 If the format is not supported by the implementation, an
153 <type scope="com::sun::star::datatransfer">UnsupportedFlavorException
154 </type> is raised.
155 If the format requires use of a BaseURI, but none is given, an
156 <type scope="com::sun::star::lang">IllegalArgumentException</type>
157 is raised.
158 </p>
160 @param Format
161 the format of the input file
163 @param InStream
164 the input stream, containing an RDF file in the specified format
166 @param GraphName
167 the name of the graph that is imported
169 @param BaseURI
170 a base URI to resolve relative URI references
172 @returns
173 the imported graph
175 @throws com::sun::star::lang::IllegalArgumentException
176 if the given stream or the GraphName is <NULL/>,
177 or BaseURI is <NULL/> and the format requires use of a base URI
179 @throws com::sun::star::datatransfer::UnsupportedFlavorException
180 if the format requested is unknown or not supported
182 @throws com::sun::star::container::ElementExistException
183 if a graph with the given GraphName already exists in the
184 repository
186 @throws ParseException
187 if the input does not conform to the specified file format.
189 @throws RepositoryException
190 if an error occurs when accessing the repository.
192 @throws com::sun::star::io::IOException
193 if an I/O error occurs.
195 @see FileFormat
197 XNamedGraph importGraph([in] /*FileFormat*/ short Format,
198 [in] com::sun::star::io::XInputStream InStream,
199 [in] XURI GraphName, [in] XURI BaseURI)
200 raises( com::sun::star::lang::IllegalArgumentException,
201 com::sun::star::datatransfer::UnsupportedFlavorException,
202 com::sun::star::container::ElementExistException,
203 ParseException,
204 RepositoryException,
205 com::sun::star::io::IOException );
207 //-------------------------------------------------------------------------
208 /** exports a named graph from the repository.
211 Implementations must support RDF/XML format.
212 Support for other RDF formats is optional.
213 If the format is not supported by the implementation, an
214 <type scope="com::sun::star::datatransfer">UnsupportedFlavorException
215 </type> is raised.
216 </p>
218 @param Format
219 the format of the output file
221 @param OutStream
222 the target output stream
224 @param GraphName
225 the name of the graph that is to be exported
227 @param BaseURI
228 a base URI to resolve relative URI references
230 @throws com::sun::star::lang::IllegalArgumentException
231 if the given stream or the GraphName is <NULL/>,
232 or BaseURI is <NULL/> and the format requires use of a base URI
234 @throws com::sun::star::datatransfer::UnsupportedFlavorException
235 if the format requested is unknown or not supported
237 @throws com::sun::star::container::NoSuchElementException
238 if a graph with the given GraphName does not exist
240 @throws RepositoryException
241 if an error occurs when accessing the repository.
243 @throws com::sun::star::io::IOException
244 if an I/O error occurs.
246 @see FileFormat
248 void exportGraph([in] /*FileFormat*/ short Format,
249 [in] com::sun::star::io::XOutputStream OutStream,
250 [in] XURI GraphName, [in] XURI BaseURI)
251 raises( com::sun::star::lang::IllegalArgumentException,
252 com::sun::star::datatransfer::UnsupportedFlavorException,
253 com::sun::star::container::NoSuchElementException,
254 RepositoryException,
255 com::sun::star::io::IOException );
257 //-------------------------------------------------------------------------
258 /** gets the names of all the graphs in the repository.
260 @returns
261 a list containing the names of the graphs in the repository
263 @throws RepositoryException
264 if an error occurs when accessing the repository.
266 sequence<XURI> getGraphNames()
267 raises( RepositoryException );
269 //-------------------------------------------------------------------------
270 /** gets a graph by its name.
272 @param GraphName
273 the name of the graph that is to be returned
275 @returns
276 the graph with the given name if it exists, else <NULL/>
278 @throws com::sun::star::lang::IllegalArgumentException
279 if the given GraphName is invalid
281 @throws RepositoryException
282 if an error occurs when accessing the repository.
284 XNamedGraph getGraph([in] XURI GraphName)
285 raises( com::sun::star::lang::IllegalArgumentException,
286 RepositoryException );
288 //-------------------------------------------------------------------------
289 /** creates a graph with the given name.
292 The name must be unique within the repository.
293 </p>
295 @param GraphName
296 the name of the graph that is to be created
298 @returns
299 the graph with the given name
301 @throws com::sun::star::lang::IllegalArgumentException
302 if the given GraphName is invalid
304 @throws com::sun::star::container::ElementExistException
305 if a graph with the given GraphName already exists
307 @throws RepositoryException
308 if an error occurs when accessing the repository.
310 XNamedGraph createGraph([in] XURI GraphName)
311 raises( com::sun::star::lang::IllegalArgumentException,
312 com::sun::star::container::ElementExistException,
313 RepositoryException );
315 //-------------------------------------------------------------------------
316 /** destroys the graph with the given name, and removes it from the
317 repository.
320 This invalidates any instances of <type>XNamedGraph</type>
321 for the argument.
322 </p>
324 @param GraphName
325 the name of the graph that is to be destroyed
327 @throws com::sun::star::lang::IllegalArgumentException
328 if the given GraphName is invalid
330 @throws com::sun::star::container::NoSuchElementException
331 if a graph with the given GraphName does not exist
333 @throws RepositoryException
334 if an error occurs when accessing the repository.
336 void destroyGraph([in] XURI GraphName)
337 raises( com::sun::star::lang::IllegalArgumentException,
338 com::sun::star::container::NoSuchElementException,
339 RepositoryException );
341 //-------------------------------------------------------------------------
342 /** gets matching RDF statements from the repository.
345 Any parameter may be <NULL/>, which acts as a wildcard.
346 For example, to get all statements about myURI:
347 <code>getStatements(myURI, null, null)</code>
348 </p>
350 @param Subject
351 the subject of the RDF triple.
353 @param Predicate
354 the predicate of the RDF triple.
356 @param Object
357 the object of the RDF triple.
359 @returns
360 an iterator over all RDF statements in the repository that match
361 the parameters, represented as an
362 enumeration of <type>Statement</type>
364 @throws RepositoryException
365 if an error occurs when accessing the repository.
367 @see Statement
368 @see XNamedGraph::getStatements
370 com::sun::star::container::XEnumeration/*<Statement>*/ getStatements(
371 [in] XResource Subject,
372 [in] XURI Predicate,
373 [in] XNode Object)
374 raises( RepositoryException );
377 //-------------------------------------------------------------------------
378 /** executes a SPARQL "SELECT" query.
381 This method runs a SPARQL query that returns a list of variable
382 bindings, i.e., a query beginning with "SELECT".
383 The result is basically a (rectangular) table with labeled columns,
384 where individual cells may be <NULL/>.
385 </p>
387 @param Query
388 the SPARQL query <atom>string</atom>
390 @returns
391 an enumeration, containing
392 <ol>
393 <li>a list of query variable names (column labels)</li>
394 <li>the query results (rows),
395 each being a list of bindings for the above variables</li>
396 </ol>
398 @throws QueryException
399 if the query is malformed, or evaluation fails
401 @throws RepositoryException
402 if an error occurs when accessing the repository.
404 @see XQuerySelectResult
406 XQuerySelectResult querySelect([in] string Query)
407 raises( QueryException,
408 RepositoryException );
410 //-------------------------------------------------------------------------
411 /** executes a SPARQL "CONSTRUCT" query.
414 This method runs a SPARQL query that constructs a result graph,
415 i.e., a query beginning with "CONSTRUCT".
416 </p>
418 @param Query
419 the SPARQL query <atom>string</atom>
421 @returns
422 an iterator over the query result graph, represented as an
423 enumeration of <type>Statement</type>
425 @throws QueryException
426 if the query is malformed, or evaluation fails
428 @throws RepositoryException
429 if an error occurs when accessing the repository.
431 @see Statement
433 com::sun::star::container::XEnumeration/*<Statement>*/ queryConstruct(
434 [in] string Query)
435 raises( QueryException,
436 RepositoryException );
438 //-------------------------------------------------------------------------
439 /** executes a SPARQL "ASK" query.
442 This method runs a SPARQL query that computes a boolean,
443 i.e., a query beginning with "ASK".
444 </p>
446 @param Query
447 the SPARQL query <atom>string</atom>
449 @returns
450 the boolean query result
452 @throws QueryException
453 if the query is malformed, or evaluation fails
455 @throws RepositoryException
456 if an error occurs when accessing the repository.
458 boolean queryAsk([in] string Query)
459 raises( QueryException,
460 RepositoryException );
464 //=============================================================================
466 }; }; }; };
468 #endif