Handling RDF and OWL knowledge sources
The increasing use of RDF and OWL as knowledge formalisms for the semantic web make it very attractive to integrate RDF-handling into software agents. Nuin's ability to integrate semantic web data is still in its preliminary stages, but this section of the manual describes what is currently possible.
Nuin KS projection of RDF data sources
In RDF and OWL, the fundamental basis of knowledge representation is the RDF triple.
In terms of the Nuin KS encoding, we view an RDF subject-predicate-object
triple S P O as
the binary predicate P( S, O ). An RDF URI resource is interpreted
as a Nuin KsSymbol, while RDF Literals (i.e. concrete data-typed values)
are treated as the corresponding Nuin KsValue type (KsInt,
KsString etc). In RDF terms, a resource with no URI label (a blank node
or bNode) is treated as an existential variable. Thus, we map RDF bNodes to KsVars,
and vice-versa. To preserve variable names, Nuin defines an annotation-property ks:varName,
a sub-property of rdfs:label to attach a Nuin variable name to a given bNode. Lacking
a pre-defined label, the Nuin projection of a bNode variable is labelled with a UUID var name.
An RDF knowledge source, then, is viewed by Nuin agents as a KsStore, containing a
set of positive binary literals. In general, RDF, as a semi-structured knowledge
represntation, does not distinguish between predicates that relate individuals (for example, "John
isMarriedTo Sue") and predicates that relate the elements of a structured data object (for example
the lines of an address). While this gives an often-useful uniformity to RDF knowledge
structures, it doesn't allow an unambiguous way to store Nuin KsTerm
objects. We solve this by defining a mapping in which a term is encoded as a RDF resource
node (usually labelled with a UUID URI), which has properties attached that represent
the functor of the term (ks:functor) and the arguments (ks:hasArg).
An argument has two further properties: one of either ks:argName or
ks:argIndex, depending on whether this is a positional argument or
a named argument of the term, and one of either ks:valInd or
ks:valLit depending on whether the value of the term is an individual
(i.e. RDF resource) or an RDF literal.
TODO: put an example encoded RDF store in here
There are some restrictions on which Nuin sentence types can be stored in an RDF store:
- The only sentences currently supported are conjunctions of positive binary literals
(i.e. literal in the logic sense - a
Predicatein Nuin terms). This may become more liberal once the OWL integration is further advanced. - The first argument of the predicate, which corresponds to the subject of the
RDF triple, may not be a data literal (e.g.
KsInt) since RDF does not currently permit triple-subjects to be data literals. - Lists are not currently supported, though they will be in future
- RDF reification is not currently supported.
Noting the last point about RDF reification, some explanation is worthwhile to
avoid potential confusion. Nuin has a notion of reification, in which a sentence
is treated as a value whose denotation is the sentence contained in the reified value.
This allows an agent to construct a message (a value), whose :content is
a quoted sentence. A Nuin reification of an RDF predicate is a device for referring
to a given sentence, or embedding it in another data structure. RDF defines
reification as the representation of an RDF triple by four new RDF triples,
one identifying a given resource as an RDF statment, and the other three identifying
the subjec, predicate and object of the triple. This has the effect of both
identifying a statement, so that it can be referenced by other statements
(e.g. "Bob said 'x P y'"), and of lifting the statement out of the
interpretation of the model. This clearly bears some relationship to the Nuin's
notion of reification, but the relationship is not fully explored and requires
deeper investigation.
A particular use of Nuin's reification of RDF statements is to allow services or
other agents to pass to an agent an RDF model as a value. Nuin represents such a
collection of RDF statements (in Jena terms, this is a Model) as
a collection of Nuin-reified RDF statements.
Nuin handling of OWL knowledge sources
Given that Jena allows an OWL ontology to be viewed as an RDF Model, basic OWL handling is equivalent to handling an RDF document. However, we expect in future to have more direct access to the extra semantic capabilities provided by OWL.
Java access to RDF models in Nuin
Preliminary notes, to be expanded. From Nuin 0.3 onwards, the RDF mapping to
Nuin Java classes is in package
org.nuin.ks.store.rdf. The main
utility class RDFWrapperFactory. A singleton instance of this factory
is available with the method getInstance. TODO: should this factory
be integratad with the factory factory?
RDFModelStore
is the class that wraps a
Jena RDF model and presents
a Nuin KsStore interface. An RDFModelStore can be configured via
a constructor that accepts a KsConfiguration object; this allows an existing
document to be loaded into the store, and the appropriate reasoners etc to be
attached to the store using the Jena configuration vocabulary.
« prev: agent services | jena & joseki | next: jade integration »