NAME
RDF::Redland::DIG::KB - DIG extension for Redland RDF (Knowledge Base)
SYNOPSIS
my $model = new RDF::Redland::Model ....
use RDF::Redland::DIG;
my $r = new RDF::Redland::DIG (url => http://localhost:8081/);
use RDF::Redland::DIG::KB;
my $kb = $r->kb; # create an empty knowledge base there
eval {
$kb->tell ($model);
}; die $@ if $@;
my %children = $kb->children ('urn:pizza', 'urn:topping');
my %all_children = $kb->children ();
my %parents = $kb->parents ....
my %descendants = $kb->descendants ...
my @equivs = $kb->equivalents ('urn:pizza');
my @unsatisfiable = $kb->unsatisfiable; # returns all
my %relatedIndividuals = $kb->relatedIndividuals ...
DESCRIPTION
Objects of this class represent knowledge bases in the sense of DIG. Any DIG reasoner can host a number of such knowledge bases.
INTERFACE
Constructor
You will create knowledge bases by using an existing reasoner object (see RDF::Redland::DIG). Alternatively, this constructor clones one knowledge base. The only mandatory parameter is the reasoner.
my $kb = new RDF::Redland::DIG::KB ($r);
You can have any number of knowledge bases for one reasoner.
Methods
- tell
-
This method stores data from the given model in the knowledge base. The only mandatory parameter is an RDF::Redland::Model. The last provided model is the actual model.
- allConceptNames
-
Returns an array that contains all concepts from the knowledge base based on the actual model.
- allRoleNames
-
Returns an array that contains all roles from the knowledge base based on the actual model.
- allIndividuals
-
Returns an array that contains all individuals from the knowledge base based on the actual model.
- unsatisfiable
-
Returns an array that contains all unsatisfied concept-elements from the knowledge base based on the actual model.
- subsumes
-
This method checks whether or not one concept subsumes another. The only mandatory parameter is a hash that contains the main concept as a key and the questioned concepts as an array reference as value. Returns the hash without the concepts that do not subsume the main concept.
- disjoint
-
This method checks whether or not once concept is disjoint with another. The only mandatory parameter is a hash that contains the main concept as a key and the questioned concepts as an array reference as value. Returns the hash without the concepts that are not disjoint with the main concept.
- parents
-
This method returns a hash with concepts as key and their parents as value. You can either provide an array as parameter (if you want the parents from specific concepts) or otherwise all parents from all concepts will be returned.
- children
-
This method returns a hash with concepts as key and their children as value. You can either provide an array as parameter (if you want the children from specific concepts) or otherwise all children from all concepts will be returned.
- descendants
-
This method returns a hash with concepts as key and their descendants as value. You can either provide an array as parameter (if you want the descendants from specific concepts) or otherwise all descendants from all concepts will be returned.
- ancestors
-
This method returns a hash with concepts as key and their ancestors as value. You can either provide an array as parameter (if you want the ancestors from specific concepts) or otherwise all ancestors from all concepts will be returned.
- equivalents
-
This method returns a hash with concepts as key and their equivalents as value. You can either provide an array as parameter (if you want the equivalents from specific concepts) or otherwise all equivalents from all concepts will be returned.
- rparents
-
This method returns a hash with roles as key and their parents as value. You can either provide an array as parameter (if you want the parents from specific roles) or otherwise all parents from all roles will be returned.
- rchildren
-
This method returns a hash with roles as key and their children as value. You can either provide an array as parameter (if you want the children from specific roles) or otherwise all children from all roles will be returned.
- rdescendants
-
This method returns a hash with roles as key and their descendants as value. You can either provide an array as parameter (if you want the descendants from specific roles) or otherwise all descendants from all roles will be returned.
- rancestors
-
This method returns a hash with roles as key and their ancestors as value. You can either provide an array as parameter (if you want the ancestors from specific roles) or otherwise all ancestors from all roles will be returned.
- instances
-
This method returns a hash with concepts as key and their instances as value. You can either provide an array as parameter (if you want the instances from specific concepts) or otherwise all instances from all concepts will be returned.
- types
-
This method returns a hash with individuals as key and their concepts as value. You can either provide an array as parameter (if you want the concepts from specific individuals) or otherwise all concepts from all individuals will be returned.
- instance
-
This method checks whether or not an individual is an instance from a specified concept. The only mandatory parameter is a hash that contains the individual as a key and the questioned concepts as an array reference as value. Returns the hash without the concepts that are not disjoint with the main concept.
- roleFillers
-
This method checks which individuals are asserted to a specified (individual,role)-pair. The mandatory parameters are the name of the main individual and the name of the role. Returns the asserted individuals to this pair as an array.
-
This method returns an array with pairs of individuals that are asserted to a specified role. The only mandatory parameter is the role.
COPYRIGHT AND LICENCE
Copyright 2008 by Lara Spendier and Robert Barta
This library is free software; you can redistribute it and/or modify it under the same terms as Perl itself.
Work supported by the Austrian Research Centers Seibersdorf (Smart Systems).