RDF::Lazy::Node - A node in a lazy RDF graph
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 )
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.
Returns a string representation of the node's value. Is automatically called on string conversion ("$x" equals $x->str).
"$x"
$x->str
Returns a HTML-escaped string representation. This can safely be used in HTML and XML.
Returns true if the node is a literal, resource, or blank node.
Returns the underlying graph RDF::Lazy that the node belongs to.
Returns some rdf:type of the node (if no types are provided) or checks whether this node is of any of the provided types.
Shortcut for type.
type
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
Returns an RDF/Turtle representation of the node's bounded connections.
Traverse the graph and return the first matching object.
Traverse the graph and return all matching objects.
Traverse the graph and return the first matching subject.
Traverse the graph and return all matching subjects.
Returns the underlying RDF::Trine::Node. DO NOT USE THIS METHOD!
Returns a qualified string, if possible, or the empty string.
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 ...
To install RDF::Lazy, copy and paste the appropriate command in to your terminal.
cpanm
cpanm RDF::Lazy
CPAN shell
perl -MCPAN -e shell install RDF::Lazy
For more information on module installation, please visit the detailed CPAN module installation guide.