RDF::Base::Resource
Most things is represented by resources. Resources can have properties. Each property is represented by an arc that connects the resource with another resource or a literal.
RDF::Base::Arcs and RDF::Base::Preds are special resources. RDF::Base::Lists are objects but not resources. are not yet considered nodes.
Inherits from RDF::Base::Node.
These can be called with the class name or any node object.
$n->get( 'new', \%args ) $n->get( $id, \%args ) $n->get( $anything, \%args )
get() is the central method for getting things. It expects node id, but also takes labels and searches. It will call /new and /init. Anything other than id is given to /get_by_anything. Those methods are reimplemented in the subclasses. /new must only take the node id. /get_by_anything must take any form of identification, but expects and returns only ONE node. The coresponding /find_by_anything returns a List.
You should call get() through the right class. If not, it will look up the right class and bless itself into that class, and call thats class /init.
If called with new
and given the arg new_class
, it will look up
the perl package that handles that class, by calling
/instance_class, and blessing into that perl class.
The global variable %RDF::Base::LOOKUP_CLASS_FOR
can be modified
(during startup) for setting which classes it should lookup the class
for. This is initiated to:
RDF::Base::Resource => 1, RDF::Base::User::Meta => 1,
NB! If you call get() from a class other than these, you must make sure that the object will never also be of another class.
For non-cached objects the algoritm is:
1. $node = $class->new( $id ); 2. $node->first_bless;
Supported args are:
initiate_rel class_clue new_class
initiate_rel
initiates all rel arcs BEFORE /first_bless. That's
just for optimization
class_clue
is given as the first argument to /find_class
Returns:
a node object
If called with undef value, returns undef without exception
Exceptions:
See /get_by_anything then called with anything but $id
$n->get_by_node_rec( $rec )
Returns: a node
Exceptions: see /init.
$n->get_by_arc_rec( $rec, $valtype )
If obj is undef; returns is_undef.
($valtype
is not currently used by /first_bless)
Returns: a node
Exceptions: see /init.
$n->get_by_id( $id )
Returns:
Returns a Arc or Resource object
1. $n->find_by_anything( $node, \%args ) 2. $n->find_by_anything( $query, \%args ) 3. $n->find_by_anything( $list ); 4. $n->find_by_anything( $string, {%args, coltype=>$coltype} ); 5. $n->find_by_anything( "$any_name ($props)", \%args ) 6. $n->find_by_anything( "$called ($predname)", \%args ) 7. $n->find_by_anything( "$id: $name", \%args ) 8. $n->find_by_anything( "#$id", \%args ) 9. $n->find_by_anything(); 10. $n->find_by_anything( $label, \%args ); 11. $n->find_by_anything( $name, \%args ); 12. $n->find_by_anything( $id, \%args );
$node
is a node object.
$query
is defined in /find.
A $list
returns itself.
In case 4
, the coltype is given in the arg. It will return objects
of type RDF::Base::Literal. Objects will be returned
unchanged. Strings will be parsed for object creation. Especially
handles valtext
, valfloat
and valdate
.
In case 5
, $any_name
is either name, name_short or code, with
clean
. $props
is a list of criterions of the form "pred value"
spearated by comma, there the value is everything after the first
space and before the next comma or end of string. Example: "Jonas (is
person)".
In case 6
, we can identify a node by the predicate of our choosing.
The node must have a property $predname
with value $called
.
Example: "123 (code)".
Case 7
expects the node id followed by the node designation.
Case 8
is just for givin the node id following a #
.
Case 9
will result in an empty list.
Case 10
finds the node by /get_by_label
Case 11
finds nodes by the given name using clean
. This is the
last resort for anything that doen't looks like a node id number.
Case 12
returns the node by the id given.
Whitespace will be trimmed for all searches of existing nodes (usning Para::Frame::Utils/trim). New Literals will not be trimmed. The caller will have to trime surrounding whitespace, if needed.
Supported args are valtype arclim
Returns:
a list of zero or more node objects
Exceptions:
validation : "$id: $name"
mismatch
See also /find if $query
or $props
is used.
Compatible with RDF::Base::Literal/parse
Returns a RDF::Base::List or RDF::Base::Resource
Compatible with RDF::Base::Literal/parse
uses /parse_to_list and throws exception if more than one node if found.
used by /update_by_query_arc
$n->get_id( $anything )
Shortcut for $n-
get($anything)->id>, but caches the result.
Returns:
a scalar integer
Exceptions:
See /get.
$class->find( $query ) $node->find( $query ) $list->find( $query ) $node->find( $name ) $any->find( $any, \%args )
If called with class, searches all nodes. Uses RDF::Base::Search/modify.
If called with $node or $list, searches only among those nodes. Uses RDF::Base::List/find.
Those two methods differs but we have tried to make them mostly equivalent.
A query is a hash ref with the predicate names as keys and their values as values. The format supported depends on which of the methods above that is used.
If the $query isn't a hash, it will make it into a hash either by {
$query =
$arg2 }> or { name =
$query }>, depending on if a second
arg was passed.
Supported args are
default arclim
Examples:
Find all swedish regional offices of the mother company that begins
with the letter 'a'. The variables $mother_company
and $sweden
could be anything that you can pass to /get, including subqueries,
but especially the actual node objects.
my $nodes = RDF::Base::Resource->find({ is => 'organization', rev_has_member => $mother_company, in_region => $sweden, name_begins => 'a' });
Returns:
a RDF::Base::List object
Exceptions:
See /get, RDF::Base::Search/modify and RDF::Base::List/find.
$class->find_simple( $pred, $value ) $node->find( $pred, $value )
Searches all nodes for those having the ACTIVE property with pred
$pred
and text $value
.
$pred
is any type of predicate reference, like a name, id or
object. $value
is a string.
This uses the field valtext (valclean). No other value types are supported.
The search result is cached.
Examples:
my $nodes = RDF::Base::Resource->find_simple( name => 'Ragnar' );
Returns:
a RDF::Base::List object
Exceptions:
none
$class->find_one( $query ) $class->find_one( $query, \%args ) $node->find_one() $node->find_one( $query, \%args )
Does a /find, but excpect to fins just one.
If more than one match is found, tries one more time to find exact matchas.
If called as a node, thecks that that node matches the query if given.
Supported args are:
arclim
Returns:
a RDF::Base::Resource object
Exceptions:
alternatives : more than one nodes matches the criterions
notfound : no nodes matches the criterions
See also /find_set and /set_one
See also /find.
$n->find_set( $query, \%args )
Finds the nodes matching $query, as would /find_one. But if no
node are found, one is created using the $query
and
default_create
as properties.
Supported args are
default default_create arclim res
Properties specified in defult
is used unless corresponding
properties i $query
is defined. The resulting properties are
passed to /create. default_create
does the same, but only for
create. Not for /find.
Returns:
a node
Exceptions:
alternatives : more than one nodes matches the criterions
See also /find_one and /set_one
$n->set_one( $query ) $n->set_one( $query, \%args )
Just as /find_set, but merges all found nodes to one, if more than one is found.
If a merging occures, one node is selected. All explicit arcs going to and from the other nodes are copied to the selected node and then removed from the other nodes.
Supported args are:
default default_create arclim res
Returns:
a node
Exceptions:
See also /find_set and /find_one
$n->create( $props, \%args )
Creates a node with the specified props.
$props
is a hashref there the keys are the predicate names and the
value is either a node or a array(ref) of nodes or a
List of nodes. And the nodes can be given
as anything that /get will accept.
Specially handled props: label created updated created_by updated_by rev_...
Special args:
activate_new_arcs submit_new_arcs create_node_rec
Returns:
a node
Exceptions:
See /get.
$n->form_url
Returns the URL of the page for viewing/updating this node.
Returns:
A URI object.
Returns a default page for presenting a resource. Defaults to form_url()
$n->plain
Make it a plain value. Returns self...
The plain value turns Undef objects to undef value and Literal objects to literal values. But resource objects returns itself.
$n->id
The unique node id as a plain string.
$n->name(...)
Just an optimization for AUTOLOAD name (using /prop or /list).
$n->is_resource
Returns true.
$n->is_removed
Relevant for RDF::Base::Arc. For other resources, calls /empty.
$n->empty()
Returns true if this node has no properties.
Returns: boolean
$n->created
Returns: RDF::Base::Literal::Time object
$n->updated
Returns: RDF::Base::Literal::Time object
$n->ownde_by
Returns: RDF::Base::Resource object
$n->is_ownde_by
$agent
must be a Resource. It may be a RDF::Base::User.
Returns: true if $agent
is regarded as an owner of the arc
TODO: Handle arcs where subj and obj has diffrent owners
TODO: Handle user that's members of a owner group
See: RDF::Base::Arc::is_owned_by
$n->read_access
Returns: RDF::Base::Resource object
$n->write_access
Returns: RDF::Base::Resource object
$n->created_by
Returns: RDF::Base::Resource object
$n->updated_by
Returns: RDF::Base::Resource object
$n->list
Retuns a ref to a list of all property names. Also availible as /list_preds.
$n->list( $predname )
Returns a RDF::Base::List of all values of the propertis
whith the predicate $predname
.
$n->list( $predname, $value );
Returns true
if $value is not a hash and no more params exist, and
this node has a property with predicate $predname
and value
$value
. This construct, that uses the corresponding feature in
RDF::Base::List/find, enables you to say things like: if(
$item-
is($C_city) )>. Otherwise, returns false.
$n->list( $predname, $proplim );
Returns a RDF::Base::List of all values of the propertis
whith the preicate $predname
, those values has the properties
specified in $proplim
. A find()
is done on the list, using
$proplim
.
$n->list( $predname, $proplim, \%args )
Same, but restrict list to values of $arclim
property arcs.
Supported args are:
arclim arclim2
$arclim
can be any of the strings direct,
explicit,
indirect,
implicit,
inactive and
not_disregarded.
arclim2
if existing, will be used for proplims. Without arclim2
,
arclim
will be used.
Note that list
is a virtual method in Template. Use it via
autoload in TT.
unique_arcs_prio filter is applied BEFORE proplim. That means that we choose among the versions that meets the proplim (and arclim).
$n->list_preds $n->list_preds( $proplim ) $n->list_preds( $proplim, \%args )
The same as /list with no args.
Retuns: a ref to a list of all property names.
$n->revlist $n->revlist( $predname ) $n->revlist( $predname, $proplim ) $n->revlist( $predname, $proplim, \%args )
The same as /list but returns the values of the reverse properties instead.
$n->revlist_preds $n->revlist_preds( $proplim ) $n->revlist_preds( $proplim, \%args )
The same as /revlist with no args.
Retuns: a ref to a list of all reverse property names.
$n->first_prop( $pred_name, $proplim, \%args )
Returns the value of one of the properties with predicate
$pred_name
or undef
if none found.
unique_arcs_prio filter is applied BEFORE proplim. That means that we choose among the versions that meets the proplim (and arclim).
arclim2
, if existing, is used instead of arclim in the proplim
filtering.
$n->first_revprop( $pred_name, $proplim, \%args )
Returns the value of one of the reverse ACTIVE properties with
predicate $pred_name
unique_arcs_prio filter is applied BEFORE proplim. That means that we choose among the versions that meets the proplim (and arclim).
arclim2
, if existing, is used instead of arclim in the proplim
filtering.
$n->has_value({ $pred => $value }, \%args)
Returns true if one of the node properties has a combination of any of the predicates and any of the values. The true value returned is the first arc found that matches.
This only takes one pred/value pair. The pred must be a plain pred name. Not extended by prefixes or suffixes.
For the extended usage, use /meets_proplim.
# Predicate can be a name, object or array. Value can be a list of # values or anything that RDF::Base::List/find takes.
Supported args are
match clean arclim unique_arcs_prio
With a unique_arcs_prio
, we will also look for removal arcs that in
it's previous version had the value. If that arc is prioritized, it will
change the return to false, if there's no other match.
Default match
is eq
. Other supported values are begins
and
like
.
Default clean
is false
. If clean
is true, strings will be
compared in clean mode. (You don't have to clean the $value
by
yourself.)
Default arclim
is active
.
Examples:
See if node $n
has the name or short name 'olle' or a name (or short
name) that is an alias.
# $n->has_value( ['name','name_short'], ['olle', {is => 'alias'}] )
See if node $n
has the name beginning with 'oll' or 'kall'.
# $n->has_beginning( 'name', ['olle', 'kall'] )
Returns:
If true, returns one of the relevant arcs.
If false, returns 0. Not the undef object.
If it's a dynamic property (a method) returns -1, that is true.
If node is a literal and search is true, returns 1
See also /arc_list with pred
and value
params.
TODO: Scalars (i.e strings) with properties not yet supported.
Consider $n->has_value({'some_pred'=>is_undef})
$n->count( $pred, \%args ) $n->count( \%tmpl, \%args ) # not implemented
Counts the number of properties the node has with a specific property,
meeting the arclim. Default arclim is active
.
Supports subclass method implementations. Looks for $n->count_$pred and $n->$pred->size
Examples:
This can be used in RDF::Base::List->find()
by count_pred
pattern. Example from TT; select active (direct) subclasses that has
10 or more instances:
[% nodes = node.revarc_list('scof').direct.subj.find(inactive_ne=1, rev_count_pred_is_gt = 9).as_list %]
$n->revcount( $pred, \%args ) $n->revcount( \%tmpl, \%args ) # not implemented
Counts the number of properties the node has with a specific property,
meeting the arclim. Default arclim is active
.
Examples:
This can be used in RDF::Base::List->find()
by count_pred
pattern. Example from TT; select active (direct) subclasses that has
10 or more instances:
[% nodes = node.revarc_list('scof').direct.subj.find(inactive_ne=1, rev_count_pred_is_gt = 9).as_list %]
$n->label()
The constant label, if there is one for this resource.
Returns:
A plain string or plain undef.
$n->set_label($label)
Sets the constant label. Crates the constant if not existing yet. Set to undef to remove the constant.
Returns:
A plain string or plain undef.
$n->desig( \%args )
The designation of an object, to be used for node administration or debugging.
$n->shortdesig( \%args )
The short designation of an object. Defaults to desig
$n->safedesig( \%args )
As /sysdesig, but only gives data from what is availible in memory.
$n->sysdesig( \%args )
The designation of an object, to be used for node administration or debugging. This version of desig indludes the node id.
$n->syskey
Returns a unique predictable id representing this object
$n->as_excerpt
Returns an excerpt, if existing
$n->excerpt_input
Returns the text to use for generating an excerpt, if existing
$n->arc_list() $n->arc_list( $pred_name ) $n->arc_list( $predname, $value ) $n->arc_list( $predname, \@values ) $n->arc_list( $predname, $proplim ) $n->arc_list( $predname, $proplim, $args )
Returns a RDF::Base::List of the arcs that have $n
as
subj and $pred_name
as predicate.
With no $pred_name
, all arcs from the node is returned.
If given $value
or \@values
, returns those arcs that has any of
the given values. Similar to /has_value but returns a list instad
of a single arc.
unique_arcs_prio filter is applied AFTER proplim. That means that we choose among the versions that meets the proplim (and arclim).
$n->revarc_list() $n->revarc_list( $pred_name ) $n->revarc_list( $predname, $proplim ) $n->revarc_list( $predname, $proplim, $args )
Returns a RDF::Base::List of the arcs that have $n
as
subj and $pred_name
as predicate.
With no $pred_name
, all revarcs from the node is returned.
$n->first_arc( $pred_name, $proplim, \%args )
Returns one of the arcs that have $n
as subj and $pred_anme
as
predicate.
$n->first_revarc( $pred_name, $proplim, \%args )
Returns one of the arcs that have $n
as obj and $pred_anme
as
predicate.
$n->arc( $pred_name, ... )
As /arc_list, but returns the only value, if only one (or zero). Else, it returns an array ref to the list of values.
Use /first_arc or /arc_list explicitly if that's what you want!
$n->revarc( $pred_name, ... )
As /revarc_list, but returns the only value, if only one (or zero). Else, it returns an array ref to the list of values.
Use /first_revarc or revarc_list explicitly if that's what you want!
$node->this_valtype( \%args )
This would be the same as the is
property of this resource. But it
must only have ONE value. It's important for literal values.
This method will return the literal valtype for value resoruces.
It will return the resource
resource if a single class can't be
identified.
See also: RDF::Base::Literal/this_valtype, RDF::Base::Arc/this_valtype, /is_value_node.
$node->mark_updated( $time, $user )
This will update info about the nodes update-time and who did the updating.
Default user is the request user
Default time is now
For not creating a node rec, consider using:
$node->mark_updated if $node->node_rec_exist;
The changes will be saved after the request, or by calling /commit.
Returns: a time obj
TODO: implement args
$n->add({ $pred1 => $value1, $pred2 => $value2, ... }, \%args )
The value may be a list (or Para::Frame::List) of values.
Specially handled props: label created updated rev_...
Supported args are: res read_access write_access arc_weight arc_weight_last
Returns:
The node object
See also RDF::Base::Node/add_arc
$n->update( \%props, \%args )
Updates all properties having the mentioned predicate. It doesn't
touch properties with predicates not mentioned. %props
is a
hash with pairs of predicates and values.
- If the node has a property with the same predicate and value as one of the properties given to update; that arc will be untouchted - If a property is given to update that doesn't exist in the node; an arc will be created - If the node has a property with a predicate, and that predicate exists in a property given to update, and the value for the two properties is not the same; that existing property will be removed and a new arc created.
This algorithm will not touch existing properties if the new property has the same value. This asures that any properties on the arcs will remain.
The most of the job is done by /replace.
Supported args are:
res
Returns:
The updated node. For literals, it may be a new object.
Exceptions:
See /replace
1. $n->equals( $node2, \%args ) 2. $n->equals( { $pred => $val, ... }, \%args ) 3. $n->equals( [ $node2, $node3, $node4, ... ], \%args ) 4. $n->equals( $list_obj, \%args ) 5. $n->equals( $undef_obj, \%args ) 6. $n->equals( $literal_obj, \%args ) 7. $n->equals( $id, \%args ) 8. $n->equals( $name, \%args )
Returns true (1
) if the argument matches the node, and false (0
)
if it does not.
Case 2
search for nodes matching the criterions and returns true if
any of the elements in the list is the node.
For 3
and 4
we also returns true if the node exists in the given list.
Case 5
always returns false. (A resource is never undef.)
For case 7
we compare the id with the node id.
In cases 6
and 8
we searches for nodes that has the given
name
and returns true if one of the elements found matches the
node.
supported args are match
Supported matchtypes are eq ne gt lt begins like
Default matchtype is 'eq'
$n->vacuum( \%args )
Deprecated. Use /vacuum_node and /vacuum_facet instead!
$n->vacuum_node( \%args )
Calls /vacuum_facet_first for all classes and after that, calls /vacuum_facet for all classes, starting with the most general class (Resource).
$n->vacuum_facet( \%args )
Vacuums each arc of the resource
Supported args are:
arclim
Returns: The node
$node1->merge_node($node2, \%args )
Copies all arcs from $node1
to $node2
. And remove the arcs from
$node1
. Copies both arcs and reverse arcs.
Supported args are:
move_literals res arclim
If $move_literals
is true, all properties are copied. If false or
missing, only object properties are copied.
This will destroy any properties of the copied arcs, beyond the basic
properties {subj, pred, value}
.
SEE ALSO Para::Frame::List/merge
TODO:
Move the arcs in order to keep arc metadata.
Returns: $node2
$n->link_paths( \%args, $level )
Create a list of paths leading up to this node. A list of a list of nodes. The list of nodes is the path from the base down to the leaf.
This can be used to generate a path with links to go up in the tree.
Supported args are:
level arclim
$n->arcversions( $pred, $proplim, \%args )
Produces a list of all relevant common-arcs, with lists of their relevant versions, used for chosing version to activate/deactivate.
language (if applicable) arc-list...
$n->arcversions( $pred, $proplim, \%args )
Produces a list of all relevant common-arcs, with lists of their relevant versions, used for chosing version to activate/deactivate.
language (if applicable) arc-list...
$n->restorepoints( \%args )
Returns a list of restore points for the node
$n->select_tooltip_html( \%args )
Returns html that could be used for a tooltip in a list of similar nodes to get more info about the node.
wn = Widget for updating the Node as_html, context_as_html, diff_as_html desig, longdesig, safedesig, sysdesig, syskey, loc wu = Widget for Updating property wuh = Widget for Updating Hidden property wu_select_tree = Widget for Updating property as a Select Yree wu_select = Widget for Updating property ad a Select wul = Widget for Updating Literal wd = Widget for Displaying property display = Display property as plain string wu_jump = link to the form for updating wun_jump = link to the form for updating the node wp_jump = link to the page for presenting wdirc = Widget for Displaying Instance of Range Class wuirc = Widget for Updating Instance of Range Class
Example:
$pred->range->instance_class->wdirc($subj, $pred, $args); $pred->range->instance_class->wuirc($subj, $pred, $args);
$n->wd( $pred, \%args )
Calls /wdirc for the class given by
$pred->range->instance_class
Stands for Widget for Displaying
Returns: a HTML widget for displaying the value
$n->wn( \%args )
Returns: a HTML ajax widget for updating the node
$n->display( $pred, \%args )
This method parallells /wd, but returns a plain string representation, rather than a HTML widget.
Supported args are format rev
Returns: Returns a string for displaying the value
$n->wu( $pred, \%args )
Stands for Widget for Updating
Calls /wuirc for the class given by
$pred->range->instance_class
Supported args are rev format range range_scof ajax from_ajax divid divstyle label tdlabel separator id label_class default_value
args are forwarded to wuirc register_ajax_pagepart
Returns: a HTML widget for updating the value
$n->wuh( $pred, $value, \%args )
Stands for Widget for Updating Hidden
Returns: a HTML hidden field for making a new arc
$node->register_ajax_pagepart( $pred_name, $divid, \%args )
Supported args are:
arclim res depends_on lookup_pred
Returns: html-fragment of javascript-code to register a divid
$node->wu_select_tree( $pred_name, $type, \%args )
Example: $node->wu_select_tree( 'scof', $C_organization )
Display a select for a resource; a new select for its rev_scof and so on until you've chosen one that has no scofs.
A value can be preselected by setting the query param 'arc___'. $rev .'pred_'. $pred_name
.
TODO: Also select the value if it matches exactly a query param
To be used for preds with range_scof.
$node->wu_select( $pred, $type, \%args )
Display a select of everything that is -> $type
args: select_optgroup desig alternatives rev
$n->table_columns()
$n->find_class() $n->find_class( $clue )
Checks if the resource has a property is
to a class that has the
property class_handled_by_perl_module
.
The classes literal_class
, arc
and pred
and Rule
are
handled as special cases in order to avoid bootstrap problems. Of
these, handling of literal_class
is needed in this method.
This tells that the resource object should be blessd into the class
represented by the object pointed to by
class_handled_by_perl_module
. The package name is given by the
nodes code
property.
If no such classes are found, RDF::Base::Resource is used. We make
a special check for RDF::Base::Arc but RDF::Base::Pred uses
class_handled_by_perl_module
.
A Class can only be handled by one perl class. But a resource can have
propertis is
to more than one class. Special perl packages may be
constructed for this, that inherits from all the given classes.
Each node has one single object in the cache. The class of the object are based on the currently active nodes. In order to work on a new, not yet active node, you may have to first get the is-relation activated. (TODO: Fix this)
Returns: A scalar with the package name
$node->first_bless() $node->first_bless( $valtype ) $node->first_bless( undef, $class_clue )
Used by /get
Uses %RDF::Base::LOOKUP_CLASS_FOR
$valtype
is used by /instance_class.
$class_clue
is used by /find_class.
$node->on_class_perl_module_change()
Blesses the childs
$node->rebless( \%args )
Called by RDF::Base::Arc/create_check and RDF::Base::Arc/remove_check for updating the blessing of the resource object.
This checks the class by calling /find_class.
If the class has changed, calls /on_unbless in the old class, reblesses in the new class and then calls /on_bless. This should work also for metaclasses RDF::Base::Metaclass.
For a new is
arc; the rebless is done after the infered arcs are
created and before the calling of /on_arc_add.
For a removed is
arc; the rebless is done after the infered arcs
are removed and before the calling of /on_arc_del.
The new package are required if necessary.
Supported args are clue_find_class
Returns: the resource object
$node->on_unbless( $class_new, \%args )
See /rebless
Reimplement this
See also RDF::Base::Metaclass/on_unbless
Returns: ---
$node->on_bless( $class_old, \%args )
See /rebless
Reimplement this
See also RDF::Base::Metaclass/on_bless
Returns: ---
$node->on_arc_add( $arc, $pred_name, \%args )
Called by RDF::Base::Arc/create_check. This is called after the arc has been created and after other arcs has been created by inference from this arc. It's also called after /rebless.
Only called when arc is activated!
The arc may exist from before, on_arc_add() will also be called for validating that everything that should have been done on adding also has been done, as with a vacuum_node().
Reimplement this.
$pred_name
is given as a shortcut for $arc->pred->name
See also RDF::Base::Metaclass/on_arc_add
Returns: ---
$node->on_revarc_add( $arc, $pred_name, \%args )
Same as /on_arc_add but is called on the obj if existing.
$node->on_arc_del( $arc, $pred_name, \%args )
Called by RDF::Base::Arc/remove_check that is called by
RDF::Base::Arc/remove just after we know that the arc is going to
be removed. This method is called at the end of remove_check
after
the infered arcs has been removed and after /rebless has been
called. This is done while the present arc is
RDF::Base::Arc/disregard. The arc is removed and the caches cleaned
up after this method /on_arc_del returns.
You have to check each arc if it's disregarded or not, while in this method. Other infered arcs may have been removed.
TODO: If it's to much job to check for disregards, we may filter them out beforehand. But in most cases, it will only affect the present arc.
Reimplement this.
$pred_name
is given as a shortcut for $arc->pred->name
See also RDF::Base::Metaclass/on_arc_del
Returns: ---
$node->on_revarc_del( $arc, $pred_name, \%args )
Same as /on_arc_del but is called on the obj if existing.
$node->on_updated()
Called by /commit for each saved node, previously marked by call to /mark_unsaved or /mark_updated.
Reimplement this.
Returns: ---
$node->mark_child_changed()
Returns: ---
$node->on_child_changed()
Returns: ---
Class->new( $id, @args )
The caller must take care of using the cache
$RDF::Base::Cache::Resource{$id}
before calling this constructor!
The @args
are passed to /initiate_cache
RDF::Base::Resource->get_by_anything( $val, \%args )
Same as /find_by_anything, but returns ONE node
If input is undef, will return a RDF::Base::Undef rather than throwing an exception for an empty list.
$class->get_by_label( $label, \%args )
Looks for a label WITH THE SPECIFIED CLASS.
If called fro RDF::Base::Pred it will assume it's a predicate
Supported args are:
nonfatal
$node->reset_cache( $rec, \%args )
This will call /initiate_cache and /init for resetting all cached data that can be re-read from DB or other place
$rec
and %args
will be given to /init
Returns: the node
$node->init( $rec, \%args )
May be implemented in a subclass to initiate class specific data.
Returns the node
$node->initiate_cache( @args )
The @args
differs for diffrent classes. Specially implemented in
RDF::Base::Arc and maby other classes.
Returns the node with all data resetted. It will be reread from the DB.
$node->initiate_node() $node->initiate_node( $rec )
$node->create_rec $node->create_rec( $time, $user )
Created a node record by using /mark_updated. Will select created and updated data from the availible arcs.
If both $time
and $user
is given, sets created and updated to
the given time.
Using current time and user as a fallback.
Returns: $node
$n->has_node_record
Same as /node_rec_exist
Returns: true if node has node record
$node->node_rec_exist
Same as /has_node_record
Returns: True if there exists a node record
Called by RDF::Base/on_done
THIS WILL NOT CALL $RDF::dbix->commit() for you
Returns undef if no values for this prop
Returns undef if no values for this prop (regardless proplim and arclim)
TODO: Use custom DBI fetchrow
Insert data from a rel record into node
Insert data from a rev record into node
Same as get_by_anything, but returns the node id
$node->coltype()
$node
must be a class (used as a range of a predicate).
Literal classes handled by RDF::Base::Literal::Class. All other are
coltype obj
.
returns: the plain string of table column name
See also: RDF::Base::Pred/coltype, RDF::Base::Arc/coltype, RDF::Base::Literal::Class/coltype
TODO: Move this to RDF::Base::Resource::Class
$node->coltype_id()
$node
must be a class (used as a range of a predicate).
Literal classes handled by RDF::Base::Literal::Class. All other are
coltype obj
.
returns: the id of table column
See also: RDF::Base::Pred/coltype, RDF::Base::Arc/coltype, RDF::Base::Literal::Class/coltype
TODO: Move this to RDF::Base::Resource::Class
$node->this_valtype_reset( \%args )
For re-evaluating the valtype of the node.
Returns: -
See also: RDF::Base::Literal/this_valtype_reset
$node->this_coltype()
This is a resource. It has tha obj
coltype.
returns: the plain string of table column name
See also: RDF::Base::Literal/this_coltype
$node->instance_class
Compatible with RDF::Base::Literal::Class/instance_class. This will
return the class in the same manner as /find_class, as given by
class_handled_by_perl_module
and defaults to
RDF::Base::Resource
.
$node->update_valtype( \%args )
Should update all active revarcs with the new valtype
handle_query_newsubjs( $q, $param, \%args )
Return number of changes
RDF::Base, RDF::Base::Arc, RDF::Base::Pred, RDF::Base::List, RDF::Base::Search, RDF::Base::Literal::Time