/usr/include/soprano/nrlmodel.h is in libsoprano-dev 2.9.4+dfsg1-0ubuntu4.
This file is owned by root:root, with mode 0o644.
The actual contents of the file can be viewed below.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 | /*
* This file is part of Soprano Project.
*
* Copyright (C) 2007-2011 Sebastian Trueg <trueg@kde.org>
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Library General Public
* License as published by the Free Software Foundation; either
* version 2 of the License, or (at your option) any later version.
*
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Library General Public License for more details.
*
* You should have received a copy of the GNU Library General Public License
* along with this library; see the file COPYING.LIB. If not, write to
* the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
* Boston, MA 02110-1301, USA.
*/
#ifndef _SOPRANO_NRL_MODEL_H_
#define _SOPRANO_NRL_MODEL_H_
#include "filtermodel.h"
#include "soprano_export.h"
#ifndef USING_SOPRANO_NRLMODEL_UNSTABLE_API
#error The Soprano::NrlModel API is subject to change. This has to be acnowledged by defining USING_SOPRANO_NRLMODEL_UNSTABLE_API
#endif
namespace Soprano {
/**
* \class NRLModel nrlmodel.h Soprano/NRLModel
*
* \brief Model filter that makes working with NRL data simpler.
*
* The NRLModel enforces NRL cardinality rules. That means predicates with a cardinality
* of maximum 1 are always udpated while statements that define predicates with a maximum
* cardinality bigger than 1 are rejected once the maximum is reached (future versions
* might remove an earlier defined statement based on the time the old statements were
* added).
*
* Thus, at the moment NRLModel is mostly usable for handling properties with a maximum
* cardinality of 1.
*
* NRLModel also provides automatic query prefix expansion and named graph creation and
* removal with automatic metadata graph handling.
*
* THE API AND EVEN THE COMPLETE CLASS IS SUBJECT TO CHANGE!
*
* \author Sebastian Trueg <trueg@kde.org>
*
* \sa Vocabulary::NRL
*/
class SOPRANO_EXPORT NRLModel : public FilterModel
{
Q_OBJECT
public:
NRLModel();
NRLModel( Model* parent );
~NRLModel();
/**
* When enforcing the NRL cardinality rules NRLModel can either
* ignore the context of statements or treat different contexts
* as separate sets, each resetting the cardinality.
*
* \param b If \p true (the default) NRLModel does ignore the context
* when enforcing rules. If \p false the NRL rules can be violated
* across contexts.
*
* By default contexts are ignored.
*
* \sa ignoreContext()
*/
void setIgnoreContext( bool b );
/**
* \return \p true if contexts should be ignored when enforcing NRL
* rules.
*
* \sa setIgnoreContext()
*/
bool ignoreContext() const;
/**
* Enable automatic query prefix expansion based on nao:hasDefaultNamespaceAbbreviation.
* This will trigger reading all prefixes stored in the underlying model.
*
* By default query prefix expansion is disabled.
*
* \since 2.4
*/
void setEnableQueryPrefixExpansion( bool enable );
/**
* \return \p true if query prefix expansion is enabled.
*
* \since 2.4
*/
bool queryPrefixExpansionEnabled() const;
/**
* The prefixes that have been read from the underlying model.
*
* \return A list of prefixes mapping to the namespaces read from
* the model. This list is empty if queryPrefixExpansion is disabled.
*
* \since 2.4
*/
QHash<QString, QUrl> queryPrefixes() const;
/**
* Add a statement.
*
* \param s The statement containing the property to be set.
* If the predicate has NRL cardinality restrictions existing
* statements will be updated. Otherwise this method has the
* same effect as Model::addStatement().
*
* Adding a statement that defines a predicate with a maximum
* cardinality bigger than 1 which has already been reached
* fails with an error.
*
* \return Error::ErrorNone on success.
*/
Error::ErrorCode addNrlStatement( const Statement& s );
/**
* Create a new graph of type \p type.
*
* This will actually create two graphs: the requested one
* and its metadata graph which will already contain basic
* metadata like creation date.
*
* \return The URI of the newly created graph.
*
* \since 2.3
*/
QUrl createGraph( const QUrl& type, QUrl* metadataGraph = 0 );
/**
* Remove a complete graph including its metadata graph
*
* This method can be seen as the counterpart to createGraph
*
* \since 2.3
*/
Error::ErrorCode removeGraph( const QUrl& graph );
/**
* If queryPrefixExpansionEnabled is \p true query prefixes will be expanded before sending the
* query to the underlying model.
*
* \since 2.4
*/
virtual QueryResultIterator executeQuery( const QString& query, Query::QueryLanguage language, const QString& userQueryLanguage = QString() ) const;
/**
* If the only node defined in \p statement is the context the graph including its
* metadata is removed.
*
* \sa removeGraph
*
* \since 2.4
*/
virtual Error::ErrorCode removeAllStatements( const Statement& statement );
private:
class Private;
Private* const d;
};
}
#endif
|