Sophie

Sophie

distrib > Mandriva > 2010.1 > i586 > media > main-testing-src > by-pkgid > 6a6037a72fe4fe07e6ae3cf1acaf9d61 > files > 17

kdelibs4-4.4.5-0.1mdv2010.1.src.rpm

Index: nepomuk/core/types/class.cpp
===================================================================
--- nepomuk/core/types/class.cpp	(révision 1130777)
+++ nepomuk/core/types/class.cpp	(révision 1130778)
@@ -106,6 +106,11 @@
 
 bool Nepomuk::Types::ClassPrivate::addProperty( const QUrl& property, const Soprano::Node& value )
 {
+    // we avoid subclassing loops (as created for crappy inferencing) by checking for our own uri
+    if( value.isResource() && value.uri() == uri ) {
+        return false;
+    }
+
     if( property == Soprano::Vocabulary::RDFS::subClassOf() ) {
         parents.append( Class( value.uri() ) );
         return true;
@@ -117,7 +122,9 @@
 
 bool Nepomuk::Types::ClassPrivate::addAncestorProperty( const QUrl& ancestorResource, const QUrl& property )
 {
-    if ( property == Soprano::Vocabulary::RDFS::subClassOf() ) {
+    // we avoid subclassing loops (as created for crappy inferencing) by checking for our own uri
+    if ( property == Soprano::Vocabulary::RDFS::subClassOf() &&
+        ancestorResource != uri ) {
         children.append( Class( ancestorResource ) );
         return true;
     }
Index: nepomuk/core/types/property.cpp
===================================================================
--- nepomuk/core/types/property.cpp	(révision 1130777)
+++ nepomuk/core/types/property.cpp	(révision 1130778)
@@ -42,7 +42,10 @@
 
 bool Nepomuk::Types::PropertyPrivate::addProperty( const QUrl& property, const Soprano::Node& value )
 {
-    if( property == Soprano::Vocabulary::RDFS::subPropertyOf() ) {
+    // we avoid subclassing loops (as created for crappy inferencing) by checking for our own uri
+    if( value.isResource() &&
+        value.uri() != uri &&
+        property == Soprano::Vocabulary::RDFS::subPropertyOf() ) {
         parents.append( value.uri() );
         return true;
     }
@@ -91,7 +94,9 @@
 
 bool Nepomuk::Types::PropertyPrivate::addAncestorProperty( const QUrl& ancestorResource, const QUrl& property )
 {
-    if( property == Soprano::Vocabulary::RDFS::subPropertyOf() ) {
+    // we avoid subclassing loops (as created for crappy inferencing) by checking for our own uri
+    if( property == Soprano::Vocabulary::RDFS::subPropertyOf() &&
+        ancestorResource != uri ) {
         children.append( ancestorResource );
         return true;
     }