Bug: --flatten Output is Unsuitable for Testing

This is a multibug.

== Bug 1 ==

Passing the following:

    # formulae-03.n3 - Test of forAll

    @prefix : <http://example.org/#> .
    @keywords a .

    @forAll p, r .

    { p father [ father r ] }
       => { p grandfather r } .

Into cwm --flatten gives out phantom existentials:

    @forSome fo:_g0 .
    :existentials  [ owl:oneOf
                      ( "file:[...]/formulae-03.n3#_g_L7C12" ) ];
    :statements  [ owl:oneOf  ( [
       :object  [ :uri "http://example.org/#r" ];
       :predicate  [ :uri "http://example.org/#father" ];
       :subject fo:_g0 ] ...

== Bug 2 ==

The composition of output variables is bizarre. I don't understand why 
you're giving the URI and variable names as strings... can't you just 
return the objects? This makes it unsuitable for testing because, for 
example, the strings for the variables a dependent on both the 
localnames of the variable and (horror!) the base file/directory of the 
tests being run.

== Bug 3 ==

The output is overly verbose. The reification namespace documentation, 
currently held in its odd location at http://www.w3.org/2004/06/rei 
states that:

    A formula is identified by an unordered set of statements, with a
    sets of existentially and universally quantified symbols.

If they're unordered, why're you using owl:oneOf and a list of 
existentials, universals, and even statements? That makes it impossible 
to test against.

Then again the documentation also gives the example:

    [ :forAll  ( [:uri <#x>] [:uri <#y>]);
      :forSome ( [:uri <#a>] [:uri <#b>]);
      :statements ( :s1 :s2 :s3 )

Which makes even less sense. I'd really like this to be fixed because 
I'm using the reify namespace in my test suite for n3proc. For example, 
I convert:

    # formulae-03.n3 - Test of forAll

    @prefix : <http://example.org/#> .
    @keywords a .

    @forAll p, r .

    { p father [ father r ] }
       => { p grandfather r } .

into: [eek! swap.notation3.BadSyntax: Line 4 of 
<file:[...]/formulae-03.nt>: Bad syntax (Can't use ?xxx syntax for 
variable in outermost level: ?var2) at ^ in:
"...69statement1 <http://www.w3.org/2000/10/swap/reify#object> ?^var2 .
_:formula3 <http://www.w3.org/2000/10/swap/reify#stat..."
Fine, I'll convert by hand...]

    @prefix : <http://example.org/#> .
    @prefix log: <http://www.w3.org/2000/10/swap/log#> .
    @prefix r: <http://www.w3.org/2000/10/swap/reify#> .

    [ r:statement
       [ r:subject _:node4;
         r:predicate :father;
         r:object ?var2 ],
       [ r:subject ?var1;
         r:predicate father>;
         r:object _:node4 ] ] =>
    [ r:statement
       [ r:subject ?var1;
         r:predicate :grandfather;
         r:object ?var2 ] ] .

Which I think you have to admit is more sensible. Existentials and 
universals are done in a similar manner: you have r:existential instead 
of r:existentials. Of course, you'll have to allow universals at the 
outermost level then, but I don't see a problem with that. I may even 
file a separate RFE for it. Note how I omit quantification triples for 
variables quantified over the root formula. That's because on the (viz. 
my) --flatten output the resulting variables are quantified over the 
root formula anyway. So your rule at the moment is "always quantify over 
the parent formula", whereas my slightly augmented rule is "always 
quantify over the parent formula, or the current one if no parent exists".


Sean B. Palmer, http://inamidst.com/sbp/

Received on Saturday, 11 December 2004 20:36:35 UTC