[prev in list] [next in list] [prev in thread] [next in thread] 

List:       kde-commits
Subject:    Re: [nepomuk-core/feature/virtuosoInference] services/storage: Remove visibility support from ClassA
From:       Vishesh Handa <handa.vish () gmail ! com>
Date:       2012-03-31 19:30:03
Message-ID: CAOPTMKDigZB1ZBBEwPqSsNEztVGa=JBM0OAHHj_Xz0ZtJPe1sw () mail ! gmail ! com
[Download RAW message or body]

On Sun, Apr 1, 2012 at 12:30 AM, Sebastian Trueg <trueg@kde.org> wrote:

> Git commit dded30ce71027815817007b1e854fdabad2774c8 by Sebastian Trueg.
> Committed on 31/03/2012 at 20:58.
> Pushed by trueg into branch 'feature/virtuosoInference'.
>
> Remove visibility support from ClassAndPropertyTree.
>
> Now that we changed the visibility handling and removed the crappy
> inferencer 2 there is no need for the visibility handling anymore.
>

How does visibility handling having anything to do with inferencing?


>
> M  +4    -77   services/storage/classandpropertytree.cpp
> M  +1    -6    services/storage/classandpropertytree.h
> M  +5    -38   services/storage/test/classandpropertytreetest.cpp
> M  +1    -3    services/storage/test/classandpropertytreetest.h
>
>
> http://commits.kde.org/nepomuk-core/dded30ce71027815817007b1e854fdabad2774c8
>
> diff --git a/services/storage/classandpropertytree.cpp
> b/services/storage/classandpropertytree.cpp
> index 046525b..98954ae 100644
> --- a/services/storage/classandpropertytree.cpp
> +++ b/services/storage/classandpropertytree.cpp
> @@ -52,7 +52,6 @@ public:
>     ClassOrProperty()
>         : isProperty(false),
>           maxCardinality(0),
> -          userVisible(0),
>           defining(0) {
>     }
>
> @@ -71,9 +70,6 @@ public:
>     /// the max cardinality if this is a property with a max cardinality
> set, 0 otherwise
>     int maxCardinality;
>
> -    /// 0 - undecided, 1 - visible, -1 - non-visible
> -    int userVisible;
> -
>     /// 0 - undecided, 1 - defining, -1 - non-defining
>     int defining;
>
> @@ -148,15 +144,6 @@ int
> Nepomuk::ClassAndPropertyTree::maxCardinality(const QUrl &type) const
>         return 0;
>  }
>
> -bool Nepomuk::ClassAndPropertyTree::isUserVisible(const QUrl &type) const
> -{
> -    QMutexLocker lock(&m_mutex);
> -    if(const ClassOrProperty* cop = findClassOrProperty(type))
> -        return cop->userVisible == 1;
> -    else
> -        return true;
> -}
> -
>  QUrl Nepomuk::ClassAndPropertyTree::propertyDomain(const QUrl &uri) const
>  {
>     QMutexLocker lock(&m_mutex);
> @@ -345,14 +332,12 @@ void
> Nepomuk::ClassAndPropertyTree::rebuildTree(Soprano::Model* model)
>                                   "OPTIONAL { ?r rdfs:subPropertyOf ?p .
> ?p a rdf:Property . } . } "
>                                   "OPTIONAL { ?r %1 ?mc . } . "
>                                   "OPTIONAL { ?r %2 ?c . } . "
> -                                  "OPTIONAL { ?r %3 ?v . } . "
> -                                  "OPTIONAL { ?r %4 ?domain . } . "
> -                                  "OPTIONAL { ?r %5 ?range . } . "
> -                                  "FILTER(?r!=%6) . "
> +                                  "OPTIONAL { ?r %3 ?domain . } . "
> +                                  "OPTIONAL { ?r %4 ?range . } . "
> +                                  "FILTER(?r!=%5) . "
>                                   "}" )
>             .arg(Soprano::Node::resourceToN3(NRL::maxCardinality()),
>                  Soprano::Node::resourceToN3(NRL::cardinality()),
> -                 Soprano::Node::resourceToN3(NAO::userVisible()),
>                  Soprano::Node::resourceToN3(RDFS::domain()),
>                  Soprano::Node::resourceToN3(RDFS::range()),
>                  Soprano::Node::resourceToN3(RDFS::Resource()));
> @@ -381,10 +366,6 @@ void
> Nepomuk::ClassAndPropertyTree::rebuildTree(Soprano::Model* model)
>
>         r_cop->isProperty = it["pt"].isValid();
>
> -        if( v.isLiteral() ) {
> -            r_cop->userVisible = (v.literal().toBool() ? 1 : -1);
> -        }
> -
>         if(mc > 0 || c > 0) {
>             r_cop->maxCardinality = qMax(mc, c);
>         }
> @@ -420,7 +401,7 @@ void
> Nepomuk::ClassAndPropertyTree::rebuildTree(Soprano::Model* model)
>     if(m_tree.contains(NAO::identifier()))
>         m_tree[NAO::identifier()]->range = XMLSchema::string();
>
> -    // make sure rdfs:Resource is visible by default
> +    // add rdfs:Resource as parent for all top-level classes
>     ClassOrProperty* rdfsResourceNode = 0;
>     QHash<QUrl, ClassOrProperty*>::iterator rdfsResourceIt =
> m_tree.find(RDFS::Resource());
>     if( rdfsResourceIt == m_tree.end() ) {
> @@ -431,10 +412,6 @@ void
> Nepomuk::ClassAndPropertyTree::rebuildTree(Soprano::Model* model)
>     else {
>         rdfsResourceNode = rdfsResourceIt.value();
>     }
> -    if( rdfsResourceNode->userVisible == 0 ) {
> -        rdfsResourceNode->userVisible = 1;
> -    }
> -    // add rdfs:Resource as parent for all top-level classes
>     for ( QHash<QUrl, ClassOrProperty*>::iterator it = m_tree.begin();
>           it != m_tree.end(); ++it ) {
>         if( it.value() != rdfsResourceNode &&
> it.value()->directParents.isEmpty() ) {
> @@ -442,13 +419,6 @@ void
> Nepomuk::ClassAndPropertyTree::rebuildTree(Soprano::Model* model)
>         }
>     }
>
> -    // update all visibility
> -    for ( QHash<QUrl, ClassOrProperty*>::iterator it = m_tree.begin();
> -          it != m_tree.end(); ++it ) {
> -        QSet<QUrl> visitedNodes;
> -        updateUserVisibility( it.value(), visitedNodes );
> -    }
> -
>     // complete the allParents lists
>     for ( QHash<QUrl, ClassOrProperty*>::iterator it = m_tree.begin();
>           it != m_tree.end(); ++it ) {
> @@ -508,36 +478,6 @@ bool Nepomuk::ClassAndPropertyTree::contains(const
> QUrl& uri) const
>
>
>  /**
> - * Set the value of nao:userVisible.
> - * A class is visible if it has at least one visible direct parent class.
> - */
> -int Nepomuk::ClassAndPropertyTree::updateUserVisibility( ClassOrProperty*
> cop, QSet<QUrl>& visitedNodes )
> -{
> -    if ( cop->userVisible != 0 ) {
> -        return cop->userVisible;
> -    }
> -    else {
> -        for ( QSet<QUrl>::iterator it = cop->directParents.begin();
> -             it != cop->directParents.end(); ++it ) {
> -            // avoid endless loops
> -            if( visitedNodes.contains(*it) )
> -                continue;
> -            visitedNodes.insert(*it);
> -            if ( updateUserVisibility( m_tree[*it], visitedNodes ) == 1 )
> {
> -                cop->userVisible = 1;
> -                break;
> -            }
> -        }
> -        if ( cop->userVisible == 0 ) {
> -            // default to invisible
> -            cop->userVisible = -1;
> -        }
> -        //kDebug() << "Setting nao:userVisible of" << cop->uri.toString()
> << ( cop->userVisible == 1 );
> -        return cop->userVisible;
> -    }
> -}
> -
> -/**
>  * Set the value of defining.
>  * An defining property has at least one defining direct parent property.
>  */
> @@ -625,19 +565,6 @@ QList<Soprano::Statement>
> Nepomuk::ClassAndPropertyTree::simpleResourceGraphToSt
>     return list;
>  }
>
> -QList<QUrl> Nepomuk::ClassAndPropertyTree::visibleTypes() const
> -{
> -    QList<QUrl> types;
> -    QHash<QUrl, ClassOrProperty*>::const_iterator end = m_tree.constEnd();
> -    for(QHash<QUrl, ClassOrProperty*>::const_iterator it =
> m_tree.constBegin(); it != end; ++it) {
> -        const ClassOrProperty* cop = *it;
> -        if(!cop->isProperty && cop->userVisible == 1) {
> -            types << cop->uri;
> -        }
> -    }
> -    return types;
> -}
> -
>  Nepomuk::ClassAndPropertyTree * Nepomuk::ClassAndPropertyTree::self()
>  {
>     return s_self;
> diff --git a/services/storage/classandpropertytree.h
> b/services/storage/classandpropertytree.h
> index b54daeb..508004a 100644
> --- a/services/storage/classandpropertytree.h
> +++ b/services/storage/classandpropertytree.h
> @@ -1,6 +1,6 @@
>  /*
>    This file is part of the Nepomuk KDE project.
> -   Copyright (C) 2010 Sebastian Trueg <trueg@kde.org>
> +   Copyright (C) 2010-2012 Sebastian Trueg <trueg@kde.org>
>
>    This library is free software; you can redistribute it and/or
>    modify it under the terms of the GNU Lesser General Public
> @@ -64,7 +64,6 @@ public:
>      */
>     bool isChildOf(const QList<QUrl> & types, const QUrl& superClass)
> const;
>     int maxCardinality(const QUrl& type) const;
> -    bool isUserVisible(const QUrl& type) const;
>
>     QUrl propertyDomain(const QUrl& uri) const;
>     QUrl propertyRange(const QUrl& uri) const;
> @@ -75,9 +74,6 @@ public:
>     /// \return \p true if \p uri is an defining property, \p false
> otherwise
>     bool isDefiningProperty(const QUrl& uri) const;
>
> -    /// \return A list of all known rdf classes that are visible
> (nao:userVisible)
> -    QList<QUrl> visibleTypes() const;
> -
>     /// will try very hard to convert a variant into a node. Supports
> literal XML types and QUrl
>     Soprano::Node variantToNode(const QVariant& value, const QUrl&
> property) const;
>     QSet<Soprano::Node> variantListToNodeSet(const QVariantList& vl, const
> QUrl& property) const;
> @@ -94,7 +90,6 @@ private:
>     class ClassOrProperty;
>
>     const ClassOrProperty* findClassOrProperty(const QUrl& uri) const;
> -    int updateUserVisibility(ClassOrProperty *cop, QSet<QUrl>
> &visitedNodes);
>     int updateDefining(ClassOrProperty* cop, QSet<QUrl>& definingNodes);
>     QSet<QUrl> getAllParents(ClassOrProperty *cop, QSet<QUrl>
> &visitedNodes);
>
> diff --git a/services/storage/test/classandpropertytreetest.cpp
> b/services/storage/test/classandpropertytreetest.cpp
> index 6d6ee75..acd2d5f 100644
> --- a/services/storage/test/classandpropertytreetest.cpp
> +++ b/services/storage/test/classandpropertytreetest.cpp
> @@ -1,6 +1,6 @@
>  /*
>    This file is part of the Nepomuk KDE project.
> -   Copyright (C) 2010-2011 Sebastian Trueg <trueg@kde.org>
> +   Copyright (C) 2010-2012 Sebastian Trueg <trueg@kde.org>
>
>    This library is free software; you can redistribute it and/or
>    modify it under the terms of the GNU Lesser General Public
> @@ -64,30 +64,24 @@ void ClassAndPropertyTreeTest::init()
>     // we create one fake ontology
>     //
>     // situations we need to test:
> -    // * class that is marked visible should stay visible
> -    // * class that is marked invisible should stay invisible
> -    // * non-marked subclass of visible should be visible, too
> -    // * non-marked subclass of invisible should be invisible, too
>     // * marked subclass should keep its own visiblity and not inherit
> from parent
>     // * whole branch should inherit from parent
> -    // * if one parent is visible the class is visible, too, even if N
> other parents are not
> -    // * if all parents are invisible, the class is invisible, even if
> higher up in the branch a class is visible
>     // * properly handle loops (as in: do not run into an endless loop)
>     //
>     // A
> -    // |- B - invisible
> +    // |- B
>     //    |- C
> -    //       |- D - visible
> +    //       |- D
>     //          |- E
>     //             |- F
>     //    |- G
>     //
> -    // AA - invisible
> +    // AA
>     // | - F
>     // | - G
>     //
>     // X
> -    // |- Y - invisible
> +    // |- Y
>     //    |- Z
>     //       |- X
>
> @@ -146,21 +140,6 @@ void ClassAndPropertyTreeTest::init()
>     m_typeTree->rebuildTree(m_model);
>  }
>
> -void ClassAndPropertyTreeTest::testVisibility()
> -{
> -    QVERIFY(m_typeTree->isUserVisible(QUrl("onto:/A")));
> -    QVERIFY(!m_typeTree->isUserVisible(QUrl("onto:/B")));
> -    QVERIFY(!m_typeTree->isUserVisible(QUrl("onto:/C")));
> -    QVERIFY(m_typeTree->isUserVisible(QUrl("onto:/D")));
> -    QVERIFY(m_typeTree->isUserVisible(QUrl("onto:/E")));
> -    QVERIFY(m_typeTree->isUserVisible(QUrl("onto:/F")));
> -    QVERIFY(!m_typeTree->isUserVisible(QUrl("onto:/G")));
> -    QVERIFY(!m_typeTree->isUserVisible(QUrl("onto:/AA")));
> -    QVERIFY(!m_typeTree->isUserVisible(QUrl("onto:/X"))); // because only
> top-level classes inherit from rdfs:Resource
> -    QVERIFY(!m_typeTree->isUserVisible(QUrl("onto:/Y")));
> -    QVERIFY(!m_typeTree->isUserVisible(QUrl("onto:/Z")));
> -}
> -
>  void ClassAndPropertyTreeTest::testParents()
>  {
>     QCOMPARE(m_typeTree->allParents(QUrl("onto:/A")).count(), 1);
> @@ -273,18 +252,6 @@ void ClassAndPropertyTreeTest::testProperties()
>     QCOMPARE(m_typeTree->maxCardinality(QUrl("prop:/D")), 1);
>  }
>
> -void ClassAndPropertyTreeTest::testVisibleType()
> -{
> -    const QList<QUrl> types = m_typeTree->visibleTypes();
> -    kDebug() << types;
> -    QCOMPARE(types.count(), 5);
> -    QVERIFY(types.contains(RDFS::Resource()));
> -    QVERIFY(types.contains(QUrl("onto:/A")));
> -    QVERIFY(types.contains(QUrl("onto:/D")));
> -    QVERIFY(types.contains(QUrl("onto:/E")));
> -    QVERIFY(types.contains(QUrl("onto:/F")));
> -}
> -
>  QTEST_KDEMAIN_CORE(ClassAndPropertyTreeTest)
>
>  #include "classandpropertytreetest.moc"
> diff --git a/services/storage/test/classandpropertytreetest.h
> b/services/storage/test/classandpropertytreetest.h
> index 29d961b..f078d91 100644
> --- a/services/storage/test/classandpropertytreetest.h
> +++ b/services/storage/test/classandpropertytreetest.h
> @@ -1,6 +1,6 @@
>  /*
>    This file is part of the Nepomuk KDE project.
> -   Copyright (C) 2010-2011 Sebastian Trueg <trueg@kde.org>
> +   Copyright (C) 2010-2012 Sebastian Trueg <trueg@kde.org>
>
>    This library is free software; you can redistribute it and/or
>    modify it under the terms of the GNU Lesser General Public
> @@ -40,12 +40,10 @@ private Q_SLOTS:
>     void initTestCase();
>     void cleanupTestCase();
>     void init();
> -    void testVisibility();
>     void testParents();
>     void testVariantToNode_data();
>     void testVariantToNode();
>     void testProperties();
> -    void testVisibleType();
>
>  private:
>     KTempDir* m_storageDir;
>

[Attachment #3 (text/html)]

<br><div class="gmail_quote">On Sun, Apr 1, 2012 at 12:30 AM, Sebastian Trueg <span \
dir="ltr">&lt;<a href="mailto:trueg@kde.org">trueg@kde.org</a>&gt;</span> \
wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px \
#ccc solid;padding-left:1ex"> Git commit dded30ce71027815817007b1e854fdabad2774c8 by \
Sebastian Trueg.<br> Committed on 31/03/2012 at 20:58.<br>
Pushed by trueg into branch &#39;feature/virtuosoInference&#39;.<br>
<br>
Remove visibility support from ClassAndPropertyTree.<br>
<br>
Now that we changed the visibility handling and removed the crappy<br>
inferencer 2 there is no need for the visibility handling \
anymore.<br></blockquote><div><br>How does visibility handling having anything to do \
with inferencing?<br> <br></div><blockquote class="gmail_quote" style="margin:0pt 0pt \
0pt 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex">

<br>
M  +4    -77   services/storage/classandpropertytree.cpp<br>
M  +1    -6    services/storage/classandpropertytree.h<br>
M  +5    -38   services/storage/test/classandpropertytreetest.cpp<br>
M  +1    -3    services/storage/test/classandpropertytreetest.h<br>
<br>
<a href="http://commits.kde.org/nepomuk-core/dded30ce71027815817007b1e854fdabad2774c8" \
target="_blank">http://commits.kde.org/nepomuk-core/dded30ce71027815817007b1e854fdabad2774c8</a><br>
 <br>
diff --git a/services/storage/classandpropertytree.cpp \
b/services/storage/classandpropertytree.cpp<br> index 046525b..98954ae 100644<br>
--- a/services/storage/classandpropertytree.cpp<br>
+++ b/services/storage/classandpropertytree.cpp<br>
@@ -52,7 +52,6 @@ public:<br>
     ClassOrProperty()<br>
         : isProperty(false),<br>
           maxCardinality(0),<br>
-          userVisible(0),<br>
           defining(0) {<br>
     }<br>
<br>
@@ -71,9 +70,6 @@ public:<br>
     /// the max cardinality if this is a property with a max cardinality set, 0 \
otherwise<br>  int maxCardinality;<br>
<br>
-    /// 0 - undecided, 1 - visible, -1 - non-visible<br>
-    int userVisible;<br>
-<br>
     /// 0 - undecided, 1 - defining, -1 - non-defining<br>
     int defining;<br>
<br>
@@ -148,15 +144,6 @@ int Nepomuk::ClassAndPropertyTree::maxCardinality(const QUrl \
&amp;type) const<br>  return 0;<br>
 }<br>
<br>
-bool Nepomuk::ClassAndPropertyTree::isUserVisible(const QUrl &amp;type) const<br>
-{<br>
-    QMutexLocker lock(&amp;m_mutex);<br>
-    if(const ClassOrProperty* cop = findClassOrProperty(type))<br>
-        return cop-&gt;userVisible == 1;<br>
-    else<br>
-        return true;<br>
-}<br>
-<br>
 QUrl Nepomuk::ClassAndPropertyTree::propertyDomain(const QUrl &amp;uri) const<br>
 {<br>
     QMutexLocker lock(&amp;m_mutex);<br>
@@ -345,14 +332,12 @@ void Nepomuk::ClassAndPropertyTree::rebuildTree(Soprano::Model* \
                model)<br>
                                   &quot;OPTIONAL { ?r rdfs:subPropertyOf ?p . ?p a \
                rdf:Property . } . } &quot;<br>
                                   &quot;OPTIONAL { ?r %1 ?mc . } . &quot;<br>
                                   &quot;OPTIONAL { ?r %2 ?c . } . &quot;<br>
-                                  &quot;OPTIONAL { ?r %3 ?v . } . &quot;<br>
-                                  &quot;OPTIONAL { ?r %4 ?domain . } . &quot;<br>
-                                  &quot;OPTIONAL { ?r %5 ?range . } . &quot;<br>
-                                  &quot;FILTER(?r!=%6) . &quot;<br>
+                                  &quot;OPTIONAL { ?r %3 ?domain . } . &quot;<br>
+                                  &quot;OPTIONAL { ?r %4 ?range . } . &quot;<br>
+                                  &quot;FILTER(?r!=%5) . &quot;<br>
                                   &quot;}&quot; )<br>
             .arg(Soprano::Node::resourceToN3(NRL::maxCardinality()),<br>
                  Soprano::Node::resourceToN3(NRL::cardinality()),<br>
-                 Soprano::Node::resourceToN3(NAO::userVisible()),<br>
                  Soprano::Node::resourceToN3(RDFS::domain()),<br>
                  Soprano::Node::resourceToN3(RDFS::range()),<br>
                  Soprano::Node::resourceToN3(RDFS::Resource()));<br>
@@ -381,10 +366,6 @@ void Nepomuk::ClassAndPropertyTree::rebuildTree(Soprano::Model* \
model)<br> <br>
         r_cop-&gt;isProperty = it[&quot;pt&quot;].isValid();<br>
<br>
-        if( v.isLiteral() ) {<br>
-            r_cop-&gt;userVisible = (v.literal().toBool() ? 1 : -1);<br>
-        }<br>
-<br>
         if(mc &gt; 0 || c &gt; 0) {<br>
             r_cop-&gt;maxCardinality = qMax(mc, c);<br>
         }<br>
@@ -420,7 +401,7 @@ void Nepomuk::ClassAndPropertyTree::rebuildTree(Soprano::Model* \
model)<br>  if(m_tree.contains(NAO::identifier()))<br>
         m_tree[NAO::identifier()]-&gt;range = XMLSchema::string();<br>
<br>
-    // make sure rdfs:Resource is visible by default<br>
+    // add rdfs:Resource as parent for all top-level classes<br>
     ClassOrProperty* rdfsResourceNode = 0;<br>
     QHash&lt;QUrl, ClassOrProperty*&gt;::iterator rdfsResourceIt = \
m_tree.find(RDFS::Resource());<br>  if( rdfsResourceIt == m_tree.end() ) {<br>
@@ -431,10 +412,6 @@ void Nepomuk::ClassAndPropertyTree::rebuildTree(Soprano::Model* \
model)<br>  else {<br>
         rdfsResourceNode = rdfsResourceIt.value();<br>
     }<br>
-    if( rdfsResourceNode-&gt;userVisible == 0 ) {<br>
-        rdfsResourceNode-&gt;userVisible = 1;<br>
-    }<br>
-    // add rdfs:Resource as parent for all top-level classes<br>
     for ( QHash&lt;QUrl, ClassOrProperty*&gt;::iterator it = m_tree.begin();<br>
           it != m_tree.end(); ++it ) {<br>
         if( it.value() != rdfsResourceNode &amp;&amp; \
it.value()-&gt;directParents.isEmpty() ) {<br> @@ -442,13 +419,6 @@ void \
Nepomuk::ClassAndPropertyTree::rebuildTree(Soprano::Model* model)<br>  }<br>
     }<br>
<br>
-    // update all visibility<br>
-    for ( QHash&lt;QUrl, ClassOrProperty*&gt;::iterator it = m_tree.begin();<br>
-          it != m_tree.end(); ++it ) {<br>
-        QSet&lt;QUrl&gt; visitedNodes;<br>
-        updateUserVisibility( it.value(), visitedNodes );<br>
-    }<br>
-<br>
     // complete the allParents lists<br>
     for ( QHash&lt;QUrl, ClassOrProperty*&gt;::iterator it = m_tree.begin();<br>
           it != m_tree.end(); ++it ) {<br>
@@ -508,36 +478,6 @@ bool Nepomuk::ClassAndPropertyTree::contains(const QUrl&amp; \
uri) const<br> <br>
<br>
 /**<br>
- * Set the value of nao:userVisible.<br>
- * A class is visible if it has at least one visible direct parent class.<br>
- */<br>
-int Nepomuk::ClassAndPropertyTree::updateUserVisibility( ClassOrProperty* cop, \
                QSet&lt;QUrl&gt;&amp; visitedNodes )<br>
-{<br>
-    if ( cop-&gt;userVisible != 0 ) {<br>
-        return cop-&gt;userVisible;<br>
-    }<br>
-    else {<br>
-        for ( QSet&lt;QUrl&gt;::iterator it = cop-&gt;directParents.begin();<br>
-             it != cop-&gt;directParents.end(); ++it ) {<br>
-            // avoid endless loops<br>
-            if( visitedNodes.contains(*it) )<br>
-                continue;<br>
-            visitedNodes.insert(*it);<br>
-            if ( updateUserVisibility( m_tree[*it], visitedNodes ) == 1 ) {<br>
-                cop-&gt;userVisible = 1;<br>
-                break;<br>
-            }<br>
-        }<br>
-        if ( cop-&gt;userVisible == 0 ) {<br>
-            // default to invisible<br>
-            cop-&gt;userVisible = -1;<br>
-        }<br>
-        //kDebug() &lt;&lt; &quot;Setting nao:userVisible of&quot; &lt;&lt; \
                cop-&gt;uri.toString() &lt;&lt; ( cop-&gt;userVisible == 1 );<br>
-        return cop-&gt;userVisible;<br>
-    }<br>
-}<br>
-<br>
-/**<br>
  * Set the value of defining.<br>
  * An defining property has at least one defining direct parent property.<br>
  */<br>
@@ -625,19 +565,6 @@ QList&lt;Soprano::Statement&gt; \
Nepomuk::ClassAndPropertyTree::simpleResourceGraphToSt<br>  return list;<br>
 }<br>
<br>
-QList&lt;QUrl&gt; Nepomuk::ClassAndPropertyTree::visibleTypes() const<br>
-{<br>
-    QList&lt;QUrl&gt; types;<br>
-    QHash&lt;QUrl, ClassOrProperty*&gt;::const_iterator end = m_tree.constEnd();<br>
-    for(QHash&lt;QUrl, ClassOrProperty*&gt;::const_iterator it = \
                m_tree.constBegin(); it != end; ++it) {<br>
-        const ClassOrProperty* cop = *it;<br>
-        if(!cop-&gt;isProperty &amp;&amp; cop-&gt;userVisible == 1) {<br>
-            types &lt;&lt; cop-&gt;uri;<br>
-        }<br>
-    }<br>
-    return types;<br>
-}<br>
-<br>
 Nepomuk::ClassAndPropertyTree * Nepomuk::ClassAndPropertyTree::self()<br>
 {<br>
     return s_self;<br>
diff --git a/services/storage/classandpropertytree.h \
b/services/storage/classandpropertytree.h<br> index b54daeb..508004a 100644<br>
--- a/services/storage/classandpropertytree.h<br>
+++ b/services/storage/classandpropertytree.h<br>
@@ -1,6 +1,6 @@<br>
 /*<br>
    This file is part of the Nepomuk KDE project.<br>
-   Copyright (C) 2010 Sebastian Trueg &lt;<a \
href="mailto:trueg@kde.org">trueg@kde.org</a>&gt;<br> +   Copyright (C) 2010-2012 \
Sebastian Trueg &lt;<a href="mailto:trueg@kde.org">trueg@kde.org</a>&gt;<br> <br>
    This library is free software; you can redistribute it and/or<br>
    modify it under the terms of the GNU Lesser General Public<br>
@@ -64,7 +64,6 @@ public:<br>
      */<br>
     bool isChildOf(const QList&lt;QUrl&gt; &amp; types, const QUrl&amp; superClass) \
const;<br>  int maxCardinality(const QUrl&amp; type) const;<br>
-    bool isUserVisible(const QUrl&amp; type) const;<br>
<br>
     QUrl propertyDomain(const QUrl&amp; uri) const;<br>
     QUrl propertyRange(const QUrl&amp; uri) const;<br>
@@ -75,9 +74,6 @@ public:<br>
     /// \return \p true if \p uri is an defining property, \p false otherwise<br>
     bool isDefiningProperty(const QUrl&amp; uri) const;<br>
<br>
-    /// \return A list of all known rdf classes that are visible \
                (nao:userVisible)<br>
-    QList&lt;QUrl&gt; visibleTypes() const;<br>
-<br>
     /// will try very hard to convert a variant into a node. Supports literal XML \
                types and QUrl<br>
     Soprano::Node variantToNode(const QVariant&amp; value, const QUrl&amp; property) \
                const;<br>
     QSet&lt;Soprano::Node&gt; variantListToNodeSet(const QVariantList&amp; vl, const \
QUrl&amp; property) const;<br> @@ -94,7 +90,6 @@ private:<br>
     class ClassOrProperty;<br>
<br>
     const ClassOrProperty* findClassOrProperty(const QUrl&amp; uri) const;<br>
-    int updateUserVisibility(ClassOrProperty *cop, QSet&lt;QUrl&gt; \
                &amp;visitedNodes);<br>
     int updateDefining(ClassOrProperty* cop, QSet&lt;QUrl&gt;&amp; \
                definingNodes);<br>
     QSet&lt;QUrl&gt; getAllParents(ClassOrProperty *cop, QSet&lt;QUrl&gt; \
&amp;visitedNodes);<br> <br>
diff --git a/services/storage/test/classandpropertytreetest.cpp \
b/services/storage/test/classandpropertytreetest.cpp<br> index 6d6ee75..acd2d5f \
                100644<br>
--- a/services/storage/test/classandpropertytreetest.cpp<br>
+++ b/services/storage/test/classandpropertytreetest.cpp<br>
@@ -1,6 +1,6 @@<br>
 /*<br>
    This file is part of the Nepomuk KDE project.<br>
-   Copyright (C) 2010-2011 Sebastian Trueg &lt;<a \
href="mailto:trueg@kde.org">trueg@kde.org</a>&gt;<br> +   Copyright (C) 2010-2012 \
Sebastian Trueg &lt;<a href="mailto:trueg@kde.org">trueg@kde.org</a>&gt;<br> <br>
    This library is free software; you can redistribute it and/or<br>
    modify it under the terms of the GNU Lesser General Public<br>
@@ -64,30 +64,24 @@ void ClassAndPropertyTreeTest::init()<br>
     // we create one fake ontology<br>
     //<br>
     // situations we need to test:<br>
-    // * class that is marked visible should stay visible<br>
-    // * class that is marked invisible should stay invisible<br>
-    // * non-marked subclass of visible should be visible, too<br>
-    // * non-marked subclass of invisible should be invisible, too<br>
     // * marked subclass should keep its own visiblity and not inherit from \
parent<br>  // * whole branch should inherit from parent<br>
-    // * if one parent is visible the class is visible, too, even if N other parents \
                are not<br>
-    // * if all parents are invisible, the class is invisible, even if higher up in \
                the branch a class is visible<br>
     // * properly handle loops (as in: do not run into an endless loop)<br>
     //<br>
     // A<br>
-    // |- B - invisible<br>
+    // |- B<br>
     //    |- C<br>
-    //       |- D - visible<br>
+    //       |- D<br>
     //          |- E<br>
     //             |- F<br>
     //    |- G<br>
     //<br>
-    // AA - invisible<br>
+    // AA<br>
     // | - F<br>
     // | - G<br>
     //<br>
     // X<br>
-    // |- Y - invisible<br>
+    // |- Y<br>
     //    |- Z<br>
     //       |- X<br>
<br>
@@ -146,21 +140,6 @@ void ClassAndPropertyTreeTest::init()<br>
     m_typeTree-&gt;rebuildTree(m_model);<br>
 }<br>
<br>
-void ClassAndPropertyTreeTest::testVisibility()<br>
-{<br>
-    QVERIFY(m_typeTree-&gt;isUserVisible(QUrl(&quot;onto:/A&quot;)));<br>
-    QVERIFY(!m_typeTree-&gt;isUserVisible(QUrl(&quot;onto:/B&quot;)));<br>
-    QVERIFY(!m_typeTree-&gt;isUserVisible(QUrl(&quot;onto:/C&quot;)));<br>
-    QVERIFY(m_typeTree-&gt;isUserVisible(QUrl(&quot;onto:/D&quot;)));<br>
-    QVERIFY(m_typeTree-&gt;isUserVisible(QUrl(&quot;onto:/E&quot;)));<br>
-    QVERIFY(m_typeTree-&gt;isUserVisible(QUrl(&quot;onto:/F&quot;)));<br>
-    QVERIFY(!m_typeTree-&gt;isUserVisible(QUrl(&quot;onto:/G&quot;)));<br>
-    QVERIFY(!m_typeTree-&gt;isUserVisible(QUrl(&quot;onto:/AA&quot;)));<br>
-    QVERIFY(!m_typeTree-&gt;isUserVisible(QUrl(&quot;onto:/X&quot;))); // because \
                only top-level classes inherit from rdfs:Resource<br>
-    QVERIFY(!m_typeTree-&gt;isUserVisible(QUrl(&quot;onto:/Y&quot;)));<br>
-    QVERIFY(!m_typeTree-&gt;isUserVisible(QUrl(&quot;onto:/Z&quot;)));<br>
-}<br>
-<br>
 void ClassAndPropertyTreeTest::testParents()<br>
 {<br>
     QCOMPARE(m_typeTree-&gt;allParents(QUrl(&quot;onto:/A&quot;)).count(), 1);<br>
@@ -273,18 +252,6 @@ void ClassAndPropertyTreeTest::testProperties()<br>
     QCOMPARE(m_typeTree-&gt;maxCardinality(QUrl(&quot;prop:/D&quot;)), 1);<br>
 }<br>
<br>
-void ClassAndPropertyTreeTest::testVisibleType()<br>
-{<br>
-    const QList&lt;QUrl&gt; types = m_typeTree-&gt;visibleTypes();<br>
-    kDebug() &lt;&lt; types;<br>
-    QCOMPARE(types.count(), 5);<br>
-    QVERIFY(types.contains(RDFS::Resource()));<br>
-    QVERIFY(types.contains(QUrl(&quot;onto:/A&quot;)));<br>
-    QVERIFY(types.contains(QUrl(&quot;onto:/D&quot;)));<br>
-    QVERIFY(types.contains(QUrl(&quot;onto:/E&quot;)));<br>
-    QVERIFY(types.contains(QUrl(&quot;onto:/F&quot;)));<br>
-}<br>
-<br>
 QTEST_KDEMAIN_CORE(ClassAndPropertyTreeTest)<br>
<br>
 #include &quot;classandpropertytreetest.moc&quot;<br>
diff --git a/services/storage/test/classandpropertytreetest.h \
b/services/storage/test/classandpropertytreetest.h<br> index 29d961b..f078d91 \
                100644<br>
--- a/services/storage/test/classandpropertytreetest.h<br>
+++ b/services/storage/test/classandpropertytreetest.h<br>
@@ -1,6 +1,6 @@<br>
 /*<br>
    This file is part of the Nepomuk KDE project.<br>
-   Copyright (C) 2010-2011 Sebastian Trueg &lt;<a \
href="mailto:trueg@kde.org">trueg@kde.org</a>&gt;<br> +   Copyright (C) 2010-2012 \
Sebastian Trueg &lt;<a href="mailto:trueg@kde.org">trueg@kde.org</a>&gt;<br> <br>
    This library is free software; you can redistribute it and/or<br>
    modify it under the terms of the GNU Lesser General Public<br>
@@ -40,12 +40,10 @@ private Q_SLOTS:<br>
     void initTestCase();<br>
     void cleanupTestCase();<br>
     void init();<br>
-    void testVisibility();<br>
     void testParents();<br>
     void testVariantToNode_data();<br>
     void testVariantToNode();<br>
     void testProperties();<br>
-    void testVisibleType();<br>
<br>
 private:<br>
     KTempDir* m_storageDir;<br>
</blockquote></div><br>



[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic