KDE 4.7 PyKDE API Reference

- KDE's Python API

# Entity Class Reference

`from PyKDE4.nepomuk import *`

Namespace: Nepomuk.Types

## Detailed Description

Abstract base class for Class and Property;

Base class for static ontology entities Class and Property. It encapsulates the generic labels and comments that both types have.

Due to internal optimizations comparing two Entities is much faster than comparing two QUrl objects.

Author:
  Sebastian Trueg <trueg@kde.org>

## Methods

| __init__ (self, Nepomuk.Types.Entity a0)
| __init__ (self)
QString | comment (self, QString language)
QIcon | icon (self)
bool | isAvailable (self)
bool | isValid (self)
QString | label (self, QString language)
QString | name (self)
bool | operator != (self, Nepomuk.Types.Entity other)
bool | operator != (self, QUrl other)
bool | operator == (self, Nepomuk.Types.Entity other)
bool | operator == (self, QUrl other)
| reset (self, bool recursive=0)
QUrl | uri (self)
bool | userVisible (self)

## Method Documentation

__init__ | ( | self, |
|  | Nepomuk.Types.Entity | a0
| ) |  |  |

Create an invalid Entity instance.

__init__ | ( |  | self ) |

Create an invalid Entity instance.

QString comment | ( | self, |
|  | QString | language
| ) |  |  |

Retrieve the comment of the entity (rdfs:comment)

Parameters:

  | language | The code of the language to use. Defaults to the session language configured in KDE. As of KDE 4.3 only the currently configured language is loaded to save memory.

Returns:
  The comment translated into language or the default fallback comment if no translation is available or an empty string if no comment could be found at all.

Const version

Since:
  4.4

QIcon icon | ( |  | self ) |

Retrieve the icon stored for the entity (nao:hasSymbol)

If no symbol is defined for the entity a null icon will be returned.

Const version.

Since:
  4.4

bool isAvailable | ( |  | self ) |

Is this Entity available locally, i.e. could its properties be loaded from the Nepomuk store.

Const version.

Since:
  4.4

bool isValid | ( |  | self ) |

Is this a valid Entity, i.e. has it a valid URI. A valid Entity does not necessarily have a label and a comment, it does not even have to exist in the Nepomuk store.

\sa isAvailable

QString label | ( | self, |
|  | QString | language
| ) |  |  |

Retrieve the label of the entity (rdfs:label)

Parameters:

  | language | The code of the language to use. Defaults to the session language configured in KDE. As of KDE 4.3 only the currently configured language is loaded to save memory.

Returns:
  The label translated into language or the default fallback label if no translation is available or the name() if no label could be found at all.

Const version

Since:
  4.4

QString name | ( |  | self ) |

The name of the resource. The name equals the fragment of the URI.

bool operator != | ( | self, |
|  | Nepomuk.Types.Entity | other
| ) |  |  |

Compares the Entity with a URI.

Since:
  4.5

bool operator != | ( | self, |
|  | QUrl | other
| ) |  |  |

Compares the Entity with a URI.

Since:
  4.5

bool operator == | ( | self, |
|  | Nepomuk.Types.Entity | other
| ) |  |  |

Compares the Entity with a URI.

Since:
  4.5

bool operator == | ( | self, |
|  | QUrl | other
| ) |  |  |

Compares the Entity with a URI.

Since:
  4.5

reset | ( | self, |
|  | bool | recursive=0
| ) |  |  |

The Types classes are optimized for performance under the aasumption that ontologies never change during the execution time of an application.

Since there might be situations where this does not apply the internal cache can be reset via this method.

Parameters:

  | recursive | If true all related entities will be reset as well.

Since:
  4.1

QUrl uri | ( |  | self ) |

The URI of the resource

bool userVisible | ( |  | self ) |

nao:userVisible can be used to hide certain properties and resources of a certain type from the user.

Returns:
  true if this entity should be visible to the user.

Since:
  4.6