1 /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
3 * This file is part of the LibreOffice project.
5 * This Source Code Form is subject to the terms of the Mozilla Public
6 * License, v. 2.0. If a copy of the MPL was not distributed with this
7 * file, You can obtain one at http://mozilla.org/MPL/2.0/.
9 * This file incorporates work covered by the following license notice:
11 * Licensed to the Apache Software Foundation (ASF) under one or more
12 * contributor license agreements. See the NOTICE file distributed
13 * with this work for additional information regarding copyright
14 * ownership. The ASF licenses this file to you under the Apache
15 * License, Version 2.0 (the "License"); you may not use this file
16 * except in compliance with the License. You may obtain a copy of
17 * the License at http://www.apache.org/licenses/LICENSE-2.0 .
22 module com
{ module sun
{ module star
{ module rdf
{
24 /** provides access to a set of named RDF graphs.
27 A repository for storing information according to the data model of the
28 <a href="http://www.w3.org/RDF/">Resource Description Framework</a>.
29 This interface may be used e.g. for repositories that correspond to a
30 loaded ODF document, or for repositories that are backed by some kind of
34 The RDF triples are stored as a set of named RDF graphs.
35 Importing and exporting files in the
36 <a href="http://www.w3.org/TR/rdf-syntax-grammar/">RDF/XML</a>
38 Support for other file formats is optional.
39 Support for querying the repository with the
40 <a href="http://www.w3.org/TR/rdf-sparql-query/">SPARQL</a>
41 query language is provided.
47 @see XRepositorySupplier
48 @see XDocumentRepository
53 /** creates a fresh unique blank node.
56 a newly generated blank node which is unique in this repository
58 XBlankNode createBlankNode
();
61 /** imports a named graph into the repository.
64 Implementations must support RDF/XML format.
65 Support for other RDF formats is optional.
66 If the format is not supported by the implementation, an
67 com::sun::star::datatransfer::UnsupportedFlavorException is raised.
68 If the format requires use of a BaseURI, but none is given, an
69 com::sun::star::lang::IllegalArgumentException
74 the format of the input file
77 the input stream, containing an RDF file in the specified format
80 the name of the graph that is imported
83 a base URI to resolve relative URI references
88 @throws com::sun::star::lang::IllegalArgumentException
89 if the given stream or the GraphName is `NULL`,
90 or BaseURI is `NULL` and the format requires use of a base URI
92 @throws com::sun::star::datatransfer::UnsupportedFlavorException
93 if the format requested is unknown or not supported
95 @throws com::sun::star::container::ElementExistException
96 if a graph with the given GraphName already exists in the
99 @throws ParseException
100 if the input does not conform to the specified file format.
102 @throws RepositoryException
103 if an error occurs when accessing the repository.
105 @throws com::sun::star::io::IOException
106 if an I/O error occurs.
110 XNamedGraph importGraph
([in] /*FileFormat*/ short Format
,
111 [in] com
::sun
::star
::io
::XInputStream InStream
,
112 [in] XURI GraphName
, [in] XURI BaseURI
)
113 raises
( com
::sun
::star
::lang
::IllegalArgumentException
,
114 com
::sun
::star
::datatransfer
::UnsupportedFlavorException
,
115 com
::sun
::star
::container
::ElementExistException
,
118 com
::sun
::star
::io
::IOException
);
120 /** exports a named graph from the repository.
123 Implementations must support RDF/XML format.
124 Support for other RDF formats is optional.
125 If the format is not supported by the implementation, an
126 com::sun::star::datatransfer::UnsupportedFlavorException is raised.
130 the format of the output file
133 the target output stream
136 the name of the graph that is to be exported
139 a base URI to resolve relative URI references
141 @throws com::sun::star::lang::IllegalArgumentException
142 if the given stream or the GraphName is `NULL`,
143 or BaseURI is `NULL` and the format requires use of a base URI
145 @throws com::sun::star::datatransfer::UnsupportedFlavorException
146 if the format requested is unknown or not supported
148 @throws com::sun::star::container::NoSuchElementException
149 if a graph with the given GraphName does not exist
151 @throws RepositoryException
152 if an error occurs when accessing the repository.
154 @throws com::sun::star::io::IOException
155 if an I/O error occurs.
159 void exportGraph
([in] /*FileFormat*/ short Format
,
160 [in] com
::sun
::star
::io
::XOutputStream OutStream
,
161 [in] XURI GraphName
, [in] XURI BaseURI
)
162 raises
( com
::sun
::star
::lang
::IllegalArgumentException
,
163 com
::sun
::star
::datatransfer
::UnsupportedFlavorException
,
164 com
::sun
::star
::container
::NoSuchElementException
,
166 com
::sun
::star
::io
::IOException
);
168 /** gets the names of all the graphs in the repository.
171 a list containing the names of the graphs in the repository
173 @throws RepositoryException
174 if an error occurs when accessing the repository.
176 sequence
<XURI
> getGraphNames
()
177 raises
( RepositoryException
);
179 /** gets a graph by its name.
182 the name of the graph that is to be returned
185 the graph with the given name if it exists, else `NULL`
187 @throws com::sun::star::lang::IllegalArgumentException
188 if the given GraphName is invalid
190 @throws RepositoryException
191 if an error occurs when accessing the repository.
193 XNamedGraph getGraph
([in] XURI GraphName
)
194 raises
( com
::sun
::star
::lang
::IllegalArgumentException
,
195 RepositoryException
);
197 /** creates a graph with the given name.
200 The name must be unique within the repository.
204 the name of the graph that is to be created
207 the graph with the given name
209 @throws com::sun::star::lang::IllegalArgumentException
210 if the given GraphName is invalid
212 @throws com::sun::star::container::ElementExistException
213 if a graph with the given GraphName already exists
215 @throws RepositoryException
216 if an error occurs when accessing the repository.
218 XNamedGraph createGraph
([in] XURI GraphName
)
219 raises
( com
::sun
::star
::lang
::IllegalArgumentException
,
220 com
::sun
::star
::container
::ElementExistException
,
221 RepositoryException
);
223 /** destroys the graph with the given name, and removes it from the
227 This invalidates any instances of XNamedGraph
232 the name of the graph that is to be destroyed
234 @throws com::sun::star::lang::IllegalArgumentException
235 if the given GraphName is invalid
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 void destroyGraph
([in] XURI GraphName
)
244 raises
( com
::sun
::star
::lang
::IllegalArgumentException
,
245 com
::sun
::star
::container
::NoSuchElementException
,
246 RepositoryException
);
248 /** gets matching RDF statements from the repository.
251 Any parameter may be `NULL`, which acts as a wildcard.
252 For example, to get all statements about myURI:
253 <code>getStatements(myURI, null, null)</code>
257 the subject of the RDF triple.
260 the predicate of the RDF triple.
263 the object of the RDF triple.
266 an iterator over all RDF statements in the repository that match
267 the parameters, represented as an
268 enumeration of Statement
270 @throws RepositoryException
271 if an error occurs when accessing the repository.
274 @see XNamedGraph::getStatements
276 com
::sun
::star
::container
::XEnumeration
/*<Statement>*/ getStatements
(
277 [in] XResource Subject
,
280 raises
( RepositoryException
);
283 /** executes a SPARQL "SELECT" query.
286 This method runs a SPARQL query that returns a list of variable
287 bindings, i.e., a query beginning with "SELECT".
288 The result is basically a (rectangular) table with labeled columns,
289 where individual cells may be `NULL`.
293 the SPARQL query `string`
296 an enumeration, containing
298 <li>a list of query variable names (column labels)</li>
299 <li>the query results (rows),
300 each being a list of bindings for the above variables</li>
303 @throws QueryException
304 if the query is malformed, or evaluation fails
306 @throws RepositoryException
307 if an error occurs when accessing the repository.
309 @see XQuerySelectResult
311 XQuerySelectResult querySelect
([in] string Query
)
312 raises
( QueryException
,
313 RepositoryException
);
315 /** executes a SPARQL "CONSTRUCT" query.
318 This method runs a SPARQL query that constructs a result graph,
319 i.e., a query beginning with "CONSTRUCT".
323 the SPARQL query `string`
326 an iterator over the query result graph, represented as an
327 enumeration of Statement
329 @throws QueryException
330 if the query is malformed, or evaluation fails
332 @throws RepositoryException
333 if an error occurs when accessing the repository.
337 com
::sun
::star
::container
::XEnumeration
/*<Statement>*/ queryConstruct
(
339 raises
( QueryException
,
340 RepositoryException
);
342 /** executes a SPARQL "ASK" query.
345 This method runs a SPARQL query that computes a boolean,
346 i.e., a query beginning with "ASK".
350 the SPARQL query `string`
353 the boolean query result
355 @throws QueryException
356 if the query is malformed, or evaluation fails
358 @throws RepositoryException
359 if an error occurs when accessing the repository.
361 boolean queryAsk
([in] string Query
)
362 raises
( QueryException
,
363 RepositoryException
);
370 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */