NAME

RDF::Base::Literal

DESCRIPTION

Represents a Literal.

A literal can only exist in one arc.

RDF::Base::Literal::String, RDF::Base::Literal::Time and RDF::Base::Undef are Literals.

Inherits from RDF::Base::Object.

The standard XML schema datatypes are described in http://www.w3.org/TR/xmlschema11-2/#built-in-datatypes

Supported args:

  subj_new
  pred_new
  coltype
  valtype

notes

121[122] 123 -name-> [124]"Apa" 125[126] 124 -is_of_language-> sv 127[122] 123 -name-> [124]"Bepa"

"Apa" isa RDF::Base::Literal [124] isa RDF::Base::Resource::Literal

$nlit = $R->get(124); $lit = $nlit->value('active'); $nlit = $lit->node; print $lit->plain; # Bepa

Constructors

These can be called with the class name or any List object.

new

  $class->new( \$val, $valtype )

Implement in subclasses!

Identifies the format and makes the apropriate literal object of it.

new_from_db

  $this->new_from_db( $value, $valtype)

get_by_arc_rec

  $n->get_by_arc_rec( $rec, $valtype )

This will allways re-init the literal object. It will usually be called from the arc holding the literal. The init or reinit of the arc should also reinit the literal. Thus, we will find the literal in the cache, but init with the rec, even if found.

Returns: a literal

Exceptions: see /init.

reset_cache

  $node->reset_cache()

Does nothing here...

parse

as_list

Returns value as RDF::Base::List

as_string

Returns value as a plain string. The same as the auto-stringification.

nodes

Just as /as_list but regards the SCALAR/ARRAY context.

lit_revarc

  $literal->lit_revarc

Return the arc this literal is a part of.

See also: /arc and /revarc

is_true

See /RDF::Base::Object/is_true

Should this theck the truthiness of the plain value?

Returns: 1 if plain value is true in perl boolean context

is_literal

See /RDF::Base::Object/is_literal

node

  $lit->node

set_arc

  $lit->set_arc( $arc )

Bind Literal to arc.

node_set

  $lit->node_set

  $lit->node_set( $node )

Will create a node if not existing

Exceptions: If trying to explicitly set a node on a literal belonging to an arc

Returns: the node

equals

  $literal->equals( $val )

If $val is a scalar, converts it to a RDF::Base::Literal::String object. (Undefs will become a RDF::Base::Undef via RDF::Base::Literal::String.)

Returns true if both are RDF::Base::Literal and has the same RDF::Base::Object/syskey.

syskey is implemented in the subclasses to this class. For example, RDF::Base::Literal::String, RDF::Base::Literal::Time and RDF::Base::Undef.

update

The API is the same as for RDF::Base::Resource/update.

The prop value will update the literal. If the literal is not bound to an arc, it may be updated to any type of literal or resource.

Supported args are teh same as for RDF::Base::Resource/find_by_anything.

Returns:

  The value node created for representing the literal

Example:

  $node->name->update({ is_of_language => $C_swedish });

this_valtype

  $lit->this_valtype()

This is like the is property for literals. Defaults to /default_valtype.

See also: RDF::Base::Resource/this_valtype

this_valtype_reset

  $lit->this_valtype_reset()

For re-evaluating the valtype of the literal. This does nothing, since we needs to keep the given valtype. But the Resource equivalent does a re-evaluation.

Returns: -

See also: RDF::Base::Resource/this_valtype_reset

this_coltype

  $lit->this_coltype()

This gives the coltype of the value of this literal.

returns: the plain string of table column name

See also: RDF::Base::Resource/this_coltype

subj

  $this->subj( \%args )

Get existing or planned subj

Supported args are:

  arc
  subj_new

pred

  $this->pred( \%args )

Get existing or planned pred

Supported args are:

  arc
  pred_new

extract_string

  $class->extract_string( \$val, \%args )

For use in /parse methods.

Supported args are: valtype coltype arclim

Thre $retval will either be a scalar ref of the plain value to parse, or a RDF::Base::Literal object.

Returns: The list ( $retval, $coltype, $valtype, $args )

id

Returns: the node id

find

find_one

find_set

set_one

form_url

page_url_path_slash

empty

  $n->empty()

Returns true if the literal node has no properties.

Returns true if the literal is not coupled to a node.

Returns: boolean

created

updated

owned_by

read_access

write_access

created_by

updated_by

list

list_preds

revlist

revlist_preds

first_prop

first_revprop

has_pred

has_value

arc_weight

count

revcount

label

set_label

arc_list

NOTE: May have expected to get the 'value' arc. But we should not pretend to have one...

revarc_list

first_arc

first_revarc

arc

revarc

add

vacuum_node

This will vaccum the value but NOT the value node.

Implemented in respective subclass.

Returns: The vacuumed literal

This will be automatically called by RDF::Base::Arc/vacuum_facet

Calls /vacuum_facet for all classes

merge_node

link_paths

wu

Widget for updating a node

arcversions

sysdesig

  $n->sysdesig()

The designation of an object, to be used for node administration or debugging. This version of desig indludes the node id, if existing.

table_columns

  $n->table_columns()

default_valtype

wdirc

  $class->wdirc( $subj, $pred, \%args )

  Widget for Displaying Instance of Range Class

update_by_query_arc

on_startup

SEE ALSO

RDF::Base, RDF::Base::Resource::Literal, RDF::Base::Resource, RDF::Base::Arc, RDF::Base::Pred, RDF::Base::Search