FW: cwm bug? xsd namespace

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
4 messages Options
Reply | Threaded
Open this post in threaded view
|

FW: cwm bug? xsd namespace

Booth, David (HP Software - Boston)

Hi Yosi,

I don't know if this is a bug or not, but it sure seems odd, and it puzzled Sean
Palmer too.  Depending on how the xsd namespace is declared, the rule below fires or doesn't fire.

--------------------------------------------

#  File: junk2.n3
#  Test with:
#       cwm junk2.n3 --think --strings
# Gives the following with the right xsd namespace:
#       FIRED base: http://example#aaa ex:p2 bbb
# Gives no output if the example namespace is used.
#
#  Hmm, cwm seems to have special knowledge of the xsd namespace.
# If I declare it like this then the rule below fires,
# but if I declare it with an http://example namespace, it doesn't.
@prefix xsd: <http://www.w3.org/2001/XMLSchema#> .
# @prefix xsd: <http://example/xsd#> .

@prefix ex: <http://example/httpspec#> .
@prefix log: <http://www.w3.org/2000/10/swap/log#>.
@prefix string: <http://www.w3.org/2000/10/swap/string#> .

"http://example#aaa"^^xsd:anyURI ex:p1 <http://example#bbb> .

{       ?u ex:p1 ?reply .
        ("FIRED base: " ?u " ex:p2 "
                ?reply "\n") string:concatenation ?fired .
} =>    {
        ?u ex:p2 ?reply .
        # Debugging:
        "a" log:outputString ?fired .
        } .

--------------------------------------------------


David Booth, Ph.D.
HP Software
+1 617 629 8881 office  |  [hidden email]
http://www.hp.com/go/software

Opinions expressed herein are those of the author and do not represent the official views of HP unless explicitly stated otherwise.

Reply | Threaded
Open this post in threaded view
|

Re: FW: cwm bug? xsd namespace

Yosi Scharf

What you are asking may be a bug. Before we get into that, let us give
another example, to show what cwm was trying to do.

Let us say you wrote a file
=======
@prefix xsd: <http://www.w3.org/2001/XMLSchema#> .
@prefix math: <http://www.w3.org/2000/10/swap/math#> .
{ ( "1"^^xsd:float
    "2"^^xsf:NCNAME ) math:sum ?x} => {?x a :Foo} .
=======

what should it do? Cwm does not know how to add a float and an NCNAME,
indeed, what you gave was not a valid NCNAME. Therefore, the rule should
fail to fire.

Similarly, if you wrote
=======
@prefix xsd: <http://example/xsd#> .
@prefix math: <http://www.w3.org/2000/10/swap/math#> .
{ ( "1"^^xsd:float
    "2"^^xsf:int ) math:sum ?x} => {?x a :Foo} .
====
Then cwm does not know what a http://example/xsd#int is, or how it is
represented in a string, so it cowardly refuses to add it.

In essence --- datatypes cwm does not know it will not run builtins on.

On the other hand, cwm treats a http://www.w3.org/2001/XMLSchema#anyURI
as being close enough to a string that string operations work on it.
Thus the difference.


Yosi




On Thu, 2008-02-14 at 07:54 +0000, Booth, David (HP Software - Boston)
wrote:

> Hi Yosi,
>
> I don't know if this is a bug or not, but it sure seems odd, and it puzzled Sean
> Palmer too.  Depending on how the xsd namespace is declared, the rule below fires or doesn't fire.
>
> --------------------------------------------
>
> #  File: junk2.n3
> #  Test with:
> #       cwm junk2.n3 --think --strings
> # Gives the following with the right xsd namespace:
> #       FIRED base: http://example#aaa ex:p2 bbb
> # Gives no output if the example namespace is used.
> #
> #  Hmm, cwm seems to have special knowledge of the xsd namespace.
> # If I declare it like this then the rule below fires,
> # but if I declare it with an http://example namespace, it doesn't.
> @prefix xsd: <http://www.w3.org/2001/XMLSchema#> .
> # @prefix xsd: <http://example/xsd#> .
>
> @prefix ex: <http://example/httpspec#> .
> @prefix log: <http://www.w3.org/2000/10/swap/log#>.
> @prefix string: <http://www.w3.org/2000/10/swap/string#> .
>
> "http://example#aaa"^^xsd:anyURI ex:p1 <http://example#bbb> .
>
> {       ?u ex:p1 ?reply .
>         ("FIRED base: " ?u " ex:p2 "
>                 ?reply "\n") string:concatenation ?fired .
> } =>    {
>         ?u ex:p2 ?reply .
>         # Debugging:
>         "a" log:outputString ?fired .
>         } .
>
> --------------------------------------------------
>
>
> David Booth, Ph.D.
> HP Software
> +1 617 629 8881 office  |  [hidden email]
> http://www.hp.com/go/software
>
> Opinions expressed herein are those of the author and do not represent the official views of HP unless explicitly stated otherwise.
>


Reply | Threaded
Open this post in threaded view
|

[closed] Re: FW: cwm bug? xsd namespace

Yosi Scharf

I talked to Tim, and he agreed it was a bug. String:concatenate is so
permissive, it should accept unknown datatypes too. It should be fixed
in the latest CVS.


Yosi

Yosi Scharf wrote:

> What you are asking may be a bug. Before we get into that, let us give
> another example, to show what cwm was trying to do.
>
> Let us say you wrote a file
> =======
> @prefix xsd: <http://www.w3.org/2001/XMLSchema#> .
> @prefix math: <http://www.w3.org/2000/10/swap/math#> .
> { ( "1"^^xsd:float
>     "2"^^xsf:NCNAME ) math:sum ?x} => {?x a :Foo} .
> =======
>
> what should it do? Cwm does not know how to add a float and an NCNAME,
> indeed, what you gave was not a valid NCNAME. Therefore, the rule should
> fail to fire.
>
> Similarly, if you wrote
> =======
> @prefix xsd: <http://example/xsd#> .
> @prefix math: <http://www.w3.org/2000/10/swap/math#> .
> { ( "1"^^xsd:float
>     "2"^^xsf:int ) math:sum ?x} => {?x a :Foo} .
> ====
> Then cwm does not know what a http://example/xsd#int is, or how it is
> represented in a string, so it cowardly refuses to add it.
>
> In essence --- datatypes cwm does not know it will not run builtins on.
>
> On the other hand, cwm treats a http://www.w3.org/2001/XMLSchema#anyURI
> as being close enough to a string that string operations work on it.
> Thus the difference.
>
>
> Yosi
>
>
>
>
> On Thu, 2008-02-14 at 07:54 +0000, Booth, David (HP Software - Boston)
> wrote:
>  
>> Hi Yosi,
>>
>> I don't know if this is a bug or not, but it sure seems odd, and it puzzled Sean
>> Palmer too.  Depending on how the xsd namespace is declared, the rule below fires or doesn't fire.
>>
>> --------------------------------------------
>>
>> #  File: junk2.n3
>> #  Test with:
>> #       cwm junk2.n3 --think --strings
>> # Gives the following with the right xsd namespace:
>> #       FIRED base: http://example#aaa ex:p2 bbb
>> # Gives no output if the example namespace is used.
>> #
>> #  Hmm, cwm seems to have special knowledge of the xsd namespace.
>> # If I declare it like this then the rule below fires,
>> # but if I declare it with an http://example namespace, it doesn't.
>> @prefix xsd: <http://www.w3.org/2001/XMLSchema#> .
>> # @prefix xsd: <http://example/xsd#> .
>>
>> @prefix ex: <http://example/httpspec#> .
>> @prefix log: <http://www.w3.org/2000/10/swap/log#>.
>> @prefix string: <http://www.w3.org/2000/10/swap/string#> .
>>
>> "http://example#aaa"^^xsd:anyURI ex:p1 <http://example#bbb> .
>>
>> {       ?u ex:p1 ?reply .
>>         ("FIRED base: " ?u " ex:p2 "
>>                 ?reply "\n") string:concatenation ?fired .
>> } =>    {
>>         ?u ex:p2 ?reply .
>>         # Debugging:
>>         "a" log:outputString ?fired .
>>         } .
>>
>> --------------------------------------------------
>>
>>
>> David Booth, Ph.D.
>> HP Software
>> +1 617 629 8881 office  |  [hidden email]
>> http://www.hp.com/go/software
>>
>> Opinions expressed herein are those of the author and do not represent the official views of HP unless explicitly stated otherwise.
>>
>>    
>
>
>  


Reply | Threaded
Open this post in threaded view
|

RE: [closed] Re: FW: cwm bug? xsd namespace

Booth, David (HP Software - Boston)

Hi Yosi,

Thanks for the explanation.  It was enlightening.


David Booth, Ph.D.
HP Software
+1 617 629 8881 office  |  [hidden email]
http://www.hp.com/go/software

Opinions expressed herein are those of the author and do not represent the official views of HP unless explicitly stated otherwise.


> -----Original Message-----
> From: Yosi Scharf [mailto:[hidden email]]
> Sent: Thursday, February 14, 2008 7:45 PM
> To: Yosi Scharf
> Cc: Booth, David (HP Software - Boston); [hidden email]
> Subject: [closed] Re: FW: cwm bug? xsd namespace
>
> I talked to Tim, and he agreed it was a bug. String:concatenate is so
> permissive, it should accept unknown datatypes too. It should be fixed
> in the latest CVS.
>
>
> Yosi
>
> Yosi Scharf wrote:
> > What you are asking may be a bug. Before we get into that,
> let us give
> > another example, to show what cwm was trying to do.
> >
> > Let us say you wrote a file
> > =======
> > @prefix xsd: <http://www.w3.org/2001/XMLSchema#> .
> > @prefix math: <http://www.w3.org/2000/10/swap/math#> .
> > { ( "1"^^xsd:float
> >     "2"^^xsf:NCNAME ) math:sum ?x} => {?x a :Foo} .
> > =======
> >
> > what should it do? Cwm does not know how to add a float and
> an NCNAME,
> > indeed, what you gave was not a valid NCNAME. Therefore,
> the rule should
> > fail to fire.
> >
> > Similarly, if you wrote
> > =======
> > @prefix xsd: <http://example/xsd#> .
> > @prefix math: <http://www.w3.org/2000/10/swap/math#> .
> > { ( "1"^^xsd:float
> >     "2"^^xsf:int ) math:sum ?x} => {?x a :Foo} .
> > ====
> > Then cwm does not know what a http://example/xsd#int is, or
> how it is
> > represented in a string, so it cowardly refuses to add it.
> >
> > In essence --- datatypes cwm does not know it will not run
> builtins on.
> >
> > On the other hand, cwm treats a
> http://www.w3.org/2001/XMLSchema#anyURI
> > as being close enough to a string that string operations work on it.
> > Thus the difference.
> >
> >
> > Yosi
> >
> >
> >
> >
> > On Thu, 2008-02-14 at 07:54 +0000, Booth, David (HP
> Software - Boston)
> > wrote:
> >
> >> Hi Yosi,
> >>
> >> I don't know if this is a bug or not, but it sure seems
> odd, and it puzzled Sean
> >> Palmer too.  Depending on how the xsd namespace is
> declared, the rule below fires or doesn't fire.
> >>
> >> --------------------------------------------
> >>
> >> #  File: junk2.n3
> >> #  Test with:
> >> #       cwm junk2.n3 --think --strings
> >> # Gives the following with the right xsd namespace:
> >> #       FIRED base: http://example#aaa ex:p2 bbb
> >> # Gives no output if the example namespace is used.
> >> #
> >> #  Hmm, cwm seems to have special knowledge of the xsd namespace.
> >> # If I declare it like this then the rule below fires,
> >> # but if I declare it with an http://example namespace, it doesn't.
> >> @prefix xsd: <http://www.w3.org/2001/XMLSchema#> .
> >> # @prefix xsd: <http://example/xsd#> .
> >>
> >> @prefix ex: <http://example/httpspec#> .
> >> @prefix log: <http://www.w3.org/2000/10/swap/log#>.
> >> @prefix string: <http://www.w3.org/2000/10/swap/string#> .
> >>
> >> "http://example#aaa"^^xsd:anyURI ex:p1 <http://example#bbb> .
> >>
> >> {       ?u ex:p1 ?reply .
> >>         ("FIRED base: " ?u " ex:p2 "
> >>                 ?reply "\n") string:concatenation ?fired .
> >> } =>    {
> >>         ?u ex:p2 ?reply .
> >>         # Debugging:
> >>         "a" log:outputString ?fired .
> >>         } .
> >>
> >> --------------------------------------------------
> >>
> >>
> >> David Booth, Ph.D.
> >> HP Software
> >> +1 617 629 8881 office  |  [hidden email]
> >> http://www.hp.com/go/software
> >>
> >> Opinions expressed herein are those of the author and do
> not represent the official views of HP unless explicitly
> stated otherwise.
> >>
> >>
> >
> >
> >
>
>