NAME
RDF::Lazy::Node - A node in a lazy RDF graph
VERSION
version 0.06
DESCRIPTION
You should not directly create instances of this class, but use RDF::Lazy as node factory to create instances of RDF::Node::Resource, RDF::Node::Literal, and RDF::Node::Blank.
$graph->resource( $uri ); # returns a RDF::Node::Resource
$graph->literal( $string ); # returns a RDF::Node::Literal
$graph->blank( $id ); # returns a RDF::Node::Blank
A lazy node contains a RDF::Trine::Node and a pointer to the RDF::Lazy graph where the node is located in. You can create a RDF::Lazy::Node from a RDF::Trine::Node just like this:
$graph->uri( $trine_node )
DESCRIPTION
This class wraps RDF::Trine::Node and holds a pointer to the graph (RDF::Lazy) which a node belongs to. In detail there are node types RDF::Lazy::Literal, RDF::Lazy::Resource, and RDF::Lazy::Blank.
METHODS
str
Returns a string representation of the node's value. Is automatically called on string conversion ("$x"
equals $x->str
).
esc
Returns a HTML-escaped string representation. This can safely be used in HTML and XML.
is_literal / is_resource / is_blank
Returns true if the node is a literal, resource, or blank node.
graph
Returns the underlying graph RDF::Lazy that the node belongs to.
type ( [ @types ] )
Returns some rdf:type of the node (if no types are provided) or checks whether this node is of any of the provided types.
is ( $check1 [, $check2 ... ] )
Checks whether the node fullfills some matching criteria, for instance
$x->is('') # is_literal
$x->is(':') # is_resource
$x->is('-') # is_blank
$x->is('@') # is_literal and has language tag
$x->is('@en') # is_literal and has language tag 'en' (is_en)
$x->is('@en-') # is_literal and is_en_
$x->is('^') # is_literal and has datatype
$x->is('^^') # is_literal and has datatype
trine
Returns the underlying RDF::Trine::Node. You should better not use this.
turtle / ttl
Returns an RDF/Turtle representation of the node's bounded connections.
rel ( $property [, @filters ] )
Traverse the graph and return the first matching object.
rels
Traverse the graph and return all matching objects.
rev ( $property [, @filters ] )
Traverse the graph and return the first matching subject.
revs
Traverse the graph and return all matching subjects.
TRAVERSING THE GRAPH
Any other method name is used to query objects. The following three statements are equivalent:
$x->rel('foaf:name');
$x->graph->rel( $x, 'foaf_name' );
$x->rel('foaf_name');
$x->foaf_name;
You can also add filters in a XPath-like language (the use of RDF::Lazy in a template is an example of a "RDFPath" language):
$x->dc_title('@en') # literal with language tag @en
$x->dc_title('@en-') # literal with language tag @en or @en-...
$x->dc_title('') # any literal
$x->dc_title('@') # literal with any language tag
$x->dc_title('^') # literal with any datatype
$x->foaf_knows(':') # any resource
...
AUTHOR
Jakob Voß <voss@gbv.de>
COPYRIGHT AND LICENSE
This software is copyright (c) 2011 by Jakob Voß.
This is free software; you can redistribute it and/or modify it under the same terms as the Perl 5 programming language system itself.
1 POD Error
The following errors were encountered while parsing the POD:
- Around line 220:
Non-ASCII character seen before =encoding in 'Voß'. Assuming UTF-8