RDF::Lazy::Node(3) 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").


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.


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


Returns an RDF/Turtle representation of the node's bounded connections.

rel ( $property [, @filters ] )

Traverse the graph and return the first matching object.


Traverse the graph and return all matching objects.

rev ( $property [, @filters ] )

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->graph->rel( $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