DESCRIPTION
You should not directly create instances of this class, but use RDF::Lazy as node factory to create instances of RDF::Lazy::Resource, RDF::Lazy::Literal, and RDF::Lazy::Blank.
$graph->resource( $uri ); # returns a RDF::Lazy::Resource $graph->literal( $string ); # returns a RDF::Lazy::Literal $graph->blank( $id ); # returns a RDF::Lazy::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.a ( [ @types ] )
Shortcut for "type".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
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.trine
Returns the underlying RDF::Trine::Node. DO NOT USE THIS METHOD!qname
Returns a qualified string, if possible, or the empty string.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 ...