KDE 4.2 PyKDE API Reference
  • KDE's Python API
  • Overview
  • PyKDE Home
  • Sitemap
  • Contact Us
 

SparqlModel Class Reference

from PyKDE4.soprano import *

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

Detailed Description

\class SparqlModel sparqlmodel.h Soprano/Client/SparqlModel

Remote client Model for Http SPARQL end points.

The SparqlModel provides a very simple way of accessing remote SPARQL (SPARQL Protocol and RDF Query Language) web services via Http.

Its usage is simple: set hostname and optionally user credentials, then call the well known Model methods like Model.executeQuery to work with the remote repository.

Author:
Rajeev J Sebastian <rajeev.sebastian@gmail.com>
Sebastian Trueg <trueg@kde.org>

Since:
2.2


Methods

 __init__ (self, QString host=QString(), int port=80, QString user=QString(), QString password=QString())
Soprano.Error.ErrorCode addStatement (self, Soprano.Statement statement)
bool containsAnyStatement (self, Soprano.Statement statement)
bool containsStatement (self, Soprano.Statement statement)
Soprano.Node createBlankNode (self)
Soprano.QueryResultIterator executeQuery (self, QString query, Soprano.Query.QueryLanguage language=Query.QueryLanguageSparql, QString userQueryLanguage=QString())
Soprano.Util.AsyncResult executeQueryAsync (self, QString query, Soprano.Query.QueryLanguage language, QString userQueryLanguage=QString())
bool isEmpty (self)
Soprano.NodeIterator listContexts (self)
Soprano.StatementIterator listStatements (self, Soprano.Statement partial)
Soprano.Error.ErrorCode removeAllStatements (self, Soprano.Statement statement)
Soprano.Error.ErrorCode removeStatement (self, Soprano.Statement statement)
 setHost (self, QString host, int port=80)
 setUser (self, QString user, QString password=QString())
int statementCount (self)

Method Documentation

__init__ (  self,
QString  host=QString(),
int  port=80,
QString  user=QString(),
QString  password=QString()
)

Create a new SparqlModel instance.

Parameters:
host  The host to connect to (example: dbpedia.org)

Parameters:
port  The port on which to connect the host (most Http services run on port 80.

Parameters:
user  The userName in case the host does not allow anonymous access.

Parameters:
password  The password for user in case the host does not allow anonymous access.

Soprano.Error.ErrorCode addStatement (  self,
Soprano.Statement  statement
)

Add a statement to the remote model.

This method is realized using the SPARQL/Update language extension. Thus, it will only work on services supporting this extension.

Parameters:
statement  The Statement to add.

Returns:
Error.ErrorNone on success and an error code if statement was invalid or an error occured. Check Error.ErrorCache.lastError for detailed error information.

bool containsAnyStatement (  self,
Soprano.Statement  statement
)
bool containsStatement (  self,
Soprano.Statement  statement
)
Soprano.Node createBlankNode (   self )

Creation of blank nodes is not supported by the SparqlModel.

Returns:
an invalid Node

Soprano.QueryResultIterator executeQuery (  self,
QString  query,
Soprano.Query.QueryLanguage  language=Query.QueryLanguageSparql,
QString  userQueryLanguage=QString()
)

Execute a query on the SPARQL endpoint.

Parameters:
query  The query to evaluate.

Parameters:
language  The query language used to encode query. Be aware that the SparqlModel does only support one query language: Query.QueryLanguageSparql.

Parameters:
userQueryLanguage  unused since language needs to be set to Query.QueryLanguageSparql.

Returns:
An iterator over all results matching the query, on error an invalid iterator is returned.

Soprano.Util.AsyncResult executeQueryAsync (  self,
QString  query,
Soprano.Query.QueryLanguage  language,
QString  userQueryLanguage=QString()
)

Asyncroneously execute the given query over the Model.

Parameters:
query  The query to evaluate.

Parameters:
language  The %query language used to encode query.

Parameters:
userQueryLanguage  If language equals Query.QueryLanguageUser userQueryLanguage defines the language to use.

\sa executeQuery

Returns:
an AsyncResult with result type QueryResultIterator object which will signal when the result is ready.

bool isEmpty (   self )

Not supported by the SparqlModel.

Returns:
false

Soprano.NodeIterator listContexts (   self )
Soprano.StatementIterator listStatements (  self,
Soprano.Statement  partial
)
Soprano.Error.ErrorCode removeAllStatements (  self,
Soprano.Statement  statement
)

Remove all statements that match the partial statement. For removing one specific statement see removeStatement().

This method is realized using the SPARQL/Update language extension. Thus, it will only work on services supporting this extension.

Parameters:
statement  A possible partially defined statement that serves as a filter for all statements that should be removed.

Returns:
Error.ErrorNone on success and an error code if statement was invalid or an error occured. Check Error.ErrorCache.lastError for detailed error information.

Soprano.Error.ErrorCode removeStatement (  self,
Soprano.Statement  statement
)

Removed a statement from the remote model.

This method is realized using the SPARQL/Update language extension. Thus, it will only work on services supporting this extension.

Parameters:
statement  The Statement to remove.

Returns:
Error.ErrorNone on success and an error code if statement was invalid or an error occured. Check Error.ErrorCache.lastError for detailed error information.

setHost (  self,
QString  host,
int  port=80
)

Set the host to connect to.

Parameters:
host  The host to connect to (example: dbpedia.org)

Parameters:
port  The port on which to connect the host (most Http services run on port 80.

setUser (  self,
QString  user,
QString  password=QString()
)

Set the user name and password to access the host.

Parameters:
user  The userName in case the host does not allow anonymous access.

Parameters:
password  The password for user in case the host

int statementCount (   self )

Retrieving the number of statements is not supported by the SparqlModel.

Returns:
-1

  • Full Index

Modules

  • akonadi
  • dnssd
  • kdecore
  • kdeui
  • khtml
  • kio
  • knewstuff
  • kparts
  • kutils
  • nepomuk
  • phonon
  • plasma
  • solid
  • soprano
This documentation is maintained by Simon Edwards.
KDE® and the K Desktop Environment® logo are registered trademarks of KDE e.V. | Legal