xref: /trunk/main/offapi/com/sun/star/rdf/XNamedGraph.idl (revision 96af39f7)
1/**************************************************************
2 *
3 * Licensed to the Apache Software Foundation (ASF) under one
4 * or more contributor license agreements.  See the NOTICE file
5 * distributed with this work for additional information
6 * regarding copyright ownership.  The ASF licenses this file
7 * to you under the Apache License, Version 2.0 (the
8 * "License"); you may not use this file except in compliance
9 * with the License.  You may obtain a copy of the License at
10 *
11 *   http://www.apache.org/licenses/LICENSE-2.0
12 *
13 * Unless required by applicable law or agreed to in writing,
14 * software distributed under the License is distributed on an
15 * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
16 * KIND, either express or implied.  See the License for the
17 * specific language governing permissions and limitations
18 * under the License.
19 *
20 *************************************************************/
21
22
23
24#ifndef __com_sun_star_rdf_XNamedGraph_idl__
25#define __com_sun_star_rdf_XNamedGraph_idl__
26
27#ifndef __com_sun_star_lang_IllegalArgumentException_idl__
28#include <com/sun/star/lang/IllegalArgumentException.idl>
29#endif
30
31#ifndef __com_sun_star_container_NoSuchElementException_idl__
32#include <com/sun/star/container/NoSuchElementException.idl>
33#endif
34
35#ifndef __com_sun_star_container_XEnumeration_idl__
36#include <com/sun/star/container/XEnumeration.idl>
37#endif
38
39#ifndef __com_sun_star_rdf_RepositoryException_idl__
40#include <com/sun/star/rdf/RepositoryException.idl>
41#endif
42
43#ifndef __com_sun_star_rdf_XURI_idl__
44#include <com/sun/star/rdf/XURI.idl>
45#endif
46
47
48//=============================================================================
49
50module com {   module sun {   module star {   module rdf {
51
52//=============================================================================
53/** represents an RDF named graph that is stored in an RDF Repository.
54
55    <p>
56    Note that this interface inherits from <type>XResource</type>: the
57    name of the graph is the string value of the RDF node.
58    This is so that you can easily make RDF statements about named graphs.
59    </p>
60
61    <p>
62    Note that instances may be destroyed via
63    <member>XRepository::destroyGraph</member>.
64    If a graph is destroyed, subsequent calls to <member>addStatement</member>,
65    <member>removeStatements</member> will fail with an
66    <type scope="com::sun::star::container">NoSuchElementException</type>.
67    </p>
68
69    @since OpenOffice 3.2
70
71    @see XRepository
72 */
73interface XNamedGraph : XURI
74{
75
76    //-------------------------------------------------------------------------
77    /** returns the name of the graph.
78
79        <p>
80        The name is unique within the repository.
81        </p>
82
83        @returns
84            the name of the graph
85     */
86    XURI getName();
87
88    //-------------------------------------------------------------------------
89    /** removes all statements from the graph.
90
91        @throws com::sun::star::container::NoSuchElementException
92            if this graph does not exist in the repository any more
93
94        @throws RepositoryException
95            if an error occurs when accessing the repository.
96     */
97    void clear()
98        raises( com::sun::star::container::NoSuchElementException,
99                RepositoryException );
100
101    //-------------------------------------------------------------------------
102    /** adds a RDF statement to the graph.
103
104        <p>
105        Note that the ODF elements that can have metadata attached all
106        implement the interface <type>XMetadatable</type>, which inherits
107        from <type>XResource</type>, meaning that you can simply pass them
108        in as arguments here, and it will magically work.
109        </p>
110
111        @param Subject
112            the subject of the RDF triple.
113
114        @param Predicate
115            the predicate of the RDF triple.
116
117        @param Object
118            the object of the RDF triple.
119
120        @throws com::sun::star::lang::IllegalArgumentException
121            if any parameter is <NULL/>
122
123        @throws com::sun::star::container::NoSuchElementException
124            if this graph does not exist in the repository any more
125
126        @throws RepositoryException
127            if an error occurs when accessing the repository.
128     */
129    void addStatement([in] XResource Subject,
130            [in] XURI Predicate,
131            [in] XNode Object)
132        raises( com::sun::star::lang::IllegalArgumentException,
133                com::sun::star::container::NoSuchElementException,
134                RepositoryException );
135
136    //-------------------------------------------------------------------------
137    /** removes matching RDF statements from the graph.
138
139        <p>
140        Note that the ODF elements that can have metadata attached all
141        implement the interface <type>XMetadatable</type>, which inherits
142        from <type>XResource</type>, meaning that you can simply pass them
143        in as arguments here, and it will magically work.
144        </p>
145
146        <p>
147        Any parameter may be <NULL/>, which acts as a wildcard.
148        For example, to remove all statements about myURI:
149        <code>removeStatement(myURI, null, null)</code>
150        </p>
151
152        @param Subject
153            the subject of the RDF triple.
154
155        @param Predicate
156            the predicate of the RDF triple.
157
158        @param Object
159            the object of the RDF triple.
160
161        @throws com::sun::star::container::NoSuchElementException
162            if this graph does not exist in the repository any more
163
164        @throws RepositoryException
165            if an error occurs when accessing the repository.
166     */
167    void removeStatements([in] XResource Subject,
168            [in] XURI Predicate,
169            [in] XNode Object)
170        raises( com::sun::star::container::NoSuchElementException,
171                RepositoryException );
172
173    //-------------------------------------------------------------------------
174    /** gets matching RDF statements from a graph.
175
176        <p>
177        Note that the ODF elements that can have metadata attached all
178        implement the interface <type>XMetadatable</type>, which inherits
179        from <type>XResource</type>, meaning that you can simply pass them
180        in as arguments here, and it will magically work.
181        </p>
182
183        <p>
184        Any parameter may be <NULL/>, which acts as a wildcard.
185        For example, to get all statements about myURI:
186        <code>getStatements(myURI, null, null)</code>
187        </p>
188
189        @param Subject
190            the subject of the RDF triple.
191
192        @param Predicate
193            the predicate of the RDF triple.
194
195        @param Object
196            the object of the RDF triple.
197
198        @returns
199            an iterator over all RDF statements in the graph that match
200            the parameters, represented as an
201            enumeration of <type>Statement</type>
202
203        @throws com::sun::star::container::NoSuchElementException
204            if this graph does not exist in the repository any more
205
206        @throws RepositoryException
207            if an error occurs when accessing the repository.
208
209        @see Statement
210     */
211    com::sun::star::container::XEnumeration/*<Statement>*/ getStatements(
212            [in] XResource Subject,
213            [in] XURI Predicate,
214            [in] XNode Object)
215        raises( com::sun::star::container::NoSuchElementException,
216                RepositoryException );
217
218//FIXME reification: addReifiedStatement(Statement)...
219};
220
221//=============================================================================
222
223}; }; }; };
224
225#endif
226