# class NodePattern

###

Module | soprano
Namespace | Soprano::Inference
Class | NodePattern
Inherits |

\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

- NodePattern ( )

  returns ctor

- NodePattern (a0)

  returns ctor

  Argument | Type | Default
  --- | --- | ---
  a0 | Soprano.Node |

- NodePattern (varname)

  returns ctor

  Argument | Type | Default
  --- | --- | ---
  varname | QString |

- NodePattern (a0)

  returns ctor

  Argument | Type | Default
  --- | --- | ---
  a0 | Soprano.Inference.NodePattern |

- createSparqlNodePattern (bindings)

  returns QString

  Argument | Type | Default
  --- | --- | ---
  bindings | Soprano.BindingSet |

- isVariable ( )

  returns bool

- match (node)

  returns bool

  Argument | Type | Default
  --- | --- | ---
  node | Soprano.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.

- resource ( )

  returns Soprano.Node

  \returns the associated resource of an invalid Node if this is a variable.

- variableName ( )

  returns QString

  \returns The name of the variable or an empty string if this is not a variable.