[Attempto] algebraic expressions in ACE - continued

Jean-Marc Vanel jeanmarc.vanel at gmail.com
Mon Jun 14 17:33:58 CEST 2010


Le 11 juin 2010 07:36, Kaarel Kaljurand <kaljurand at gmail.com> a écrit :
> Hi Jean-Marc,
>
> 2010/6/10 Jean-Marc Vanel <jeanmarc.vanel at gmail.com>:
>>
>> After the acceleration formula, I tried a simpler example, with two
>> variants, and with ACE mainly, but with no more success in the way of
>> obtaining an OWL-RDF output.
>>
>> If a rectangle R has a length L1
>>
>> and R has a length L2
>>
>> then R has-surface ( L1 * L2 ) .
>>
>> The OWL Functional-Style Syntax gives:
>>
>> Ontology(
>>    http://attempto.ifi.uzh.ch/ontologies/owlswrl/test
>>    Implies(
>>       Antecedent(
>>          description(
>>             Class(:rectangle)
>>             I-variable(1)
>>          )
>>          description(
>>             Class(:length)
>>             I-variable(2)
>>          )
>>          description(
>>             ObjectProperty(:have)
>>             I-variable(1)
>>             I-variable(2)
>>          )
>>          description(
>>             Class(:length)
>>             I-variable(4)
>>          )
>>          description(
>>             ObjectProperty(:have)
>>             I-variable(1)
>>             I-variable(4)
>>          )
>>       )
>>       Consequent(
>>          description(
>>             DataProperty(:has-surface)
>>             I-variable(1)
>>             expr(
>>                *
>>                $VAR(
>>                   2
>>                )
>>                $VAR(
>>                   4
>>                )
>>             )
>>          )
>>       )
>>    )
>> )
>>
>> I also tried this variant with equality instead of the verb to be :
>>
>> If a rectangle R has a length L1
>>
>> and R has a length L2
>>
>> then R has-surface S, and S = ( L1 * L2 ) .
>>
>> The consequent side is different:
>>
>>       Consequent(
>>          description(
>>             Class(owl:Thing)
>>             I-variable(6)
>>          )
>>          description(
>>             ObjectProperty(:has-surface)
>>             I-variable(1)
>>             I-variable(6)
>>          )
>>          builtIn(multiply, I-variable($VAR(6)), $VAR(2), $VAR(4))
>>       )
>>
>> Comments:
>>
>> DataProperty is apropriate in first variant,
>> builtIn(multiply  seems apropriate in second variant;
>> the paraphrase is incorrect in case 2 (then missing) :
>>
>> If a n:rectangle X1 has a n:length X2 and the n:rectangle X1 has a n:length
>> X3 and X4 = ( X2 * X3 ) and the n:rectangle X1 v:has-surface X4.
>>
>> Hopefully these tests could allow the experts to correct easily the issues.
>
> Thanks for the testcases.
> They indeed point out some issues that need to be fixed, namely:
>
> * wrong (and even syntactically incorrect) paraphrase
> * choice between object and data properties
> * representation of variables (the '$VAR'/1 should not occur in the output)
> * both of your sentences should maybe get an identical representation in SWRL
>
> Added to the TODO list...

Thanks Kaarel

I attacked point 3 above, with this sentence; the output for OWL/RDF
is currently empty.

If a n:rectangle R has a n:length L1 and R has a n:length L2 then R
v:has-surface S, and S = ( L1 * L2 ) .

( I might choose a simpler one without implication ).

I discovered further problems.
In fact the processing of expressions in the transform
utils/owlswrl/owlfss_owlrdfxml.pl
was not implemented . So I added this clause:

description_atom(
       builtIn( Op, X1, X2, X3),
       element( SWRL_OP, [], [ X1, X2, X3 ] ),
       AboutList
) :-
       concat_atom(['swrlb:',  Op], SWRL_OP ),
       argument_rdf( X1, _RdfArgument1, AboutList1),
       argument_rdf( X2, _RdfArgument2, AboutList2),
       argument_rdf( X3, _RdfArgument3, AboutList3),
       append( [AboutList1, AboutList2, AboutList3], AboutList).

But this is not enough, nowI see that in this clause :

condition_atom(formula(X1, Op, X2)-_, RefList, Atom) :-
       get_argument(X1, RefList, _, OutX1),
       get_argument(X2, RefList, _, OutX2),
       op_builtin(Op, [OutX1, OutX2], Atom).

when Op is '=' , X1 is an implication variable, and X2 an expression,
X2 should be processed recursively to replace $VAR(1) terms with
I-Variable() .
terms.

And I'll probably discover other missing things as well.
The code is well written and commented, but it is difficult to work
without a repository access , or a roadmap, and / or a list of what is
implemented or not. Most serious open source projects have that.
And I confess that I'm not a seasoned Prolog developper...


>
> --
> kaarel
>



--
Jean-Marc Vanel
Consulting, services, training,
Rule-based programming, Semantic Web
http://jmvanel.free.fr/
+33 (0)6 89 16 29 52 -- +33 (0)1 39 55 58 16
( we rarely listen to voice messages, please send a mail instead )



-- 
Jean-Marc Vanel
Consulting, services, training,
Rule-based programming, Semantic Web
http://jmvanel.free.fr/
+33 (0)6 89 16 29 52 -- +33 (0)1 39 55 58 16
( we rarely listen to voice messages, please send a mail instead )


More information about the attempto mailing list