RDF::Base::Literal
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
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
These can be called with the class name or any List object.
$class->new( \$val, $valtype )
Implement in subclasses!
Identifies the format and makes the apropriate literal object of it.
$this->new_from_db( $value, $valtype)
$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.
$node->reset_cache()
Does nothing here...
Returns value as RDF::Base::List
Returns value as a plain string. The same as the auto-stringification.
Just as /as_list but regards the SCALAR/ARRAY context.
$literal->lit_revarc
Return the arc this literal is a part of.
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
See /RDF::Base::Object/is_literal
$lit->node
$lit->set_arc( $arc )
Bind Literal to arc.
$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
$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.
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 });
$lit->this_valtype()
This is like the is
property for literals. Defaults to
/default_valtype.
See also: RDF::Base::Resource/this_valtype
$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
$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
$this->subj( \%args )
Get existing or planned subj
Supported args are:
arc subj_new
$this->pred( \%args )
Get existing or planned pred
Supported args are:
arc pred_new
$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 )
Returns: the node id
$n->empty()
Returns true if the literal node has no properties.
Returns true if the literal is not coupled to a node.
Returns: boolean
NOTE: May have expected to get the 'value' arc. But we should not pretend to have one...
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
Widget for updating a node
$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.
$n->table_columns()
$class->wdirc( $subj, $pred, \%args ) Widget for Displaying Instance of Range Class
RDF::Base, RDF::Base::Resource::Literal, RDF::Base::Resource, RDF::Base::Arc, RDF::Base::Pred, RDF::Base::Search