Wraf: API

See the tutorial for an introduction on how to use RDF::Service for creating an RDF application.

Syntax summary

Predicates can be used in the place of request methods. For a property to be used in this way, they have to be declared as the abbrevation of their full URI.

Elements in [] are ORed together and pairs in {} are ANDed together. The special props and => [...] and or => {} changes that behaviour. not => [...] and not => {...} negates the effect of [] and {}.

The method attributes are called criterions, as they decide which resources should be included in the result selection.

Return a selection of all arcs with $node as subj:

$node->arc()

Return a selection of all arcs with $node as subj and $pred as pred:

$node->arc($pred)

Return a selection of all arcs with $node as subj and one of $pred1, pred2 or $pred3 as pred:

$node->arc([$pred1, $pred2, $pred3])

Return a selection of all arcs with $node as subj, $pred as pred and that has a property with the key $x and value $y. All the criterions must be matched. The 'pred' property are used as a short for the RDF:predicate property:

$node->arc({pred => $pred, $x => $y })

The property $x must have the value of *either* $y or $z:

$node->arc({ $x => [ $y, $z ] })

I hope that this is much more pover than actualy needed in practical use. This would be the same as "for each arc that has node as subject, return all arcs for which the following is true; ( ( (P(a)==b) OR ( (P(c)==d) AND (P(e)==f) ) ) AND ( (P(g)==h) ) ):

$node->arc({and=>[[{$a=>$b},{$c=>$d,$e=>$f}],{$g=>$h}]})

Return all arcs that has a property $a those value is a resource that has the property $b with the value $c:

$node->arc({ $a => { $b => $c } })

The same, but create the section as the union of the result from each nodes in the parent selection:

$selection->select_arc(...)

The same, but substitute the subj with the obj:

$selection->select_rev_arc(...)

Return object (and *not* a selection) (matching the criterions) of an arc:

$arc->obj(...)

Return all objects of all arcs that has $node as subj:

$node->arc_obj()

Return all objects that has a reverse arc with $pred as predicate and $node as subj. That is the same as "all the values of the $node property $pred":

$node->arc_obj( $pred )

Same as arc_obj, but substitute obj with subj:

$node->arc_subj( $pred )

Return the only match from a container (or selection), or throw an exception:

$container->li()

Return element 8 (counting from 1) in the container:

$container->li( 8 )

Return the only resource from a container matching the citerions, or throw an exception if there was many matches:

$container->li( ... )

Return a selection of containers (including models and selections) matching the specified criterions and including this $node:

$node->rev_li( ... )

The same as li() but returns a selection instead of a single resource:

$container->select( ... )

Return all objects of the arcs that has $node as subj and XXX as pred, matching the specified criterions. XXX here is any predicate registred as an abbrevation:

$node->XXX( ... )

The same as XXX() but substitute subj with obj:

$node->rev_XXXX( ... )

Most of this is not implemented. See RDF::Service::Context and the tutorial for the currently implemented methods.