These are the methods applicable for all resources.

If nothing else is said, the return value is an context object.

Unless otherwise stated, the parameters for the methods are resources. A resource is either given by its uri string or a context object holding the resource.

Some methods initialize the object before it's main action. To initialize the object is to ask all the connected interfaces for relevant statings. There is presently two types of initializations; that of the type statements, and that of the other properties. The keyword known is used to indicate that no initialization is done.

$self referes to the object those method is invoked.


Returns $self->[NODE][NAME]


Returns $self->[NODE][URISTR]


Returns the model

get( $uristr, $ids )

Calls get_context_by_id( $id, $ids

get_context_by_id( $id, $ids )

$ids is optional and should only be used by RDF::Service::Interface::Base::V01/connect.

Gets the node from the cache or creates a new node.

Returns the context.

get_node( $uristr, $ids )

Calls get_node_by_id( $id, $ids )

get_node_by_id( $id, $ids )

$ids is optional and should only be used by RDF::Service::Interface::Base::V01/connect.

Gets the node from the cache or creates a new node.

Returns the node.

get_model( $uristr )

Creates the model if it doesn't already exist.

Returns the model

is_a( $class )

Returns true if $self rdf:type $class. Initialize the types if needed.

could_be_a( $class )

Returns true if $self rdf:type $class or if we currently doesn't know all the types of $self.

is_known_as_a( $class )

Returns true if we know that $self rdf:type $class.

exist_pred( $pred )

Returns true if $self is known to have a $pred property.


Returns a reference to a list of the known types of $self.

The types is orderd by RDF::Service::Interface::Base::V01/level.


Returns a selection of the orderd types.


Same as type, but in the reverse direction.

arc( $point )

Returns a selection of the arcs having $self as subject. If $point is defined, it should be a property, defining which statements to return.

arc_subj( $point )

Returns a selection of the subjects from arcs having $self as object and $point as predicate.


Returns a selection of th predictes from arcs having $self as subject.

arc_obj( $point )

Returns a selection of the objects from arcs having $self as subject and $point as predicate.

arc_obj_list( $point )

Same as arc_obj() but returns a reference to a list.

set( $types, $props )

Calls set_types( $types, 1 ) and set_props( $props, 1).

set_types( $types, $trim, $local_changes )

Sets the types of $self to $types, which is a list of types.

If $trim, existing types for $self, not mentioned in $types will be removed, providing the model is the same.

If $local_changes, the changes will not be forwarded to the interfaces. This parameter is intended for internal use.

set_props( $props, $trim, $local_changes )

The same as set_types(), but for $props.

  $props =
      $pred_uri => [ $obj, ... ],

$obj can be a uri string, context object or a SCALAR REF, in which case it will be takes as a literal.

create_literal( $uristr, $lit_str_ref )

Creates a literal with uri $uristr, or a generated uri, if undef. The content is taken from the scalar ref $lit_str_ref. Returns the lietaral (as a context object).

set_literal( $lit_str_ref )

Changes the value uf the literal $self to the content of $lit_str_ref scalar reference.


Returns a string for debugging purposes, listing the types of $self, and the models that defines them. Example:

  Types for
    m  SOLID 1
    m  SOLID 1
    m  SOLID 1
    m  SOLID 0
    m  SOLID 1


Returns the only resource from a container (for example a selection). Dies if more or less than one items exist in the container.


Returns a reference to the list of resources in the container $self.



Calls the interfaces init_types() and sets TYPE_ALL.


Calls the interfaces init_rev_types() and sets REV_TYPE_ALL.


Calls the interfaces init_rev_subjs and sets REV_SUBJ_ALL.


Calls the interfaces init_rev_objs() and sets REV_OBJ_ALL.

store_types( @args )

Initializes the types and calls the interfaces store_types(). Sets TYPE_ALL to 2 if all goes well.

store_props( @args )

Initialize REV_SUBJ and calls the interfaces store_props(). Sets REV_SUBJ_ALL to 2 if all foes well.


Store $self in the interfaces. Also store all unsaved nodes realted to $self.

declare_del_types( $types )

Delete types from $self.

declare_del_rev_types( $res )

Delete rev_types from $self.

declare_literal( $lit_str_ref, $lit )

Makes a literal out of $lit (uristr or resource or undef) and sets the value to $lit_str_ref.

declare_selection( $content, $selection )

Creates and returns the selection resource $selection with the content $content. The content is a reference to a list of (context) resources.

declare_self( $types, $props)

Calls set_types8 $types, 0, 1 ) and set_props( $props, 0, 1 ).

declare_add_types( $types, $model, $solid )

Adds the $types to $self.

Use WMODEL unless $model.  $model should be a node object.

If $solid is true, do not try to save the added types in the interfaces. (They are infered or temporary.)

Additional types will be infered based on c<RDFS:subClassOf>.

declare_add_dynamic_literal( $pred, $lit_str_ref, $lit_uristr, $arc_uristr, $model )

Add a stating in model $model or WMODEL with $self as subject, $pred as predicate and $lit_uristr as object. The literal is set to $lit_str_ref and the arc is the resource $arc_uristr.

declare_add_prop( $pred, $objm $arc_uristr, $model, $solid )

Calls declare_arc().

declare_arc( $pred, $subj, $obj, $uristr, $model, $solid )

Declare the statement in model $model or WMODEL. If $solid, do not try to stor the arc in the interfaces.


Jonas Liljegren <>


Copyright (C) 2000-2001 Jonas Liljegren. All Rights Reserved.

This module is free software; you can redistribute it and/or modify it under the same terms as Perl itself.


Comments and bug reports should go to


Stefan Andersson <>