[Mulgara-general] Unable to load a Krule file into Mulgara

Paul Gearon gearon at ieee.org
Tue Mar 25 16:50:41 PDT 2008


OK, I found the other problem.

Once the empty argument is removed, the rule loader complains that it is
missing an "insertion element". This is because your selectionVariables in
the rule has a bad entry.

The middle entry is <rdf:li rdf:resource="owl_sameAs"/>, whereas it should
be <rdf:li rdf:resource="#owl_sameAs"/>. Yes, I know this is something it
would be nice to test for, but this you've accidentally specified two
separate URIs as valid RDF. From the perspective of Mulgara they are
presented as completely unrelated URIs. The only way to find anything
comparable would be to compare every URL in the system to every other URL -
which is infeasible. Instead, what I've done is to put the known elements
into the exception, and the elements that it doesn't find will show up as
nulls. That should provide a hint at least.

As I said last week, you shouldn't have to write RDF/XML. This is exactly
the sort of thing I want to avoid. I promise to get to the logic parser the
moment I can - it just won't be for a while.

Paul

On Tue, Mar 25, 2008 at 6:16 PM, Paul Gearon <gearon at ieee.org> wrote:

> Hi Ramez,
>
> OK, I've found some of the problem. The empty <argument> is definitely
> causing the NullPointerException. Removing it gives me another problem
> (which I'm in the midst of tracking down). I am unable to get another
> NullPointerException without that empty <argument>.  Are you sure you have
> updated the file that you are loading?
>
> I've made the rule loader a little more robust, in that now it will ignore
> empty arguments like this. Once I've found the other issues I'll check it
> into trunk, so it should make the next release.
>
> Right now I'm still getting an exception for a bad Krule structure, which
> I'm still working on. I just wanted to give some feedback on what I've found
> so far.
>
> Paul
>
>
> On Mon, Mar 24, 2008 at 12:33 PM, Ghazzaoui, Ramez (NIH/NLM/LHC) [C] <
> ghazzaouir at mail.nih.gov> wrote:
>
> > Paul,
> >
> > Unfortunately, once again, the error persists.
> >
> > I added <triggers rdf:resource="#same_as"/> just before <hasQuery> in my
> > one and only rule, and I still get the same error. It happens almost
> > instantly as soon as I execute the KruleLoader.
> >
> > Cheers,
> >
> > -Ramez
> >
> > PS: I never thanked you for Mulgara, so here it is: Thank you for making
> > such a useful product available to the community!
> >
> > _______________________________
> > Ramez Ghazzaoui
> > Contractor
> > NIH/NLM/LHC/CgSB/MOR
> > +1 (301) 435-3161
> >
> >
> >
> > -----Original Message-----
> > From: Paul Gearon [mailto:gearon at ieee.org]
> > Sent: Saturday, March 22, 2008 1:14 AM
> > To: Mulgara General
> > Subject: Re: [Mulgara-general] Unable to load a Krule file into Mulgara
> >
> > I think I've found it, though I still need to confirm.  I made the
> > presumption that all rules will trigger at least one other rule, and
> > obviously that isn't the case here.  I think the list of triggers is
> > the empty (null) reference.
> >
> > I may not get to this until Monday, but I should find it relatively
> > quickly.
> >
> > Paul
> >
> >
> > On Mar 21, 2008, at 3:19 PM, Ghazzaoui, Ramez (NIH/NLM/LHC) [C] wrote:
> > > Thank you for pointing out the empty argument at the end of the
> > > constrain conjunction. I removed it and the problem persists. Same
> > > error
> > > message from Java.
> > >
> > > -Ramez
> > >
> > > _______________________________
> > > Ramez Ghazzaoui
> > > Contractor
> > > NIH/NLM/LHC/CgSB/MOR
> > > +1 (301) 435-3161
> > >
> > >
> > >
> > > -----Original Message-----
> > > From: Paul Gearon [mailto:gearon at ieee.org]
> > > Sent: Friday, March 21, 2008 4:14 PM
> > > To: Mulgara General
> > > Subject: Re: [Mulgara-general] Unable to load a Krule file into
> > > Mulgara
> > >
> > > I think it got upset with your empty argument at the end of the
> > > constraint.  Remove that and let me know.
> > >
> > > I've added a new ticket for it:
> > > http://mulgara.org/files/v1.1.1/mulgara-1.1.1-src.tar.gz
> > >
> > > It will be some time before I can get back to it, but we expect to
> > > automatically write these krule files in future, building them from a
> > > more logic-like syntax.  I've already built the parser, but I don't
> > > have time to integrate it at the moment.  When it's finally done,
> > > you'd write your query like this:
> > >
> > > owl:sameAs(name1, name2) :- bp:SHORT-NAME(name1, value),
> > > bp:SHORT-NAME(name2, value).
> > >
> > >
> > > Actually, I already have the OWL rule for that, which looks like:
> > > owl:sameAs(x,y) :- a(x,z), a(y,z), owl:InverseFunctionalProperty(a).
> > >
> > > In which case, you'll get your effect by declaring:
> > > owl:InverseFunctionalProperty(bp:SHORT-NAME).
> > >
> > >
> > > This can all be said in Krule, but the translation is verbose (as I'm
> > > sure you've already seen), which is why I wrote the new logic-style
> > > parser in the first place.
> > >
> > > Paul
> > >
> > > On Fri, Mar 21, 2008 at 12:38 PM, Ghazzaoui, Ramez (NIH/NLM/LHC) [C]
> > > <ghazzaouir at mail.nih.gov> wrote:
> > >> Hi,
> > >>
> > >> I am having trouble loading a rather simple Krule into Mulgara. Below
> > >> are the details about what I am doing and what the error is. I wonder
> > > if
> > >> anyone here knows how to work around this problem.
> > >> Thanks!
> > >> -Ramez
> > >>
> > >>
> > >> I created my model and loaded the triples successfully with this:
> > >> -----------------------------------------------------------------
> > >> create <rmi://localhost/server1#nida_1>;
> > >> load <file:/export/home/moradmin/mulgara/raw_triples/nida_triples.nt>
> > >> into <rmi://localhost/server1#nida_1>;
> > >>
> > >>
> > >> Now I am trying to create an entailed Krule model with these Commands
> > >> (which worked in the past on other models, other rules):
> > >> ---------------------------------------------------------------------
> > >> create <rmi://localhost/server1#krm_nida_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>;
> > >>
> > >>
> > >> I get this error:
> > >> -----------------
> > >>
> > >> 2008-03-21 11:00:04,233 ERROR KruleLoader -
> > >>   Unexpected error during loading: null
> > >> java.lang.NullPointerException
> > >>   at
> > >> org.mulgara.krule.KruleLoader.getConstraints(KruleLoader.java:1003)
> > >>   at
> > >> org.mulgara.krule.KruleLoader.getConstraints(KruleLoader.java:1014)
> > >>   at org.mulgara.krule.KruleLoader.loadJoinConstraints
> > >>       (KruleLoader.java:863)
> > >>   at
> > > org.mulgara.krule.KruleLoader.loadRdfObjects(KruleLoader.java:317)
> > >>   at org.mulgara.krule.KruleLoader.readRules(KruleLoader.java:254)
> > >>   at org.mulgara.resolver.DatabaseSession.buildRules
> > >>       (DatabaseSession.java:508)
> > >>   at org.mulgara.server.rmi.SessionWrapperRemoteSession.buildRules
> > >>       (SessionWrapperRemoteSession.java:461)
> > >>   at sun.reflect.GeneratedMethodAccessor19.invoke(Unknown Source)
> > >>   at sun.reflect.DelegatingMethodAccessorImpl.invoke
> > >>       (DelegatingMethodAccessorImpl.java:25)
> > >>   at java.lang.reflect.Method.invoke(Method.java:585)
> > >>   at
> > >> sun.rmi.server.UnicastServerRef.dispatch(UnicastServerRef.java:294)
> > >>   at sun.rmi.transport.Transport$1.run(Transport.java:153)
> > >>   at java.security.AccessController.doPrivileged(Native Method)
> > >>   at sun.rmi.transport.Transport.serviceCall(Transport.java:149)
> > >>   at sun.rmi.transport.tcp.TCPTransport.handleMessages
> > >>       (TCPTransport.java:460)
> > >>   at sun.rmi.transport.tcp.TCPTransport$ConnectionHandler.run
> > >>       (TCPTransport.java:701)
> > >>   at java.lang.Thread.run(Thread.java:595)
> > >> Syntax error (line 16): org.mulgara.rules.InitializerException:
> > >>    Unexpected error loading rules
> > >>
> > >>
> > >> The Krule file (krm_nida_sameAs.rdf) is as follows:
> > >> ---------------------------------------------------
> > >>
> > >> <?xml version="1.0" encoding="UTF-8"?>
> > >> <!DOCTYPE rdf:RDF [
> > >> <!ENTITY owl     "http://www.w3.org/2002/07/owl#">
> > >> <!ENTITY rdf     "http://www.w3.org/1999/02/22-rdf-syntax-ns#">
> > >> <!ENTITY rdfs    "http://www.w3.org/2000/01/rdf-schema#">
> > >> <!ENTITY xsd     "http://www.w3.org/2001/XMLSchema#">
> > >> <!ENTITY mulgara "http://mulgara.org/mulgara#">
> > >> <!ENTITY krule   "http://mulgara.org/owl/krule/#">
> > >> <!ENTITY bp      "http://www.biopax.org/release/biopax-level2.owl#">
> > >> ]>
> > >>
> > >> <rdf:RDF xmlns:rdf="&rdf;"
> > >>         xmlns:rdfs="&rdfs;"
> > >>         xmlns:owl="&owl;"
> > >>         xmlns:xsd="&xsd;"
> > >>         xmlns="&krule;"
> > >>         xmlns:krule="&krule;"
> > >>         xmlns:bp="&bp;"
> > >>         xml:base="http://mulgara.org/owl/krule/">
> > >>
> > >>  <krule:URIReference rdf:about="#bp_short_name">
> > >>    <rdf:value rdf:resource="bp:SHORT-NAME"/>
> > >>  </krule:URIReference>
> > >>
> > >>  <krule:URIReference rdf:about="#owl_sameAs">
> > >>    <rdf:value rdf:resource="owl:sameAs"/>
> > >>  </krule:URIReference>
> > >>
> > >>  <Variable rdf:about="#name1">
> > >>    <name>name1</name>
> > >>  </Variable>
> > >>
> > >>  <Variable rdf:about="#name2">
> > >>    <name>name2</name>
> > >>  </Variable>
> > >>
> > >>  <Variable rdf:about="#value">
> > >>    <name>value</name>
> > >>  </Variable>
> > >>
> > >>  <!-- * plain sameAs -->
> > >>  <krule:Rule rdf:about="#same_as">
> > >>    <hasQuery>
> > >>      <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>
> > >>
> > >>            <argument>
> > >>            </argument>
> > >>
> > >>          </ConstraintConjunction>
> > >>        </hasWhereClause>
> > >>      </Query>
> > >>    </hasQuery>
> > >>  </krule:Rule>
> > >>
> > >> </rdf:RDF>
> > >>
> > >>
> > >>
> > >> _______________________________________________
> > >> Mulgara-general mailing list
> > >> Mulgara-general at mulgara.org
> > >> http://mulgara.org/mailman/listinfo/mulgara-general
> > >>
> > > _______________________________________________
> > > Mulgara-general mailing list
> > > Mulgara-general at mulgara.org
> > > http://mulgara.org/mailman/listinfo/mulgara-general
> > > _______________________________________________
> > > Mulgara-general mailing list
> > > Mulgara-general at mulgara.org
> > > http://mulgara.org/mailman/listinfo/mulgara-general
> >
> > _______________________________________________
> > Mulgara-general mailing list
> > Mulgara-general at mulgara.org
> > http://mulgara.org/mailman/listinfo/mulgara-general
> > _______________________________________________
> > Mulgara-general mailing list
> > Mulgara-general at mulgara.org
> > http://mulgara.org/mailman/listinfo/mulgara-general
> >
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://mulgara.org/pipermail/mulgara-general/attachments/20080325/72f49b8b/attachment-0001.html 


More information about the Mulgara-general mailing list