KDE 4.2 PyKDE API Reference

- KDE's Python API

# RdfSchemaModel Class Reference

`from PyKDE4.soprano import *`

Inherits: Soprano.FilterModel → Soprano.Model → QObject
Namespace: Soprano

## Detailed Description

\class RdfSchemaModel rdfschemamodel.h Soprano/RdfSchemaModel

Provides convenience methods to handle RDFS data.

Interface based on Sesame's RdfSchemaSource. (Copyright (C) 2002-2006 Aduna BV, GNU LGPL License applies.)

Warning:
  Backward inferencing has not been implemented yet. Thus, methods like subClassOf() return the same as directSubClassOf().

Author:
  Sebastian Trueg <trueg@kde.org>

## Methods

| __init__ (self, Soprano.Model parentModel=0)
Soprano.StatementIterator | classes (self)
Soprano.StatementIterator | directSubClassOf (self, Soprano.Node subClass, Soprano.Node superClass=Soprano.Node())
Soprano.StatementIterator | directSubPropertyOf (self, Soprano.Node subProperty, Soprano.Node superProperty=Soprano.Node())
Soprano.StatementIterator | directType (self, Soprano.Node someClass, Soprano.Node someType)
Soprano.StatementIterator | domain (self, Soprano.Node prop, Soprano.Node domain)
bool | isClass (self, Soprano.Node resource)
bool | isDirectSubClassOf (self, Soprano.Node subClass, Soprano.Node superClass)
bool | isDirectSubPropertyOf (self, Soprano.Node subProperty, Soprano.Node superProperty)
bool | isDirectType (self, Soprano.Node someClass, Soprano.Node someType)
bool | isProperty (self, Soprano.Node resource)
bool | isSubClassOf (self, Soprano.Node subClass, Soprano.Node superClass)
bool | isSubPropertyOf (self, Soprano.Node subProperty, Soprano.Node superProperty)
bool | isType (self, Soprano.Node someClass, Soprano.Node someType)
Soprano.StatementIterator | properties (self)
Soprano.StatementIterator | range (self, Soprano.Node prop, Soprano.Node range)
Soprano.StatementIterator | subClassOf (self, Soprano.Node subClass, Soprano.Node superClass=Soprano.Node())
Soprano.StatementIterator | subPropertyOf (self, Soprano.Node subProperty, Soprano.Node superProperty=Soprano.Node())
Soprano.StatementIterator | type (self, Soprano.Node someClass, Soprano.Node someType)

## Method Documentation

__init__ | ( | self, |
|  | Soprano.Model | parentModel=0
| ) |  |  |

Create a new RDF Schema wrapper model that performs actions on model

Soprano.StatementIterator classes | ( |  | self ) |

Get all defined RDF/S classes.

Returns:
  a StatementIterator that iterates over all statements in the model defining an RDF/S class.

Soprano.StatementIterator directSubClassOf | ( | self, |
|  | Soprano.Node | subClass,
|  | Soprano.Node | superClass=Soprano.Node()
| ) |  |  |

Gets all direct subClassOf relations with a specific sub- and/or superclass. A class A is a direct subclass of class B if there is no class C such that A is a subclass of C and C is a subclass of B.

Parameters:

  | subClass | The subclass of the relations that should be returned, or an empty node if relations with any subclass should be returned.

Parameters:

  | superClass | The superclass of the relations that should be returned, or an empty node if relations with any superclass should be returned.

Returns:
  A StatementIterator containing statements of the form (subClass, rdfs:subClassOf, superClass).

Soprano.StatementIterator directSubPropertyOf | ( | self, |
|  | Soprano.Node | subProperty,
|  | Soprano.Node | superProperty=Soprano.Node()
| ) |  |  |

Gets all direct subPropertyOf relations with a specific sub- and/or superproperty. A property A is a direct subproperty of property B if there is no property C such that A is a subproperty of C and C is a subproperty of B.

Parameters:

  | subProperty | The subproperty of the relations that should be returned, or an empty node if relations with any subproperty should be returned.

Parameters:

  | superProperty | The superproperty of the relations that should be returned, or an empty node if relations with any superproperty should be returned.

Returns:
  A StatementIterator containing statements of the form (subProperty, rdfs:subPropertyOf, superProperty).

Soprano.StatementIterator directType | ( | self, |
|  | Soprano.Node | someClass,
|  | Soprano.Node | someType
| ) |  |  |

Gets all direct type relations with a specific instance and/or class.

Parameters:

  | someClass | The instance of the relations that should be returned, or an empty node if relations with any instance should be returned.

Parameters:

  | someType | The class of the relations that should be returned, or an empty node if relations with any class should be returned.

Returns:
  A StatementIterator containing statements of the form (someClass, rdf:type, someType).

Soprano.StatementIterator domain | ( | self, |
|  | Soprano.Node | prop,
|  | Soprano.Node | domain
| ) |  |  |

Gets all domain relations with a specific property and/or domain class.

Parameters:

  | prop | The property of the relations that should be returned, or an empty node if relations with any property should be returned.

Parameters:

  | domain | The domain of the relations that should be returned, or an empty node if relations with any domain should be returned.

Returns:
  A StatementIterator containing statements of the form (prop, rdfs:domain, domain).

bool isClass | ( | self, |
|  | Soprano.Node | resource
| ) |  |  |

Checks whether the supplied resource represents a class.

Parameters:

  | resource | The resource to check.

Returns:
  true if resource is a class, false otherwise.

bool isDirectSubClassOf | ( | self, |
|  | Soprano.Node | subClass,
|  | Soprano.Node | superClass
| ) |  |  |

Checks whether one resource is a direct subclass of another.

Parameters:

  | subClass | A class.

Parameters:

  | superClass | A class.

Returns:
  true if subClass is a direct subclass of superClass, false otherwise.

bool isDirectSubPropertyOf | ( | self, |
|  | Soprano.Node | subProperty,
|  | Soprano.Node | superProperty
| ) |  |  |

Checks whether one resource is a direct subproperty of another.

Parameters:

  | subProperty | A property.

Parameters:

  | superProperty | A property.

Returns:
  true if subProperty is a direct subproperty of superProperty, false otherwise.

bool isDirectType | ( | self, |
|  | Soprano.Node | someClass,
|  | Soprano.Node | someType
| ) |  |  |

Checks whether one resource is a direct instance of another.

Parameters:

  | someClass | An instance.

Parameters:

  | someType | A class.

Returns:
  true if someClass is a direct instance of someType, false otherwise.

bool isProperty | ( | self, |
|  | Soprano.Node | resource
| ) |  |  |

Checks whether the supplied resource represents a property.

Parameters:

  | resource | The resource to check.

Returns:
  true if resource is a property, false otherwise.

bool isSubClassOf | ( | self, |
|  | Soprano.Node | subClass,
|  | Soprano.Node | superClass
| ) |  |  |

Checks whether one resource is a subclass of another.

Do not use this method if the Soprano backend supports inferencing. Use isDirectSubClassOf instead which is much faster.

Parameters:

  | subClass | A class.

Parameters:

  | superClass | A class.

Returns:
  true if subClass is a subclass of superClass, false otherwise.

bool isSubPropertyOf | ( | self, |
|  | Soprano.Node | subProperty,
|  | Soprano.Node | superProperty
| ) |  |  |

Checks whether one resource is a subproperty of another.

Do not use this method if the Soprano backend supports inferencing. Use isDirectSubPropertyOf instead which is much faster.

Parameters:

  | subProperty | A property.

Parameters:

  | superProperty | A property.

Returns:
  true if subProperty is a subproperty of superProperty, false otherwise.

bool isType | ( | self, |
|  | Soprano.Node | someClass,
|  | Soprano.Node | someType
| ) |  |  |

Checks whether one resource is a instance of another.

Do not use this method if the Soprano backend supports inferencing. Use isDirectType instead which is much faster.

Parameters:

  | someClass | An instance.

Parameters:

  | someType | A class.

Returns:
  true if someClass is an instance of someType, false otherwise.

Soprano.StatementIterator properties | ( |  | self ) |

Gets all defined properties.

Returns:
  A StatementIterator containing statements of the form (someProperty, rdf:type, rdf:Property).

Soprano.StatementIterator range | ( | self, |
|  | Soprano.Node | prop,
|  | Soprano.Node | range
| ) |  |  |

Gets all range relations with a specific property and/or range class.

Parameters:

  | prop | The property of the relations that should be returned, or an empty node if relations with any property should be returned.

Parameters:

  | range | The range of the relations that should be returned, or an empty node if relations with any range should be returned.

Returns:
  A StatementIterator containing statements of the form (prop, rdfs:range, range).

Soprano.StatementIterator subClassOf | ( | self, |
|  | Soprano.Node | subClass,
|  | Soprano.Node | superClass=Soprano.Node()
| ) |  |  |

Gets all subClassOf relations with a specific sub- and/or superclass. Note that the subClassOf relation is reflexive: a class is implicitly always a subclass of itself.

Do not use this method if the Soprano backend supports inferencing. Use directSubClassOf instead which is much faster.

Parameters:

  | subClass | The subclass of the relations that should be returned, or an empty node if relations with any subclass should be returned.

Parameters:

  | superClass | The superclass of the relations that should be returned, or an emtpy node if relations with any superclass should be returned.

Returns:
  A StatementIterator containing all valid statements of the form (subClass, rdfs:subClassOf, superClass) including those calculated through direct inferencing.

Soprano.StatementIterator subPropertyOf | ( | self, |
|  | Soprano.Node | subProperty,
|  | Soprano.Node | superProperty=Soprano.Node()
| ) |  |  |

Gets all subPropertyOf relations with a specific sub- and/or superproperty. Note that the subPropertyOf relation is reflexive: a property is implicitly always a subproperty of itself.

Do not use this method if the Soprano backend supports inferencing. Use directSubPropertyOf instead which is much faster.

Parameters:

  | subProperty | The subproperty of the relations that should be returned, or an empty node if relations with any subproperty should be returned.

Parameters:

  | superProperty | The superproperty of the relations that should be returned, or an empty node if relations with any superproperty should be returned.

Returns:
  A StatementIterator containing all valid statements of the form (subProperty, rdfs:subPropertyOf, superProperty) including those calculated through direct inferencing.

Soprano.StatementIterator type | ( | self, |
|  | Soprano.Node | someClass,
|  | Soprano.Node | someType
| ) |  |  |

Gets all type relations with a specific instance and/or class.

Do not use this method if the Soprano backend supports inferencing. Use directType instead which is much faster.

Parameters:

  | someClass | The instance of the relations that should be returned, or an empty node if relations with any instance should be returned.

Parameters:

  | someType | The class of the relations that should be returned, or an empty node if relations with any class should be returned.

Returns:
  A StatementIterator containing all valid statements of the form (someClass, rdf:type, someType) including those calculated through direct inferencing.