summaryrefslogtreecommitdiff
path: root/offapi/com/sun/star/rdf/XRepository.idl
blob: 1b76ff1158a7cab7709a879b52f00dcca31e96da (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
/*************************************************************************
 *
 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
 *
 * Copyright 2000, 2010 Oracle and/or its affiliates.
 *
 * OpenOffice.org - a multi-platform office productivity suite
 *
 * This file is part of OpenOffice.org.
 *
 * OpenOffice.org is free software: you can redistribute it and/or modify
 * it under the terms of the GNU Lesser General Public License version 3
 * only, as published by the Free Software Foundation.
 *
 * OpenOffice.org is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 * GNU Lesser General Public License version 3 for more details
 * (a copy is included in the LICENSE file that accompanied this code).
 *
 * You should have received a copy of the GNU Lesser General Public License
 * version 3 along with OpenOffice.org.  If not, see
 * <http://www.openoffice.org/license.html>
 * for a copy of the LGPLv3 License.
 *
 ************************************************************************/

#ifndef __com_sun_star_rdf_XRepository_idl__
#define __com_sun_star_rdf_XRepository_idl__

#ifndef __com_sun_star_lang_IllegalArgumentException_idl__
#include <com/sun/star/lang/IllegalArgumentException.idl>
#endif

#ifndef __com_sun_star_container_ElementExistException_idl__
#include <com/sun/star/container/ElementExistException.idl>
#endif

#ifndef __com_sun_star_container_NoSuchElementException_idl__
#include <com/sun/star/container/NoSuchElementException.idl>
#endif

#ifndef __com_sun_star_container_XEnumeration_idl__
#include <com/sun/star/container/XEnumeration.idl>
#endif

#ifndef __com_sun_star_io_IOException_idl__
#include <com/sun/star/io/IOException.idl>
#endif

#ifndef __com_sun_star_io_XInputStream_idl__
#include <com/sun/star/io/XInputStream.idl>
#endif

#ifndef __com_sun_star_io_XOutputStream_idl__
#include <com/sun/star/io/XOutputStream.idl>
#endif

#ifndef __com_sun_star_datatransfer_UnsupportedFlavorException_idl__
#include <com/sun/star/datatransfer/UnsupportedFlavorException.idl>
#endif

#ifndef __com_sun_star_rdf_FileFormat_idl__
#include <com/sun/star/rdf/FileFormat.idl>
#endif

#ifndef __com_sun_star_rdf_ParseException_idl__
#include <com/sun/star/rdf/ParseException.idl>
#endif

#ifndef __com_sun_star_rdf_QueryException_idl__
#include <com/sun/star/rdf/QueryException.idl>
#endif

#ifndef __com_sun_star_rdf_RepositoryException_idl__
#include <com/sun/star/rdf/RepositoryException.idl>
#endif

#ifndef __com_sun_star_rdf_XBlankNode_idl__
#include <com/sun/star/rdf/XBlankNode.idl>
#endif

#ifndef __com_sun_star_rdf_XURI_idl__
#include <com/sun/star/rdf/XURI.idl>
#endif

#ifndef __com_sun_star_rdf_Statement_idl__
#include <com/sun/star/rdf/Statement.idl>
#endif

#ifndef __com_sun_star_rdf_XQuerySelectResult_idl__
#include <com/sun/star/rdf/XQuerySelectResult.idl>
#endif

#ifndef __com_sun_star_rdf_XNamedGraph_idl__
#include <com/sun/star/rdf/XNamedGraph.idl>
#endif


//=============================================================================

module com {   module sun {   module star {   module rdf {

//=============================================================================
/** provides access to a set of named RDF graphs.

    <p>
    A repository for storing information according to the data model of the
    <a href="http://www.w3.org/RDF/">Resource Description Framework</a>.
    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.
    </p>
    <p>
    The RDF triples are stored as a set of named RDF graphs.
    Importing and exporting files in the
    <a href="http://www.w3.org/TR/rdf-syntax-grammar/">RDF/XML</a>
    format is supported.
    Support for other file formats is optional.
    Support for querying the repository with the
    <a href="http://www.w3.org/TR/rdf-sparql-query/">SPARQL</a>
    query language is provided.
    </p>


    @since OOo 3.2

    @see XRepositorySupplier
    @see XDocumentRepository
 */
interface XRepository
{

    //-------------------------------------------------------------------------
    /** creates a fresh unique blank node.

        @returns
            a newly generated blank node which is unique in this repository
     */
    XBlankNode createBlankNode();


    //-------------------------------------------------------------------------
    /** imports a named graph into the repository.

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

        @param Format
            the format of the input file

        @param InStream
            the input stream, containing an RDF file in the specified format

        @param GraphName
            the name of the graph that is imported

        @param 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 FileFormat
     */
    XNamedGraph importGraph([in] /*FileFormat*/ 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 );

    //-------------------------------------------------------------------------
    /** exports a named graph from the repository.

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

        @param Format
            the format of the output file

        @param OutStream
            the target output stream

        @param GraphName
            the name of the graph that is to be exported

        @param 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 FileFormat
     */
    void exportGraph([in] /*FileFormat*/ 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 );

    //-------------------------------------------------------------------------
    /** 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.
     */
    sequence<XURI> getGraphNames()
        raises( RepositoryException );

    //-------------------------------------------------------------------------
    /** gets a graph by its name.

        @param 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.
     */
    XNamedGraph getGraph([in] XURI GraphName)
        raises( com::sun::star::lang::IllegalArgumentException,
                RepositoryException );

    //-------------------------------------------------------------------------
    /** creates a graph with the given name.

        <p>
        The name must be unique within the repository.
        </p>

        @param 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.
     */
    XNamedGraph createGraph([in] XURI GraphName)
        raises( com::sun::star::lang::IllegalArgumentException,
                com::sun::star::container::ElementExistException,
                RepositoryException );

    //-------------------------------------------------------------------------
    /** destroys the graph with the given name, and removes it from the
        repository.

        <p>
        This invalidates any instances of <type>XNamedGraph</type>
        for the argument.
        </p>

        @param 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.
     */
    void destroyGraph([in] XURI GraphName)
        raises( com::sun::star::lang::IllegalArgumentException,
                com::sun::star::container::NoSuchElementException,
                RepositoryException );

    //-------------------------------------------------------------------------
    /** gets matching RDF statements from the repository.

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

        @param Subject
            the subject of the RDF triple.

        @param Predicate
            the predicate of the RDF triple.

        @param 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 <type>Statement</type>

        @throws RepositoryException
            if an error occurs when accessing the repository.

        @see Statement
        @see XNamedGraph::getStatements
     */
    com::sun::star::container::XEnumeration/*<Statement>*/ getStatements(
            [in] XResource Subject,
            [in] XURI Predicate,
            [in] XNode Object)
        raises( RepositoryException );


    //-------------------------------------------------------------------------
    /** executes a SPARQL "SELECT" query.

        <p>
        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/>.
        </p>

        @param Query
            the SPARQL query <atom>string</atom>

        @returns
            an enumeration, containing
            <ol>
            <li>a list of query variable names (column labels)</li>
            <li>the query results (rows),
                each being a list of bindings for the above variables</li>
            </ol>

        @throws QueryException
            if the query is malformed, or evaluation fails

        @throws RepositoryException
            if an error occurs when accessing the repository.

        @see XQuerySelectResult
     */
    XQuerySelectResult querySelect([in] string Query)
        raises( QueryException,
                RepositoryException );

    //-------------------------------------------------------------------------
    /** executes a SPARQL "CONSTRUCT" query.

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

        @param Query
            the SPARQL query <atom>string</atom>

        @returns
            an iterator over the query result graph, represented as an
            enumeration of <type>Statement</type>

        @throws QueryException
            if the query is malformed, or evaluation fails

        @throws RepositoryException
            if an error occurs when accessing the repository.

        @see Statement
     */
    com::sun::star::container::XEnumeration/*<Statement>*/ queryConstruct(
            [in] string Query)
        raises( QueryException,
                RepositoryException );

    //-------------------------------------------------------------------------
    /** executes a SPARQL "ASK" query.

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

        @param Query
            the SPARQL query <atom>string</atom>

        @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.
     */
    boolean queryAsk([in] string Query)
        raises( QueryException,
                RepositoryException );

};

//=============================================================================

}; }; }; };

#endif