Soprano.Inference.NodePattern

KDE 4.2 PyKDE API Reference

- KDE's Python API

# NodePattern Class Reference

`from PyKDE4.soprano import *`

Namespace: Soprano::Inference

## Detailed Description

\class NodePattern nodepattern.h Soprano/Inference/NodePattern

Smallest building block of an inference Rule.

There are two types of NodePattern:

- Simple nodes that wrap around an instance or Node
and only match against that particular node.
- Variable nodes that match against every Node and
have a name.

Author:
  Sebastian Trueg <trueg@kde.org>

## Methods
| __init__ (self)
| __init__ (self, Soprano.Node a0)
| __init__ (self, QString varname)
| __init__ (self, Soprano.Inference.NodePattern a0)
QString | createSparqlNodePattern (self, Soprano.BindingSet bindings)
bool | isVariable (self)
bool | match (self, Soprano.Node node)
Soprano.Node | resource (self)
QString | variableName (self)

## Method Documentation

__init__ | ( |  | self ) |

__init__ | ( | self, |
|  | Soprano.Node | a0
| ) |  |  |

__init__ | ( | self, |
|  | QString | varname
| ) |  |  |

__init__ | ( | self, |
|  | Soprano.Inference.NodePattern | a0
| ) |  |  |

QString createSparqlNodePattern | ( | self, |
|  | Soprano.BindingSet | bindings
| ) |  |  |

bool isVariable | ( |  | self ) |

bool match | ( | self, |
|  | Soprano.Node | node
| ) |  |  |

Match a Node against this pattern. Variables will match any Node while specific %node patterns will only match that one particular Node.

Returns:
  true if node mathes this pattern.

Soprano.Node resource | ( |  | self ) |

Returns:
  the associated resource of an invalid Node if this is a variable.

QString variableName | ( |  | self ) |

Returns:
  The name of the variable or an empty string if this is not a variable.