[prev in list] [next in list] [prev in thread] [next in thread]
List: kde-commits
Subject: kdesupport/soprano
From: Sebastian Trueg <sebastian () trueg ! de>
Date: 2010-09-14 12:54:34
Message-ID: 20100914125434.460E8AC871 () svn ! kde ! org
[Download RAW message or body]
SVN commit 1175191 by trueg:
onto2vocabularyclass now extracts the nrl graph.
M +1 -1 CMakeLists.txt
M +37 -2 tools/onto2vocabularyclass.cpp
--- trunk/kdesupport/soprano/CMakeLists.txt #1175190:1175191
@@ -7,7 +7,7 @@
################## Soprano version ################################
set(CMAKE_SOPRANO_VERSION_MAJOR 2)
set(CMAKE_SOPRANO_VERSION_MINOR 5)
-set(CMAKE_SOPRANO_VERSION_RELEASE 62)
+set(CMAKE_SOPRANO_VERSION_RELEASE 63)
set(CMAKE_SOPRANO_VERSION_STRING \
"${CMAKE_SOPRANO_VERSION_MAJOR}.${CMAKE_SOPRANO_VERSION_MINOR}.${CMAKE_SOPRANO_VERSION_RELEASE}")
--- trunk/kdesupport/soprano/tools/onto2vocabularyclass.cpp #1175190:1175191
@@ -64,7 +64,7 @@
" */\n";
-#define VERSION "0.2"
+#define VERSION "1.1"
int version()
{
@@ -330,8 +330,8 @@
return 1;
}
+ QString ontoNamespace;
// We simplify and take it as granted that all resources have the same NS
- QString ontoNamespace;
QUrl namespaceUri( normalizedResources.constBegin().key() );
if ( namespaceUri.hasFragment() ) {
namespaceUri.setFragment( QString() );
@@ -341,6 +341,13 @@
ontoNamespace = namespaceUri.toString().section( "/", 0, -2 ) + '/';
}
qDebug() << "namespace: " << ontoNamespace;
+
+ QUrl nrlGraph;
+ it = graph.listStatements( Node(), Vocabulary::RDF::type(), \
Vocabulary::NRL::Ontology() ); + if ( it.next() ) {
+ nrlGraph = it.current().subject().uri();
+ it.close();
+ }
// ----------------------------------------------------
@@ -378,6 +385,17 @@
headerStream << QString( "%1_EXPORT " ).arg(exportModule.toUpper());
headerStream << "QUrl " << className.toLower() << "Namespace();" << endl << \
endl;
+ // the NRL graph
+ if ( !nrlGraph.isEmpty() ) {
+ headerStream << createIndent( indent ) << "/**" << endl
+ << createIndent( indent ) << " * " << nrlGraph.toString() << \
endl + << createIndent( indent ) << " */" << endl;
+ headerStream << createIndent( indent );
+ if ( visibilityExport )
+ headerStream << QString( "%1_EXPORT " ).arg(exportModule.toUpper());
+ headerStream << "QUrl nrlOntologyGraph();" << endl << endl;
+ }
+
for( QMap<QString, QPair<QString, QString> >::const_iterator it = \
normalizedResources.constBegin(); it != normalizedResources.constEnd(); ++it ) {
QString uri = it.key();
@@ -427,6 +445,9 @@
sourceStream << className.toLower() << "_namespace( QUrl::fromEncoded( \"" << \
ontoNamespace << "\", QUrl::StrictMode ) )," << endl;
+ if ( !nrlGraph.isEmpty() )
+ sourceStream << createIndent( 2 ) << " nrlOntologyGraph( QUrl::fromEncoded( \
\"" << nrlGraph.toString() << "\", QUrl::StrictMode ) )," << endl; +
for( QMap<QString, QPair<QString, QString> >::const_iterator it = \
normalizedResources.constBegin(); it != normalizedResources.constEnd(); ++it ) {
QString uri = it.key();
@@ -446,6 +467,9 @@
sourceStream << createIndent( 1 ) << "QUrl " << className.toLower() << \
"_namespace;" << endl;
+ if ( !nrlGraph.isEmpty() )
+ sourceStream << createIndent( 1 ) << "QUrl nrlOntologyGraph;" << endl;
+
for( QMap<QString, QPair<QString, QString> >::const_iterator it = \
normalizedResources.constBegin(); it != normalizedResources.constEnd(); ++it ) {
QString name = normalizeName( it.value().first );
@@ -464,6 +488,17 @@
<< createIndent( 1 ) << "return " << singletonName << "()->" << \
className.toLower() << "_namespace;" << endl << "}" << endl << endl;
+ if ( !nrlGraph.isEmpty() ) {
+ sourceStream << "QUrl ";
+ if ( !namespaceName.isEmpty() ) {
+ sourceStream << namespaceName << "::";
+ }
+ sourceStream << className << "::nrlOntologyGraph()" << endl
+ << "{" << endl
+ << createIndent( 1 ) << "return " << singletonName << \
"()->nrlOntologyGraph;" << endl + << "}" << endl << endl;
+ }
+
for( QMap<QString, QPair<QString, QString> >::const_iterator it = \
normalizedResources.constBegin(); it != normalizedResources.constEnd(); ++it ) {
QString name = normalizeName( it.value().first );
[prev in list] [next in list] [prev in thread] [next in thread]
Configure |
About |
News |
Add a list |
Sponsored by KoreLogic