• Skip to content
  • Skip to link menu
KDE API Reference
  • KDE API Reference
  • kdelibs API Reference
  • KDE Home
  • Contact Us
 

Nepomuk-Core

  • sources
  • kde-4.12
  • kdelibs
  • nepomuk-core
  • services
  • storage
classandpropertytree.h
Go to the documentation of this file.
1 /*
2  This file is part of the Nepomuk KDE project.
3  Copyright (C) 2010-2012 Sebastian Trueg <trueg@kde.org>
4 
5  This library is free software; you can redistribute it and/or
6  modify it under the terms of the GNU Lesser General Public
7  License as published by the Free Software Foundation; either
8  version 2.1 of the License, or (at your option) version 3, or any
9  later version accepted by the membership of KDE e.V. (or its
10  successor approved by the membership of KDE e.V.), which shall
11  act as a proxy defined in Section 6 of version 3 of the license.
12 
13  This library is distributed in the hope that it will be useful,
14  but WITHOUT ANY WARRANTY; without even the implied warranty of
15  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
16  Lesser General Public License for more details.
17 
18  You should have received a copy of the GNU Lesser General Public
19  License along with this library. If not, see <http://www.gnu.org/licenses/>.
20 */
21 
22 #ifndef CLASSANDPROPERTYTREE_H
23 #define CLASSANDPROPERTYTREE_H
24 
25 #include <QtCore/QObject>
26 #include <QtCore/QUrl>
27 #include <QtCore/QVariant>
28 #include <QtCore/QMutex>
29 #include <QtCore/QList>
30 
31 #include <Soprano/Error/ErrorCache>
32 
33 namespace Soprano {
34 class Model;
35 class Node;
36 class Statement;
37 }
38 
39 
40 namespace Nepomuk2 {
41 
42 class SimpleResource;
43 class SimpleResourceGraph;
44 
45 class ClassAndPropertyTree : public QObject, public Soprano::Error::ErrorCache
46 {
47  Q_OBJECT
48 
49 public:
50  ClassAndPropertyTree(QObject *parent = 0);
51  ~ClassAndPropertyTree();
52 
54  bool isKnownClass(const QUrl& uri) const;
55 
56  QSet<QUrl> allParents(const QUrl& uri) const;
57  QSet<QUrl> allParents(const QList<QUrl>& types) const;
58  bool isChildOf(const QUrl& type, const QUrl& superClass) const;
59 
61  bool contains(const QUrl& uri) const;
62 
66  bool isChildOf(const QList<QUrl> & types, const QUrl& superClass) const;
67  int maxCardinality(const QUrl& type) const;
68 
69  QUrl propertyDomain(const QUrl& uri) const;
70  QUrl propertyRange(const QUrl& uri) const;
71 
73  bool hasLiteralRange(const QUrl& uri) const;
74 
76  bool isDefiningProperty(const QUrl& uri) const;
77 
79  Soprano::Node variantToNode(const QVariant& value, const QUrl& property) const;
80  QSet<Soprano::Node> variantListToNodeSet(const QVariantList& vl, const QUrl& property) const;
81 
82  static ClassAndPropertyTree* self();
83 
84 public Q_SLOTS:
85  void rebuildTree(Soprano::Model* model);
86 
87 private:
88  class ClassOrProperty;
89 
90  const ClassOrProperty* findClassOrProperty(const QUrl& uri) const;
91  int updateDefining(ClassOrProperty* cop, QSet<QUrl>& definingNodes);
92  QSet<QUrl> getAllParents(ClassOrProperty *cop, QSet<QUrl> &visitedNodes);
93 
94  QHash<QUrl, ClassOrProperty*> m_tree;
95 
96  // TODO: Convert to read/write lock
97  mutable QMutex m_mutex;
98 
99  static ClassAndPropertyTree* s_self;
100 };
101 }
102 
103 #endif
Nepomuk2::ClassAndPropertyTree::hasLiteralRange
bool hasLiteralRange(const QUrl &uri) const
Definition: classandpropertytree.cpp:182
Nepomuk2::ClassAndPropertyTree::propertyDomain
QUrl propertyDomain(const QUrl &uri) const
Definition: classandpropertytree.cpp:164
QHash
QObject
ErrorCache
Nepomuk2::ClassAndPropertyTree
Definition: classandpropertytree.h:45
Nepomuk2::ClassAndPropertyTree::contains
bool contains(const QUrl &uri) const
Returns true if the uri is a Class or a Property.
Definition: classandpropertytree.cpp:522
Nepomuk2::ClassAndPropertyTree::propertyRange
QUrl propertyRange(const QUrl &uri) const
Definition: classandpropertytree.cpp:173
Nepomuk2::ClassAndPropertyTree::~ClassAndPropertyTree
~ClassAndPropertyTree()
Definition: classandpropertytree.cpp:94
Nepomuk2::ClassAndPropertyTree::isChildOf
bool isChildOf(const QUrl &type, const QUrl &superClass) const
Definition: classandpropertytree.cpp:130
Nepomuk2::ClassAndPropertyTree::rebuildTree
void rebuildTree(Soprano::Model *model)
Definition: classandpropertytree.cpp:353
Nepomuk2::ClassAndPropertyTree::allParents
QSet< QUrl > allParents(const QUrl &uri) const
Definition: classandpropertytree.cpp:109
Nepomuk2::ClassAndPropertyTree::variantToNode
Soprano::Node variantToNode(const QVariant &value, const QUrl &property) const
will try very hard to convert a variant into a node. Supports literal XML types and QUrl ...
Definition: classandpropertytree.cpp:202
Nepomuk2::ClassAndPropertyTree::isDefiningProperty
bool isDefiningProperty(const QUrl &uri) const
Definition: classandpropertytree.cpp:193
Nepomuk2::ClassAndPropertyTree::ClassAndPropertyTree
ClassAndPropertyTree(QObject *parent=0)
Definition: classandpropertytree.cpp:86
Nepomuk2::ClassAndPropertyTree::variantListToNodeSet
QSet< Soprano::Node > variantListToNodeSet(const QVariantList &vl, const QUrl &property) const
Definition: classandpropertytree.cpp:211
Nepomuk2::ClassAndPropertyTree::maxCardinality
int maxCardinality(const QUrl &type) const
Definition: classandpropertytree.cpp:155
Nepomuk2::ClassAndPropertyTree::isKnownClass
bool isKnownClass(const QUrl &uri) const
Definition: classandpropertytree.cpp:100
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

KDE's Doxygen guidelines are available online.

Nepomuk-Core

Skip menu "Nepomuk-Core"
  • Main Page
  • Namespace List
  • Namespace Members
  • Alphabetical List
  • Class List
  • Class Hierarchy
  • Class Members
  • File List
  • File Members
  • Modules
  • Related Pages

kdelibs API Reference

Skip menu "kdelibs API Reference"
  • DNSSD
  • Interfaces
  •   KHexEdit
  •   KMediaPlayer
  •   KSpeech
  •   KTextEditor
  • kconf_update
  • KDE3Support
  •   KUnitTest
  • KDECore
  • KDED
  • KDEsu
  • KDEUI
  • KDEWebKit
  • KDocTools
  • KFile
  • KHTML
  • KImgIO
  • KInit
  • kio
  • KIOSlave
  • KJS
  •   KJS-API
  • kjsembed
  •   WTF
  • KNewStuff
  • KParts
  • KPty
  • Kross
  • KUnitConversion
  • KUtils
  • Nepomuk
  • Nepomuk-Core
  • Nepomuk
  • Plasma
  • Solid
  • Sonnet
  • ThreadWeaver

Search



Report problems with this website to our bug tracking system.
Contact the specific authors with questions and comments about the page contents.

KDE® and the K Desktop Environment® logo are registered trademarks of KDE e.V. | Legal