xref: /AOO41X/main/offapi/com/sun/star/rdf/XDocumentRepository.idl (revision cdf0e10c4e3984b49a9502b011690b615761d4a3)
1*cdf0e10cSrcweir/*************************************************************************
2*cdf0e10cSrcweir *
3*cdf0e10cSrcweir * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
4*cdf0e10cSrcweir *
5*cdf0e10cSrcweir * Copyright 2000, 2010 Oracle and/or its affiliates.
6*cdf0e10cSrcweir *
7*cdf0e10cSrcweir * OpenOffice.org - a multi-platform office productivity suite
8*cdf0e10cSrcweir *
9*cdf0e10cSrcweir * This file is part of OpenOffice.org.
10*cdf0e10cSrcweir *
11*cdf0e10cSrcweir * OpenOffice.org is free software: you can redistribute it and/or modify
12*cdf0e10cSrcweir * it under the terms of the GNU Lesser General Public License version 3
13*cdf0e10cSrcweir * only, as published by the Free Software Foundation.
14*cdf0e10cSrcweir *
15*cdf0e10cSrcweir * OpenOffice.org is distributed in the hope that it will be useful,
16*cdf0e10cSrcweir * but WITHOUT ANY WARRANTY; without even the implied warranty of
17*cdf0e10cSrcweir * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
18*cdf0e10cSrcweir * GNU Lesser General Public License version 3 for more details
19*cdf0e10cSrcweir * (a copy is included in the LICENSE file that accompanied this code).
20*cdf0e10cSrcweir *
21*cdf0e10cSrcweir * You should have received a copy of the GNU Lesser General Public License
22*cdf0e10cSrcweir * version 3 along with OpenOffice.org.  If not, see
23*cdf0e10cSrcweir * <http://www.openoffice.org/license.html>
24*cdf0e10cSrcweir * for a copy of the LGPLv3 License.
25*cdf0e10cSrcweir *
26*cdf0e10cSrcweir ************************************************************************/
27*cdf0e10cSrcweir
28*cdf0e10cSrcweir#ifndef __com_sun_star_rdf_XDocumentRepository_idl__
29*cdf0e10cSrcweir#define __com_sun_star_rdf_XDocumentRepository_idl__
30*cdf0e10cSrcweir
31*cdf0e10cSrcweir#ifndef __com_sun_star_beans_Pair_idl__
32*cdf0e10cSrcweir#include <com/sun/star/beans/Pair.idl>
33*cdf0e10cSrcweir#endif
34*cdf0e10cSrcweir
35*cdf0e10cSrcweir#ifndef __com_sun_star_rdf_XMetadatable_idl__
36*cdf0e10cSrcweir#include <com/sun/star/rdf/XMetadatable.idl>
37*cdf0e10cSrcweir#endif
38*cdf0e10cSrcweir
39*cdf0e10cSrcweir#ifndef __com_sun_star_rdf_XRepository_idl__
40*cdf0e10cSrcweir#include <com/sun/star/rdf/XRepository.idl>
41*cdf0e10cSrcweir#endif
42*cdf0e10cSrcweir
43*cdf0e10cSrcweir
44*cdf0e10cSrcweir//=============================================================================
45*cdf0e10cSrcweir
46*cdf0e10cSrcweirmodule com {   module sun {   module star {   module rdf {
47*cdf0e10cSrcweir
48*cdf0e10cSrcweir//=============================================================================
49*cdf0e10cSrcweir/** extends <type>XRepository</type> with document-specific functionality.
50*cdf0e10cSrcweir
51*cdf0e10cSrcweir    <p>
52*cdf0e10cSrcweir    This subclass of <type>XRepository</type> provides some methods which
53*cdf0e10cSrcweir    only make sense for repositories that are attached to a document.
54*cdf0e10cSrcweir    For example, the methods allow for manipulating in-content metadata,
55*cdf0e10cSrcweir    which is stored as RDFa.
56*cdf0e10cSrcweir    </p>
57*cdf0e10cSrcweir
58*cdf0e10cSrcweir    @since OOo 3.2
59*cdf0e10cSrcweir
60*cdf0e10cSrcweir    @see XRepositorySupplier
61*cdf0e10cSrcweir    @see XDocumentMetadataAccess
62*cdf0e10cSrcweir */
63*cdf0e10cSrcweirinterface XDocumentRepository : XRepository
64*cdf0e10cSrcweir{
65*cdf0e10cSrcweir
66*cdf0e10cSrcweir    //-------------------------------------------------------------------------
67*cdf0e10cSrcweir    /** update the RDFa statement(s) that correspond to an ODF element in the
68*cdf0e10cSrcweir        repository.
69*cdf0e10cSrcweir
70*cdf0e10cSrcweir        <p>
71*cdf0e10cSrcweir        This method will do the following steps:
72*cdf0e10cSrcweir        <ol>
73*cdf0e10cSrcweir        <li>Remove all previously set RDFa statements for the Object parameter
74*cdf0e10cSrcweir             from the repository</li>
75*cdf0e10cSrcweir        <li>If the RDFaContent parameter is the empty <atom>string</atom>,
76*cdf0e10cSrcweir            for every Predicate in the given list of Predicates,
77*cdf0e10cSrcweir            add the following RDF statement to an unspecified named graph:
78*cdf0e10cSrcweir            <ul>
79*cdf0e10cSrcweir            <li><code>Subject Predicate
80*cdf0e10cSrcweir                      XLiteral(Object->getText()^^RDFaDatatype)</code></li>
81*cdf0e10cSrcweir            </ul>
82*cdf0e10cSrcweir        </li>
83*cdf0e10cSrcweir        <li>If the RDFaContent parameter is not the empty <atom>string</atom>,
84*cdf0e10cSrcweir            for every Predicate in the given list of Predicates,
85*cdf0e10cSrcweir            add the following RDF statement to an unspecified named graph:
86*cdf0e10cSrcweir            <ul>
87*cdf0e10cSrcweir            <li>
88*cdf0e10cSrcweir            <code>Subject Predicate XLiteral(RDFaContent^^RDFaDatatype)</code>
89*cdf0e10cSrcweir            </li>
90*cdf0e10cSrcweir            </ul>
91*cdf0e10cSrcweir        </li>
92*cdf0e10cSrcweir        </ol>
93*cdf0e10cSrcweir        </p>
94*cdf0e10cSrcweir
95*cdf0e10cSrcweir        <p>
96*cdf0e10cSrcweir        RDFa statements are handled specially because they are not logically
97*cdf0e10cSrcweir        part of any named graph in the repository.
98*cdf0e10cSrcweir        Also, they have rather unusual semantics;
99*cdf0e10cSrcweir        just using <member>XNamedGraph::addStatement</member> would be
100*cdf0e10cSrcweir        ambiguous:
101*cdf0e10cSrcweir        if the object is a <type>XMetadatable</type>, do we insert
102*cdf0e10cSrcweir        the object itself (URI) or its literal content (RDFa)?
103*cdf0e10cSrcweir        </p>
104*cdf0e10cSrcweir
105*cdf0e10cSrcweir        @param Subject
106*cdf0e10cSrcweir            the subject of the RDF triple(s).
107*cdf0e10cSrcweir
108*cdf0e10cSrcweir        @param Predicates
109*cdf0e10cSrcweir            the predicates of the RDF triple(s).
110*cdf0e10cSrcweir
111*cdf0e10cSrcweir        @param Object
112*cdf0e10cSrcweir            the object of the RDF triple(s) is the text content of this
113*cdf0e10cSrcweir            parameter.
114*cdf0e10cSrcweir
115*cdf0e10cSrcweir        @param RDFaContent
116*cdf0e10cSrcweir            the <code>rdfa:content</code> attribute (may be the empty
117*cdf0e10cSrcweir            <atom>string</atom>).
118*cdf0e10cSrcweir
119*cdf0e10cSrcweir        @param RDFaDatatype
120*cdf0e10cSrcweir            the <code>rdfa:datatype</code> attribute (may be <NULL/>)
121*cdf0e10cSrcweir
122*cdf0e10cSrcweir        @throws com::sun::star::lang::IllegalArgumentException
123*cdf0e10cSrcweir            if any parameter is <NULL/>, Predicates is empty,
124*cdf0e10cSrcweir            or Object is of a type that can not have RDFa metadata attached.
125*cdf0e10cSrcweir
126*cdf0e10cSrcweir        @throws RepositoryException
127*cdf0e10cSrcweir            if an error occurs when accessing the repository.
128*cdf0e10cSrcweir     */
129*cdf0e10cSrcweir    void setStatementRDFa(
130*cdf0e10cSrcweir            [in] XResource Subject,
131*cdf0e10cSrcweir            [in] sequence<XURI> Predicates,
132*cdf0e10cSrcweir            [in] XMetadatable Object,
133*cdf0e10cSrcweir            [in] string RDFaContent,
134*cdf0e10cSrcweir            [in] XURI RDFaDatatype)
135*cdf0e10cSrcweir        raises( com::sun::star::lang::IllegalArgumentException,
136*cdf0e10cSrcweir                RepositoryException );
137*cdf0e10cSrcweir
138*cdf0e10cSrcweir    //-------------------------------------------------------------------------
139*cdf0e10cSrcweir    /** remove the RDFa statement(s) that correspond to an ODF element from the
140*cdf0e10cSrcweir        repository.
141*cdf0e10cSrcweir
142*cdf0e10cSrcweir        <p>
143*cdf0e10cSrcweir        RDFa statements are handled specially because they are not logically
144*cdf0e10cSrcweir        part of any graph.
145*cdf0e10cSrcweir        </p>
146*cdf0e10cSrcweir
147*cdf0e10cSrcweir        @param Element
148*cdf0e10cSrcweir            the element whose RDFa statement(s) should be removed
149*cdf0e10cSrcweir
150*cdf0e10cSrcweir        @throws com::sun::star::lang::IllegalArgumentException
151*cdf0e10cSrcweir            if the given Element is <NULL/>, or of a type that can not have
152*cdf0e10cSrcweir            RDFa metadata attached.
153*cdf0e10cSrcweir
154*cdf0e10cSrcweir        @throws RepositoryException
155*cdf0e10cSrcweir            if an error occurs when accessing the repository.
156*cdf0e10cSrcweir     */
157*cdf0e10cSrcweir    void removeStatementRDFa([in] XMetadatable Element)
158*cdf0e10cSrcweir        raises( com::sun::star::lang::IllegalArgumentException,
159*cdf0e10cSrcweir                RepositoryException );
160*cdf0e10cSrcweir
161*cdf0e10cSrcweir    //-------------------------------------------------------------------------
162*cdf0e10cSrcweir    /** find the RDFa statement(s) associated with an ODF element.
163*cdf0e10cSrcweir
164*cdf0e10cSrcweir        @param Element
165*cdf0e10cSrcweir            the ODF element for which RDFa statements should be found
166*cdf0e10cSrcweir
167*cdf0e10cSrcweir        @returns
168*cdf0e10cSrcweir            <ul>
169*cdf0e10cSrcweir            <li>if the element has no RDFa meta-data attributes:
170*cdf0e10cSrcweir                the empty sequence.</li>
171*cdf0e10cSrcweir            <li>if the element has RDFa meta-data attributes:
172*cdf0e10cSrcweir                <ul>
173*cdf0e10cSrcweir                <li>a sequence with the RDFa-statements corresponding to the
174*cdf0e10cSrcweir                attributes.</li>
175*cdf0e10cSrcweir                <li>a flag indicating whether there is a xhtml:content
176*cdf0e10cSrcweir                attribute.</li>
177*cdf0e10cSrcweir                </ul>
178*cdf0e10cSrcweir            </li>
179*cdf0e10cSrcweir            </ul>
180*cdf0e10cSrcweir
181*cdf0e10cSrcweir        @throws com::sun::star::lang::IllegalArgumentException
182*cdf0e10cSrcweir            if the given Element is <NULL/>, or of a type that can not have
183*cdf0e10cSrcweir            RDFa metadata attached.
184*cdf0e10cSrcweir
185*cdf0e10cSrcweir        @throws RepositoryException
186*cdf0e10cSrcweir            if an error occurs when accessing the repository.
187*cdf0e10cSrcweir
188*cdf0e10cSrcweir        @see Statement
189*cdf0e10cSrcweir     */
190*cdf0e10cSrcweir    com::sun::star::beans::Pair< sequence<Statement>, boolean >
191*cdf0e10cSrcweir            getStatementRDFa([in] XMetadatable Element)
192*cdf0e10cSrcweir        raises( com::sun::star::lang::IllegalArgumentException,
193*cdf0e10cSrcweir                RepositoryException );
194*cdf0e10cSrcweir
195*cdf0e10cSrcweir    //-------------------------------------------------------------------------
196*cdf0e10cSrcweir    /** gets matching RDFa statements from the repository.
197*cdf0e10cSrcweir
198*cdf0e10cSrcweir        <p>
199*cdf0e10cSrcweir        This method exists because RDFa statements are not part of any named
200*cdf0e10cSrcweir        graph, and thus they cannot be enumerated with
201*cdf0e10cSrcweir        <member>XNamedGraph::getStatements</member>.
202*cdf0e10cSrcweir        </p>
203*cdf0e10cSrcweir
204*cdf0e10cSrcweir        <p>
205*cdf0e10cSrcweir        Any parameter may be <NULL/>, which acts as a wildcard.
206*cdf0e10cSrcweir        For example, to get all statements about myURI:
207*cdf0e10cSrcweir        <code>getStatementsRDFa(myURI, null, null)</code>
208*cdf0e10cSrcweir        </p>
209*cdf0e10cSrcweir
210*cdf0e10cSrcweir        @param Subject
211*cdf0e10cSrcweir            the subject of the RDF triple.
212*cdf0e10cSrcweir
213*cdf0e10cSrcweir        @param Predicate
214*cdf0e10cSrcweir            the predicate of the RDF triple.
215*cdf0e10cSrcweir
216*cdf0e10cSrcweir        @param Object
217*cdf0e10cSrcweir            the object of the RDF triple.
218*cdf0e10cSrcweir
219*cdf0e10cSrcweir        @returns
220*cdf0e10cSrcweir            an iterator over all RDFa statements in the repository that match
221*cdf0e10cSrcweir            the parameters, represented as an
222*cdf0e10cSrcweir            enumeration of <type>Statement</type>
223*cdf0e10cSrcweir
224*cdf0e10cSrcweir        @throws RepositoryException
225*cdf0e10cSrcweir            if an error occurs when accessing the repository.
226*cdf0e10cSrcweir
227*cdf0e10cSrcweir        @see Statement
228*cdf0e10cSrcweir        @see XRepository::getStatements
229*cdf0e10cSrcweir        @see XNamedGraph::getStatements
230*cdf0e10cSrcweir     */
231*cdf0e10cSrcweir    com::sun::star::container::XEnumeration/*<Statement>*/ getStatementsRDFa(
232*cdf0e10cSrcweir            [in] XResource Subject,
233*cdf0e10cSrcweir            [in] XURI Predicate,
234*cdf0e10cSrcweir            [in] XNode Object)
235*cdf0e10cSrcweir        raises( RepositoryException );
236*cdf0e10cSrcweir
237*cdf0e10cSrcweir};
238*cdf0e10cSrcweir
239*cdf0e10cSrcweir//=============================================================================
240*cdf0e10cSrcweir
241*cdf0e10cSrcweir}; }; }; };
242*cdf0e10cSrcweir
243*cdf0e10cSrcweir#endif
244