[Mulgara-general] Imports
Andrae Muys
andrae at netymon.com
Tue Sep 18 04:44:14 UTC 2007
On 18/09/2007, at 4:36 AM, Schmitz, Jeffrey A wrote:
> Hello,
> I'm evaluating Mulgara for use with our web application and was
> wondering what the best approach is to mimic the owl:import construct
> would be when using Mulgara since as I understand it, owl:import is
> not
> currently supported. We have a fairly complex model/import structure
> that has to be buildable "on the fly", and we need to be able to do
> this
> programatically using a Java API. From reading the documentation it
> looks like the iTclInterpreterBean interface is the best supported of
> the API options so was planning on using that, and I'm thinking the
> 'import' semantics will have to be implemented in the iTql queries
> using
> the 'from' clause, as opposed to being able to have them inherenent in
> the models themselves using owl:import, right? Or is there some
> better
> way to do this? Also, when using the from/or combination in the iTcls
> queries, does inferencing use all the triples in all referenced models
> to generate the inferenced triples? We use instance/class model
> combinations, as well as bridging axioms across class models, so this
> kind of inferencing across models is important to us.
There are several features of Mulgara that will assist you in doing
this. There are two ways of explicitly handling references to models.
So assuming you have 3 models:
:modelA - which contains the base ontology and references...
:modelB - which contains one extension to the base ontology along
with...
:modelC - which contains a second extension to the base ontology; and
:modelD - which contains the instance data described in terms of the
ontology.
The first exploits mulgara's use of quad-constraints.
select $i $p $o from <:modelD>
where
( $o <owl:import> $m in <:modelA> or $m <mulgara:is> <:modelA> )
and # Note-1
( $c <rdfs:subclassOf> <:myClass> in $m and $p <rdfs:domain> $c in
$m ) and # Note-2
( $i $p
$o )
# Note-3
Note-1: This line queries :modelA to identify all the models that
must be referred to to query the ontology; the use of mulgara:is
explicitly adds :modelA to that list, as it is unlikely :modelA
imports itself.
Note-2: This line is a random schema query for the purposes of
demonstration - you would naturally replace it with your own; however
it is worth noting that if you need the subclassOf to be transitive
we can provide that via the trans() graph-pattern. Also note the use
of 'in $m', which when conjoined with the constraints on the first
line that restrict the $m to models referred to in the ontology will
match the constraint against the models you want.
Note-3: Replace this line with the query you want to perform against
the instance data - as this constraint does not include the fourth
element (ie. 'in ...') it is matched against the from-clause - in
this case <:modelD>
If you know ahead of time which models contain your ontology you can
use the from clause to combine them automatically:
select $i $p $o from <:modelA> or <:modelB> or <:modelC>
where
( $c <rdfs:subclassOf> <:myClass> and $p <rdfs:domain> $c ) and
( $i $p $o in <:modelD> )
If however the instance data is also in multiple models you are left
with less satisfactory options. Either combine your T-box and A-box
and query the merged ontology/instance graphs:
select $i $p $o from <:modelA> or <:modelB> or <:modelC> or <:modelD>
or <:modelE> where ....
or do manual distribution of the model-union over the conjunction: ie.
select $i $p $o from <:modelA> or <:modelB> or <:modelC>
where
( $c <rdfs:sublcassOf> .....) and
( $i $p $o in <:modelD> or $i $p $o in <:modelE> )
an equivalent way of expressing that last line, which may be more
palatable if there are numerous instance models (or if you have to
query for them as well) might be:
($i $p $o in $imodels and ( $imodels <mulgara:is> <:modelD> or
$imodels <mulgara:is> <:modelE> ...imodel-queries... ))
We also support subqueries which will let you run independent queries
using combinations of ontology models (ie. if you want to try the
instance-query using _different_ extensions to the base ontology)
select $ext (select $i $p $o from <:modelD>
where
( $m <mulgara:is> <:modelA> or $m <mulgara:is> $ext )
and
( $c <rdfs:subclassOf> <:myClass> and $p
<rdfs:domain> $c ) and
( $i $p $o in <:modelD> ) )
from <:modelA>
where $o <owl:import> $ext
Of course the various components of those queries can be wrapped up
as a krule rule and run as a batch inference run against the system
at which point you would have a single unified-ontology-model
available to query without the extra query constraints. Paul's work
on the krule inferencing system is extremely impressive - just be
aware that we haven't yet had access to sufficient funding to develop
an incremental inference system. Of course given the efficiency of
Paul's krule engine, the sort of inferencing you are talking about
(ontology merging) is unlikely to be a problem even if you rerun the
inferencing from scratch on each ontology mutation.
Anyway, I hope this helps and if you have any other questions please
feel free to ask.
Andrae
--
Andrae Muys
andrae at netymon.com
Mulgara Consultant
Netymon Pty Ltd
More information about the Mulgara-general
mailing list