[Mulgara-general] How do I know whether a Mulgara model contains any statements?

Paul Gearon gearon at ieee.org
Fri Mar 28 20:30:35 UTC 2008


Hi Ramez,

>From the looks of it, your entailed model is indeed empty.  The
select/count query you are using returns nothing from the WHERE
clause, and so it never gets to send results to the count, which is
why there are no results returned instead of 0 (this is a peculiarity
of subqueries).  A trick here would be to select from the system
model, and then count on different variables in the count.  The
resulting query might look like this:

select count(
      select $x $y $z
      from <rmi://localhost/server1#nida_1_ent_sameAs>
      where $x $y $z
    )
    from <rmi://localhost/server1#>
    where $a $b $c;

However, this is just going to give you a 0 instead of the "No results
returned" that you are getting.

So the question moves on to why you are not getting anything inserted
into your entailed graph.  There are 4 things I can think of:
1. The rule is subtly wrong.
2. The data is subtly wrong (eg. you could have owl;sameAs instead of
owl:sameAs)
3. The "apply" command is not being called with the entailed graph as
the output parameter
4. The rule system expects some interconnectedness of rules, and I
failed to consider the case of a single rule.

I hope it's not 4, since that's a bug.  :-)

This first thing I'd look for is 3.  The command you run should have the form:

apply <rmi://localhost/server1#rule> to <rmi://localhost/server1#data>
<rmi://localhost/server1#nida_1_ent_sameAs>;

If you miss that third graph, then it all gets inserted into the
source graph <rmi://localhost/server1#data>.  Actually, this runs
slightly more efficiently than having a separate entailed graph, but I
don't know if there's a perceptible difference.

To check if the data is correct, try doing an insert/select that has
the form of the rule (ask me if you're not sure what I mean by that).
Then you can check to see if any data goes into the target graph.  If
not, then the data isn't what you thought it was.  Finally, check the
syntax of the rules VERY carefully.  If it really looks like it's
correct, then I'll try running your rules against some simple data
here and try to reproduce the bug.

Paul

On Fri, Mar 28, 2008 at 12:18 PM, Ghazzaoui, Ramez (NIH/NLM/LHC) [C]
<ghazzaouir at mail.nih.gov> wrote:
>
>
>
>
> Hi again,
>
>
>
> Is there a way, other than through an iTQL query, to peek into a Mulgara model and see its contents?  Maybe by browsing the server1 directory?
>
>
>
> Here's why I need that:
>
>
>
> I have a base Mulgara model with ~1.1 million statements. I also created a Krule and (with help from Paul) loaded it into its own model and applied it to my base model of ~1.1 million triples to create a separate entailed model. All three models (base model, Krule model and resulting entailed model) can be seen with a properly written "SELECT $model from <server1>" query.
>
>
>
> When I run a basic "count all statements" query on the base model:
>
>
>
>     select count(
>
>       select $x $y $z
>
>       from <rmi://localhost/server1#nida_1>
>
>       where $x $y $z
>
>     )
>
>     from <rmi://localhost/server1#nida_1>
>
>     where $x $y $z;
>
>
>
> I get a good count:
>
>
>
>     [ "1148496.0"^^<http://www.w3.org/2001/XMLSchema#double> ]
>
>     1 rows returned.
>
>
>
> But when I run the same "count all statements" on the entailed model:
>
>
>
>     select count(
>
>       select $x $y $z
>
>       from <rmi://localhost/server1#nida_1_ent_sameAs>
>
>       where $x $y $z
>
>     )
>
>     from <rmi://localhost/server1#nida_1_ent_sameAs>
>
>     where $x $y $z;
>
>
>
> I get  "No results returned"  instead of an actual count.
>
>
>
> Even  [ "0.0"^^<http://www.w3.org/2001/XMLSchema#double> ]  would be okay with me, indicating that my Krule did not produce any statements, but this "No results returned" seems strange.
>
>
>
> When I run the following:
>
>
>
>       select $x $y $z
>
>       from <rmi://localhost/server1#nida_1_ent_sameAs>
>
>       where $x $y $z
>
>
>
> I also get "No results returned" which would be fine IF the model is indeed empty, but I need to make sure that this entailed model is in fact empty before re-examining my Krule to see why it produced no new statements.
>
>
>
> For this reason, I am looking for other ways to look into the entailed model.
>
>
>
> Cheers,
>
>
>
> -Ramez
>
>
>
>
>
> _______________________________
>
> Ramez Ghazzaoui
>
> Contractor
>
> NIH/NLM/LHC/CgSB/MOR
>
> +1 (301) 435-3161
>
>
>
>
>
>
> _______________________________________________
> Mulgara-general mailing list
> Mulgara-general at mulgara.org
> http://mulgara.org/mailman/listinfo/mulgara-general
>
>



More information about the Mulgara-general mailing list