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

Ghazzaoui, Ramez (NIH/NLM/LHC) [C] ghazzaouir at mail.nih.gov
Tue Apr 1 18:25:29 UTC 2008


Hi Paul, 

I am sorry for appearing so dense, but I'm still stuck with this issue
from last week. I have made tons of modifications to the data and to the
rule, and still I get an empty entailed model when I load the rule file.


Right now I am down to this advice from you: : 

   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.

I don't know what you mean by "try doing an insert/select that has the
form of the rule. Can you please explain briefly? 

If that leads to no answer, I will have to take you up on your kind
offer to run my rule on sample data and try reproducing the problem. 

Thanks, 

-Ramez 
 

-----Original Message-----
From: Ghazzaoui, Ramez (NIH/NLM/LHC) [C] 
Sent: Friday, March 28, 2008 5:29 PM
To: Mulgara General
Subject: Re: [Mulgara-general] How do I know whether a
Mulgaramodelcontainsany statements?



I think it is not possibility #4 either. I just tested it by duplicating
the rule and I got no improvement. 

-Ramez 
 
 

-----Original Message-----
From: Ghazzaoui, Ramez (NIH/NLM/LHC) [C] 
Sent: Friday, March 28, 2008 4:46 PM
To: Mulgara General
Subject: Re: [Mulgara-general] How do I know whether a Mulgara
modelcontainsany statements?

Thank you for a very complete response, Paul. I am particularly happy to
know of a better way to write the count() query. 


I have verified that it is not possibility #3. What I am doing is: 

    drop <rmi://localhost/server1#krm_nida_sameAs>;
    create <rmi://localhost/server1#krm_nida_sameAs>;
  
    drop <rmi://localhost/server1#nida_1_ent_sameAs>;
    create <rmi://localhost/server1#nida_1_ent_sameAs>;
  
    load <file:/export/home/moradmin/mulgara/rules/krm_nida_sameAs.rdf>
    into <rmi://localhost/server1#krm_nida_sameAs>;
  
    apply <rmi://localhost/server1#krm_nida_sameAs>
    to <rmi://localhost/server1#nida_1>
       <rmi://localhost/server1#nida_1_ent_sameAs>;

So I think is is correct. 


I am also pretty sure that it is not possibility #1 because I verified
that the data contains many pairs of statements that share the exact
same $object string value. Since my rule says this...  

      <Query>
        <selectionVariables>
          <rdf:Seq>
            <rdf:li rdf:resource="#name1"/>
            <rdf:li rdf:resource="#owl_sameAs"/> 
            <rdf:li rdf:resource="#name2"/>
          </rdf:Seq>
        </selectionVariables>
        <hasWhereClause>
          <ConstraintConjunction>

            <argument>
              <SimpleConstraint>
                <hasSubject>
                  <Variable rdf:about="#name1"/>
                </hasSubject>
                <hasPredicate>
                  <URIReference rdf:about="#bp_short_name"/>
                </hasPredicate>
                <hasObject>
                  <Variable rdf:about="#value"/>
                </hasObject>
              </SimpleConstraint>
            </argument>

            <argument>
              <SimpleConstraint>
                <hasSubject>
                  <Variable rdf:about="#name2"/>
                </hasSubject>
                <hasPredicate>
                  <URIReference rdf:about="#bp_short_name"/>
                </hasPredicate>
                <hasObject>
                  <Variable rdf:about="#value"/>
                </hasObject>
              </SimpleConstraint>
            </argument>

          </ConstraintConjunction>
        </hasWhereClause>
      </Query>

(I think you have the full rule somewhere in my earlier emails) 

... then some entailed statements should naturally be generated. 


I will try to rewrite the Krule file by duplicating the rule and having
each copy trigger the other. This would be a good test for possibility
#4 :-) 

-Ramez 


-----Original Message-----
From: Paul Gearon [mailto:gearon at ieee.org] 
Sent: Friday, March 28, 2008 4:31 PM
To: Mulgara General
Subject: Re: [Mulgara-general] How do I know whether a Mulgara
modelcontains any statements?

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 would be 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






More information about the Mulgara-general mailing list