xref: /trunk/main/offapi/com/sun/star/rdf/XNamedGraph.idl (revision cdf0e10c)
1/*************************************************************************
2 *
3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
4 *
5 * Copyright 2000, 2010 Oracle and/or its affiliates.
6 *
7 * OpenOffice.org - a multi-platform office productivity suite
8 *
9 * This file is part of OpenOffice.org.
10 *
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.
14 *
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).
20 *
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.
25 *
26 ************************************************************************/
27
28#ifndef __com_sun_star_rdf_XNamedGraph_idl__
29#define __com_sun_star_rdf_XNamedGraph_idl__
30
31#ifndef __com_sun_star_lang_IllegalArgumentException_idl__
32#include <com/sun/star/lang/IllegalArgumentException.idl>
33#endif
34
35#ifndef __com_sun_star_container_NoSuchElementException_idl__
36#include <com/sun/star/container/NoSuchElementException.idl>
37#endif
38
39#ifndef __com_sun_star_container_XEnumeration_idl__
40#include <com/sun/star/container/XEnumeration.idl>
41#endif
42
43#ifndef __com_sun_star_rdf_RepositoryException_idl__
44#include <com/sun/star/rdf/RepositoryException.idl>
45#endif
46
47#ifndef __com_sun_star_rdf_XURI_idl__
48#include <com/sun/star/rdf/XURI.idl>
49#endif
50
51
52//=============================================================================
53
54module com {   module sun {   module star {   module rdf {
55
56//=============================================================================
57/** represents an RDF named graph that is stored in an RDF Repository.
58
59    <p>
60    Note that this interface inherits from <type>XResource</type>: the
61    name of the graph is the string value of the RDF node.
62    This is so that you can easily make RDF statements about named graphs.
63    </p>
64
65    <p>
66    Note that instances may be destroyed via
67    <member>XRepository::destroyGraph</member>.
68    If a graph is destroyed, subsequent calls to <member>addStatement</member>,
69    <member>removeStatements</member> will fail with an
70    <type scope="com::sun::star::container">NoSuchElementException</type>.
71    </p>
72
73    @since OOo 3.2
74
75    @see XRepository
76 */
77interface XNamedGraph : XURI
78{
79
80    //-------------------------------------------------------------------------
81    /** returns the name of the graph.
82
83        <p>
84        The name is unique within the repository.
85        </p>
86
87        @returns
88            the name of the graph
89     */
90    XURI getName();
91
92    //-------------------------------------------------------------------------
93    /** removes all statements from the graph.
94
95        @throws com::sun::star::container::NoSuchElementException
96            if this graph does not exist in the repository any more
97
98        @throws RepositoryException
99            if an error occurs when accessing the repository.
100     */
101    void clear()
102        raises( com::sun::star::container::NoSuchElementException,
103                RepositoryException );
104
105    //-------------------------------------------------------------------------
106    /** adds a RDF statement to the graph.
107
108        <p>
109        Note that the ODF elements that can have metadata attached all
110        implement the interface <type>XMetadatable</type>, which inherits
111        from <type>XResource</type>, meaning that you can simply pass them
112        in as arguments here, and it will magically work.
113        </p>
114
115        @param Subject
116            the subject of the RDF triple.
117
118        @param Predicate
119            the predicate of the RDF triple.
120
121        @param Object
122            the object of the RDF triple.
123
124        @throws com::sun::star::lang::IllegalArgumentException
125            if any parameter is <NULL/>
126
127        @throws com::sun::star::container::NoSuchElementException
128            if this graph does not exist in the repository any more
129
130        @throws RepositoryException
131            if an error occurs when accessing the repository.
132     */
133    void addStatement([in] XResource Subject,
134            [in] XURI Predicate,
135            [in] XNode Object)
136        raises( com::sun::star::lang::IllegalArgumentException,
137                com::sun::star::container::NoSuchElementException,
138                RepositoryException );
139
140    //-------------------------------------------------------------------------
141    /** removes matching RDF statements from the graph.
142
143        <p>
144        Note that the ODF elements that can have metadata attached all
145        implement the interface <type>XMetadatable</type>, which inherits
146        from <type>XResource</type>, meaning that you can simply pass them
147        in as arguments here, and it will magically work.
148        </p>
149
150        <p>
151        Any parameter may be <NULL/>, which acts as a wildcard.
152        For example, to remove all statements about myURI:
153        <code>removeStatement(myURI, null, null)</code>
154        </p>
155
156        @param Subject
157            the subject of the RDF triple.
158
159        @param Predicate
160            the predicate of the RDF triple.
161
162        @param Object
163            the object of the RDF triple.
164
165        @throws com::sun::star::container::NoSuchElementException
166            if this graph does not exist in the repository any more
167
168        @throws RepositoryException
169            if an error occurs when accessing the repository.
170     */
171    void removeStatements([in] XResource Subject,
172            [in] XURI Predicate,
173            [in] XNode Object)
174        raises( com::sun::star::container::NoSuchElementException,
175                RepositoryException );
176
177    //-------------------------------------------------------------------------
178    /** gets matching RDF statements from a graph.
179
180        <p>
181        Note that the ODF elements that can have metadata attached all
182        implement the interface <type>XMetadatable</type>, which inherits
183        from <type>XResource</type>, meaning that you can simply pass them
184        in as arguments here, and it will magically work.
185        </p>
186
187        <p>
188        Any parameter may be <NULL/>, which acts as a wildcard.
189        For example, to get all statements about myURI:
190        <code>getStatements(myURI, null, null)</code>
191        </p>
192
193        @param Subject
194            the subject of the RDF triple.
195
196        @param Predicate
197            the predicate of the RDF triple.
198
199        @param Object
200            the object of the RDF triple.
201
202        @returns
203            an iterator over all RDF statements in the graph that match
204            the parameters, represented as an
205            enumeration of <type>Statement</type>
206
207        @throws com::sun::star::container::NoSuchElementException
208            if this graph does not exist in the repository any more
209
210        @throws RepositoryException
211            if an error occurs when accessing the repository.
212
213        @see Statement
214     */
215    com::sun::star::container::XEnumeration/*<Statement>*/ getStatements(
216            [in] XResource Subject,
217            [in] XURI Predicate,
218            [in] XNode Object)
219        raises( com::sun::star::container::NoSuchElementException,
220                RepositoryException );
221
222//FIXME reification: addReifiedStatement(Statement)...
223};
224
225//=============================================================================
226
227}; }; }; };
228
229#endif
230