Nepomuk.Types.Entity

KDE 4.2 PyKDE API Reference

- KDE's Python API

# Entity Class Reference

`from PyKDE4.nepomuk import *`

Subclasses: Nepomuk.Class, Nepomuk.Property, Nepomuk.Types.Class, Nepomuk.Types.Ontology, Nepomuk.Types.Property
Namespace: Nepomuk::Types

## Detailed Description

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=KGlobal.locale()->language())
QIcon | icon (self)
bool | isAvailable (self)
bool | isValid (self)
QString | label (self, QString language=KGlobal.locale()->language())
QString | name (self)
bool | operator != (self, Nepomuk.Types.Entity other)
bool | operator == (self, Nepomuk.Types.Entity other)
QUrl | operator QUrl (self)
| reset (self, bool recursive=0)
QUrl | uri (self)

## Method Documentation

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

Default copy constructor.

__init__ | ( |  | self ) |

Create an invalid Entity instance.

QString comment | ( | self, |
|  | QString | language=KGlobal.locale()->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.

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.

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.

Since:
  4.1

bool isAvailable | ( |  | self ) |

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

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=KGlobal.locale()->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.

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.

QString name | ( |  | self ) |

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

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

Compares two Entity instances by simply comparing their URI.

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

Compares two Entity instances by simply comparing their URI.

QUrl operator QUrl | ( |  | self ) |

An Entity can be used as a QUrl automagically.

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