1 /* This file is part of the KDE Project
2 Copyright (c) 2008 Sebastian Trueg <trueg@kde.org>
4 This library is free software; you can redistribute it and/or
5 modify it under the terms of the GNU Library General Public
6 License version 2 as published by the Free Software Foundation.
8 This library is distributed in the hope that it will be useful,
9 but WITHOUT ANY WARRANTY; without even the implied warranty of
10 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
11 Library General Public License for more details.
13 You should have received a copy of the GNU Library General Public License
14 along with this library; see the file COPYING.LIB. If not, write to
15 the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
16 Boston, MA 02110-1301, USA.
19 #ifndef _NEPOMUK_ONTOLOGY_MANAGER_MODEL_H_
20 #define _NEPOMUK_ONTOLOGY_MANAGER_MODEL_H_
22 #include <Soprano/FilterModel>
26 * \class OntologyManagerModel ontologymanagermodel.h ontologymanagermodel.h
28 * \brief Filter model to manage NRL ontologies.
30 * Can be used to manage ontologies stored in a model. The ontologies
31 * are stored in NRL graphs.
33 * \author Sebastian Trueg <trueg@kde.org>
35 class OntologyManagerModel
: public Soprano::FilterModel
43 OntologyManagerModel( Soprano::Model
* parentModel
= 0, QObject
* parent
= 0 );
48 ~OntologyManagerModel();
51 * Reimplemented from FilterModel. The API is not affected.
53 void setParentModel( Soprano::Model
* parentModel
);
58 * \param data The actual statements defining the ontology. These statements have to
59 * either already define the proper NRL graphs or not define graphs at all. In the
60 * latter case the graphs will be created.
61 * \param ns The namespace of the ontology. If this is left invalid it will be
62 * determined from the data.
64 * \return \p true if the data was valid and the ontology was successfully updated.
67 bool updateOntology( Soprano::StatementIterator data
, const QUrl
& ns
= QUrl() );
70 * Remove an ontology from the model.
72 * \param ns The namespace of the ontology.
74 * \return \p true if the ontology was found and successfully removed.
75 * \p false in case the ontology was not found or an error occurred.
77 bool removeOntology( const QUrl
& ns
);
80 * Determine the modification time of a stored ontology. The
81 * modification time of an ontology is the time it was stored into
84 * \param uri The namespace of the ontology.
86 * \return The modification time of the ontology identified by \p uri
87 * or an invalid QDateTime if the ontology was not found.
89 QDateTime
ontoModificationDate( const QUrl
& uri
);
92 * Tries to find the ontology \p uri in the local Nepomuk store.
93 * \return The context (named graph) storing the ontology's statements
94 * or an invalid URI if the ontology could not be found.
96 QUrl
findOntologyContext( const QUrl
& uri
);