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