Nepomuk.Types.Class

KDE 4.7 PyKDE API Reference

- KDE's Python API

# Class Class Reference

`from PyKDE4.nepomuk import *`

Inherits: Nepomuk.Types.Entity
Namespace: Nepomuk.Types

## Detailed Description

\class Class class.h Nepomuk/Types/Class

A Class is a resource of type rdf:Class.

Class instances are explicitly shared. Two instances created with the same uri reference the same data.

While Resource objects can be changed Class instances are considered to be static and never changed during their lifetime.

Author:
  Sebastian Trueg <trueg@kde.org>

## Methods
| __init__ (self)
| __init__ (self, QUrl uri)
| __init__ (self, Nepomuk.Types.Class a0)
[Nepomuk.Types.Class] | allParentClasses (self)
[Nepomuk.Types.Class] | allSubClasses (self)
[Nepomuk.Types.Property] | domainOf (self)
Nepomuk.Types.Property | findPropertyByLabel (self, QString label, QString language=QString())
Nepomuk.Types.Property | findPropertyByName (self, QString name)
bool | isParentOf (self, Nepomuk.Types.Class other)
bool | isSubClassOf (self, Nepomuk.Types.Class other)
[Nepomuk.Types.Class] | parentClasses (self)
[Nepomuk.Types.Property] | rangeOf (self)
[Nepomuk.Types.Class] | subClasses (self)

## Method Documentation

__init__ | ( |  | self ) |

Default copy constructor

__init__ | ( | self, |
|  | QUrl | uri
| ) |  |  |

Create the class referred to by uri. The result is either a valid class which could be loaded from the Nepomuk store or a simple class which only contains the uri.

Be aware that the data is only loaded once read.

Subsequent calls result in a simple hash lookup of cached data.

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

Default copy constructor

[Nepomuk.Types.Class] allParentClasses | ( |  | self ) |

Recursively determines all parent classes of this class, not only the direct ones.

Returns:
  A list of parent classes of this class.

\sa parentClasses()

Const version.

Since:
  4.4

[Nepomuk.Types.Class] allSubClasses | ( |  | self ) |

Recursively determines all sub classes of this class, not only the direct ones.

Returns:
  A list of sub classes of this class.

\sa subClasses()

Const version.

Since:
  4.4

[Nepomuk.Types.Property] domainOf | ( |  | self ) |

A Property has a certain domain which is a Class.

Returns:
  A list of all properties that have this Class as a domain.

\sa Property.domain()

Const version.

Since:
  4.4

Nepomuk.Types.Property findPropertyByLabel | ( | self, |
|  | QString | label,
|  | QString | language=QString()
| ) |  |  |

Search for a property in the class by its label.

Parameters:

  | label | The label of the property (i.e. rdfs:label)

Parameters:

  | language | The language in which the label was specified. If empty the default rdfs:label is returned.

Returns:
  the Property object identified by label or an invalid property if it could not be found.

Const version.

Since:
  4.4

Nepomuk.Types.Property findPropertyByName | ( | self, |
|  | QString | name
| ) |  |  |

Search for a property in the class by its name.

Parameters:

  | name | The name of the property.

Returns:
  the Property object identified by name or an invalid property if it could not be found.

Const version.

Since:
  4.4

bool isParentOf | ( | self, |
|  | Nepomuk.Types.Class | other
| ) |  |  |

Check if a class inherits this class. This is a recursive method which does not only check direct child classes.

Returns:
  true if other is derived from this class, false otherwise.

Const version.

Since:
  4.4

bool isSubClassOf | ( | self, |
|  | Nepomuk.Types.Class | other
| ) |  |  |

Check if this class is derived from another class. This is a recursive method which does not only check direct child classes.

Returns:
  true if this class is derived from other, false otherwise.

Const version.

Since:
  4.4

[Nepomuk.Types.Class] parentClasses | ( |  | self ) |

Each class can have multiple parent classes. This method provides a list of all direct parents.

Returns:
  A list of all parent classes of this class. If the list is emppty it means that the class has no direct parents, i.e. it is derived from rdf:Resource.

\sa allParentClasses()

Const version.

Since:
  4.4

[Nepomuk.Types.Property] rangeOf | ( |  | self ) |

A Property has a certain range which is a Class or a Literal.

Returns:
  A list of all properties that have this Class as a range.

\sa Property.range()

Const version.

Since:
  4.4

[Nepomuk.Types.Class] subClasses | ( |  | self ) |

Returns:
  A list of all classes that have this class as a parent. Be aware that this list can never be final since other ontologies that have not been loaded yet may contain classes that are derived from this class.

Const version.

Since:
  4.4