kDB: Knowledge DataBase
Loading...
Searching...
No Matches
knowRDF::Node Class Reference

#include <Node.h>

Public Types

enum class  Type {
  Undefined , Uri , BlankNode , Literal ,
  Variable
}
 

Public Member Functions

Type type () const
 
Literal literal () const
 
knowCore::Uri uri () const
 
BlankNode blankNode () const
 
QString variable () const
 
bool equal (const Node *_otherNode) const
 
QMultiHash< knowCore::Uri, const Node * > children () const
 
QMultiHash< knowCore::Uri, const Node * > parents () const
 
bool belongsToClass (const knowCore::Uri &_class) const
 
bool subClassOf (const knowCore::Uri &_class) const
 
QList< const Node * > parents (const knowCore::Uri &_predicate) const
 
QList< const Node * > children (const knowCore::Uri &_predicate) const
 
bool hasChildren (const knowCore::Uri &_predicate) const
 
bool hasChildren (const knowCore::UriList &_predicates) const
 
const NodegetFirstChild (const knowCore::Uri &_predicate) const
 
QList< const Node * > getCollection (const knowCore::Uri &_predicate) const
 
QList< const Node * > getCollection () const
 
bool isCollection () const
 

Static Public Member Functions

static Triple triple (const Node *_subject, const knowCore::Uri &_predicate, const Node *_object)
 

Friends

class Graph
 

Detailed Description

Represent a subject or an object in the graph.

Member Function Documentation

◆ belongsToClass()

bool Node::belongsToClass ( const knowCore::Uri & _class) const
Returns
true if the node belongs to class _class (i.e. one of the rdf::a child is equal to _class or recursively belongs to the class).

◆ blankNode()

BlankNode Node::blankNode ( ) const
Returns
a blank node if the node is of type Type::BlankNode otherwise it is invalid

◆ children() [1/2]

QMultiHash< knowCore::Uri, const Node * > Node::children ( ) const
Returns
all the children and the associated predicate

◆ children() [2/2]

QList< const Node * > Node::children ( const knowCore::Uri & _predicate) const
Returns
all the children in the graph that are connected with the uri _predicate

◆ equal()

bool Node::equal ( const Node * _otherNode) const
Returns
if this node is equal to the other node

◆ getCollection() [1/2]

QList< const Node * > Node::getCollection ( ) const
Returns
the nodes forming a RDF collection starting from that node

◆ getCollection() [2/2]

QList< const Node * > Node::getCollection ( const knowCore::Uri & _predicate) const
Returns
the nodes forming a RDF collection for the first child pointed by _predicate.

◆ getFirstChild()

const Node * Node::getFirstChild ( const knowCore::Uri & _predicate) const
Returns
the first child in the graph which is connected by uri _predicate.

◆ hasChildren()

bool Node::hasChildren ( const knowCore::Uri & _predicate) const
Returns
true if it has a child of uri _predicate

◆ isCollection()

bool Node::isCollection ( ) const
Returns
if this element is a collection

◆ literal()

Literal Node::literal ( ) const
Returns
a literal if the node is of type Type::Literal otherwise it is invalid

◆ parents() [1/2]

QMultiHash< knowCore::Uri, const Node * > Node::parents ( ) const
Returns
all the parents and the associated predicate

◆ parents() [2/2]

QList< const Node * > Node::parents ( const knowCore::Uri & _predicate) const
Returns
all the parents in the graph that are connected with the uri _predicate

◆ subClassOf()

bool Node::subClassOf ( const knowCore::Uri & _class) const
Returns
true if the node is a subclass of _class (i.e. one of the rdfs::subClassOf child is equal to _class or recursively belongs to the class).

◆ triple()

Triple Node::triple ( const Node * _subject,
const knowCore::Uri & _predicate,
const Node * _object )
static

Function that will create a triple reprsentation from a subject and an object defined as a Node.

◆ type()

Node::Type Node::type ( ) const
Returns
the type of the node

◆ uri()

knowCore::Uri Node::uri ( ) const
Returns
a uri if the node is of type Type::Uri otherwise it is invalid

◆ variable()

QString Node::variable ( ) const
Returns
a variable name if the node is of type Type::Variable otherwise it is invalid

The documentation for this class was generated from the following files: