Nepomuk-Core
ontologymanagermodel.cpp
Go to the documentation of this file.
73 bool findGraphUris( Soprano::Model* model, const QUrl& ns, QUrl& dataGraphUri, QUrl& metaDataGraphUri ) {
74 // We use a FILTER(STR(?ns)...) to support both Soprano 2.3 (with plain literals) and earlier (with only typed ones)
108 kDebug() << "Invalid data in ontology" << ns << "Could not find datagraph and metadatagraph relation.";
163 classesOrPropertiesSubQueries << QString( "?type != <%1>" ).arg( Soprano::Vocabulary::OWL::Ontology().toString() );
193 // set proper context on all data statements (This is a bit ugly but we cannot iterate and modify at the same time!)
206 tmpModel->addStatement( Soprano::Statement( metaDataGraphUri, Soprano::Vocabulary::RDF::type(), Soprano::Vocabulary::NRL::GraphMetadata(), metaDataGraphUri ) );
207 tmpModel->addStatement( Soprano::Statement( metaDataGraphUri, Soprano::Vocabulary::NRL::coreGraphMetadataFor(), dataGraphUri, metaDataGraphUri ) );
208 tmpModel->addStatement( Soprano::Statement( dataGraphUri, Soprano::Vocabulary::RDF::type(), graphType, metaDataGraphUri ) );
210 // just to make sure. TODO: Since we now have inference in Nepomuk we could probably remove this.
211 tmpModel->addStatement( Soprano::Statement( dataGraphUri, Soprano::Vocabulary::RDF::type(), Soprano::Vocabulary::NRL::Ontology(), metaDataGraphUri ) );
212 tmpModel->addStatement( Soprano::Statement( dataGraphUri, Soprano::Vocabulary::RDF::type(), Soprano::Vocabulary::NRL::InstanceBase(), metaDataGraphUri ) );
214 tmpModel->addStatement( Soprano::Statement( dataGraphUri, Soprano::Vocabulary::NAO::hasDefaultNamespace(), LiteralValue::createPlainLiteral( ns.toString() ), metaDataGraphUri ) );
234 Nepomuk2::OntologyManagerModel::OntologyManagerModel( Soprano::Model* parentModel, QObject* parent )
248 bool Nepomuk2::OntologyManagerModel::updateOntology( Soprano::StatementIterator data, const QUrl& ns )
257 const Soprano::Backend* backend = Soprano::PluginManager::instance()->discoverBackendByFeatures( Soprano::BackendFeatureStorageMemory );
264 Soprano::Model* tmpModel = backend->createModel( BackendSettings() << BackendSetting( Soprano::BackendOptionStorageMemory ) );
322 setError( "The ontology data contains invalid statements.", Soprano::Error::ErrorInvalidArgument );
327 kDebug() << "Invalid data in ontology" << ontoUri << "We need one data and one metadata graph.";
328 setError( "The ontology data contains invalid statements.", Soprano::Error::ErrorInvalidArgument );
333 // store the modification date of the ontology file in the metadata graph and reuse it to know if we have to update
338 tmpModel->removeAllStatements( dataGraphUri, Soprano::Vocabulary::NAO::lastModified(), Node() );
341 tmpModel->addStatement( dataGraphUri, Soprano::Vocabulary::NAO::lastModified(), LiteralValue( QDateTime::currentDateTime() ), metadataGraphUri );
361 kDebug() << "Successfully updated ontology" << ontoUri << QString("(%1ms)").arg(timer.elapsed());
365 kDebug() << "BUG! BUG! BUG! BUG! BUG! BUG! Could not find data and metadata graph URIs! This should not happen!";
394 // We use a FILTER(STR(?ns)...) to support both Soprano 2.3 (with plain literals) and earlier (with only typed ones)
406 //kDebug() << "Found modification date for" << uri << it.binding( "date" ).literal().toDateTime();
OntologyManagerModel(Soprano::Model *parentModel=0, QObject *parent=0)
Create a new model.
Definition: ontologymanagermodel.cpp:234
bool updateOntology(Soprano::StatementIterator data, const QUrl &ns=QUrl())
Update an ontology.
Definition: ontologymanagermodel.cpp:248
QUrl findOntologyContext(const QUrl &uri)
Tries to find the ontology uri in the local Nepomuk store.
Definition: ontologymanagermodel.cpp:415
bool removeOntology(const QUrl &ns)
Remove an ontology from the model.
Definition: ontologymanagermodel.cpp:371
QDateTime ontoModificationDate(const QUrl &uri)
Determine the modification time of a stored ontology.
Definition: ontologymanagermodel.cpp:392
This file is part of the KDE documentation.
Documentation copyright © 1996-2014 The KDE developers.
Generated on Tue Oct 14 2014 22:48:08 by doxygen 1.8.7 written by Dimitri van Heesch, © 1997-2006
Documentation copyright © 1996-2014 The KDE developers.
Generated on Tue Oct 14 2014 22:48:08 by doxygen 1.8.7 written by Dimitri van Heesch, © 1997-2006
KDE's Doxygen guidelines are available online.