1/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
2/*
3 * This file is part of the LibreOffice project.
4 *
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/.
8 *
9 * This file incorporates work covered by the following license notice:
10 *
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 .
18 */
19
20#ifndef __com_sun_star_rdf_XNamedGraph_idl__
21#define __com_sun_star_rdf_XNamedGraph_idl__
22
23#include <com/sun/star/lang/IllegalArgumentException.idl>
24#include <com/sun/star/container/NoSuchElementException.idl>
25#include <com/sun/star/container/XEnumeration.idl>
26#include <com/sun/star/rdf/RepositoryException.idl>
27#include <com/sun/star/rdf/XURI.idl>
28
29
30
31module com {   module sun {   module star {   module rdf {
32
33/** represents an RDF named graph that is stored in an RDF Repository.
34
35    <p>
36    Note that this interface inherits from XResource: the
37    name of the graph is the string value of the RDF node.
38    This is so that you can easily make RDF statements about named graphs.
39    </p>
40
41    <p>
42    Note that instances may be destroyed via
43    XRepository::destroyGraph().
44    If a graph is destroyed, subsequent calls to addStatement(),
45    removeStatements() will fail with an
46    com::sun::star::container::NoSuchElementException.
47    </p>
48
49    @since OOo 3.2
50
51    @see XRepository
52 */
53interface XNamedGraph : XURI
54{
55
56    /** returns the name of the graph.
57
58        <p>
59        The name is unique within the repository.
60        </p>
61
62        @returns
63            the name of the graph
64     */
65    XURI getName();
66
67    /** removes all statements from the graph.
68
69        @throws com::sun::star::container::NoSuchElementException
70            if this graph does not exist in the repository any more
71
72        @throws RepositoryException
73            if an error occurs when accessing the repository.
74     */
75    void clear()
76        raises( com::sun::star::container::NoSuchElementException,
77                RepositoryException );
78
79    /** adds a RDF statement to the graph.
80
81        <p>
82        Note that the ODF elements that can have metadata attached all
83        implement the interface XMetadatable, which inherits
84        from XResource, meaning that you can simply pass them
85        in as arguments here, and it will magically work.
86        </p>
87
88        @param Subject
89            the subject of the RDF triple.
90
91        @param Predicate
92            the predicate of the RDF triple.
93
94        @param Object
95            the object of the RDF triple.
96
97        @throws com::sun::star::lang::IllegalArgumentException
98            if any parameter is `NULL`
99
100        @throws com::sun::star::container::NoSuchElementException
101            if this graph does not exist in the repository any more
102
103        @throws RepositoryException
104            if an error occurs when accessing the repository.
105     */
106    void addStatement([in] XResource Subject,
107            [in] XURI Predicate,
108            [in] XNode Object)
109        raises( com::sun::star::lang::IllegalArgumentException,
110                com::sun::star::container::NoSuchElementException,
111                RepositoryException );
112
113    /** removes matching RDF statements from the graph.
114
115        <p>
116        Note that the ODF elements that can have metadata attached all
117        implement the interface XMetadatable, which inherits
118        from XResource, meaning that you can simply pass them
119        in as arguments here, and it will magically work.
120        </p>
121
122        <p>
123        Any parameter may be `NULL`, which acts as a wildcard.
124        For example, to remove all statements about myURI:
125        <code>removeStatement(myURI, null, null)</code>
126        </p>
127
128        @param Subject
129            the subject of the RDF triple.
130
131        @param Predicate
132            the predicate of the RDF triple.
133
134        @param Object
135            the object of the RDF triple.
136
137        @throws com::sun::star::container::NoSuchElementException
138            if this graph does not exist in the repository any more
139
140        @throws RepositoryException
141            if an error occurs when accessing the repository.
142     */
143    void removeStatements([in] XResource Subject,
144            [in] XURI Predicate,
145            [in] XNode Object)
146        raises( com::sun::star::container::NoSuchElementException,
147                RepositoryException );
148
149    /** gets matching RDF statements from a graph.
150
151        <p>
152        Note that the ODF elements that can have metadata attached all
153        implement the interface XMetadatable, which inherits
154        from XResource, meaning that you can simply pass them
155        in as arguments here, and it will magically work.
156        </p>
157
158        <p>
159        Any parameter may be `NULL`, which acts as a wildcard.
160        For example, to get all statements about myURI:
161        <code>getStatements(myURI, null, null)</code>
162        </p>
163
164        @param Subject
165            the subject of the RDF triple.
166
167        @param Predicate
168            the predicate of the RDF triple.
169
170        @param Object
171            the object of the RDF triple.
172
173        @returns
174            an iterator over all RDF statements in the graph that match
175            the parameters, represented as an
176            enumeration of Statement
177
178        @throws com::sun::star::container::NoSuchElementException
179            if this graph does not exist in the repository any more
180
181        @throws RepositoryException
182            if an error occurs when accessing the repository.
183
184        @see Statement
185     */
186    com::sun::star::container::XEnumeration/*<Statement>*/ getStatements(
187            [in] XResource Subject,
188            [in] XURI Predicate,
189            [in] XNode Object)
190        raises( com::sun::star::container::NoSuchElementException,
191                RepositoryException );
192
193//FIXME reification: addReifiedStatement(Statement)...
194};
195
196
197}; }; }; };
198
199#endif
200
201/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
202