You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@stanbol.apache.org by David Riccitelli <da...@insideout.io> on 2012/07/22 19:40:01 UTC

issue with http://www.w3.org/2001/XMLSchema#double NaN

Hello,

I recently ran into an issue [1]. It seems that sometimes values in
resources declared as double, are eventually not numbers and
the Resource2ValueAdapter [3] throws an exception:

"A value is being adapted [mapped-class :: class java.lang.Double][literal
:: NAN][literal data-type :: <http://www.w3.org/2001/XMLSchema#double>]."

Shall we make the *Resource2ValueAdapter* check whether the literal value
can actually be converted to the destination data-type?


[1] Error 500 Enhancement Chain failed because of required Engine
'dbpediaLinking' failed with Message: Unable to process ContentItem
'&lt;urn:content-item-sha1-c153a98f2f30dd79232ba6af3f71f30e4e6a0093&gt;'
with Enhancement Engine 'dbpediaLinking' because the engine was unable to
process the content (Engine class:
org.apache.stanbol.enhancer.engines.entitytagging.impl.NamedEntityTaggingEngine)(Reason:
For input string: "NAN")!
[2] org.apache.stanbol.entityhub.model.clerezza.impl.Resource2ValueAdapter

BR,
David

-- 
David Riccitelli

********************************************************************************
InsideOut10 s.r.l.
P.IVA: IT-11381771002
Fax: +39 0110708239
---
LinkedIn: http://it.linkedin.com/in/riccitelli
Twitter: ziodave
---
Layar Partner Network<http://www.layar.com/publishing/developers/list/?page=1&country=&city=&keyword=insideout10&lpn=1>
********************************************************************************

Re: [STANBOL-698] Re: issue with http://www.w3.org/2001/XMLSchema#double NaN

Posted by David Riccitelli <da...@insideout.io>.
Hello Rupert,

Find attached the exception.

I can see that float values are not currently supported
by Resource2ValueAdapter, and it returns their Lexical Form for those
values.

Therefore we could do the same when a NumberFormatException is raised.

BR,
David

On Sun, Jul 22, 2012 at 8:58 PM, Rupert Westenthaler <
rupert.westenthaler@gmail.com> wrote:

> Hi David,
>
> can you provide some actual examples (stack traces, Entities that
> trigger this ...)
>
> >> "A value is being adapted [mapped-class :: class
> java.lang.Double][literal
> >> :: NAN][literal data-type :: <http://www.w3.org/2001/XMLSchema#double
> >]."
>
> I think the Execption originates from the Clerezza LiteralFactory. It
> might be caused by Double#valueOf(String value) [1] only supporting
> "NaN". So the value "NAN" will cause a NumberFormatException. But also
> for the xsd:double "NAN" is a invalid value (only "INF", "-INF", "NaN"
> and normal floating point values are supported) [2].
>
> So I assume this is related to how illegal RDF literals should be
> treated by the Stanbol Entityhub:
>
> (a) Throw an Exception
> (b) Convert illegal typed Literal to xsd:String by using their lexical form
> (c) Removing illegal values
>
> best
> Rupert
>
>
> [1]
> http://docs.oracle.com/javase/1.4.2/docs/api/java/lang/Double.html#valueOf%28java.lang.String%29
> [2] http://books.xmlschemata.org/relaxng/ch19-77065.html
>
>
> On Sun, Jul 22, 2012 at 7:41 PM, David Riccitelli <da...@insideout.io>
> wrote:
> > I created https://issues.apache.org/jira/browse/STANBOL-698 for this
> issue.
> >
> > BR,
> > David
> >
> > On Sun, Jul 22, 2012 at 8:40 PM, David Riccitelli <david@insideout.io
> >wrote:
> >
> >> Hello,
> >>
> >> I recently ran into an issue [1]. It seems that sometimes values in
> >> resources declared as double, are eventually not numbers and
> >> the Resource2ValueAdapter [3] throws an exception:
> >>
> >>
> >> Shall we make the *Resource2ValueAdapter* check whether the literal
> value
> >> can actually be converted to the destination data-type?
> >>
> >>
> >> [1] Error 500 Enhancement Chain failed because of required Engine
> >> 'dbpediaLinking' failed with Message: Unable to process ContentItem
> >> '&lt;urn:content-item-sha1-c153a98f2f30dd79232ba6af3f71f30e4e6a0093&gt;'
> >> with Enhancement Engine 'dbpediaLinking' because the engine was unable
> to
> >> process the content (Engine class:
> >>
> org.apache.stanbol.enhancer.engines.entitytagging.impl.NamedEntityTaggingEngine)(Reason:
> >> For input string: "NAN")!
> >> [2]
> org.apache.stanbol.entityhub.model.clerezza.impl.Resource2ValueAdapter
> >>
> >> BR,
> >> David
> >>
> >> --
> >> David Riccitelli
> >>
> >>
> >>
> ********************************************************************************
> >> InsideOut10 s.r.l.
> >> P.IVA: IT-11381771002
> >> Fax: +39 0110708239
> >> ---
> >> LinkedIn: http://it.linkedin.com/in/riccitelli
> >> Twitter: ziodave
> >> ---
> >> Layar Partner Network<
> http://www.layar.com/publishing/developers/list/?page=1&country=&city=&keyword=insideout10&lpn=1
> >
> >>
> >>
> ********************************************************************************
> >>
> >>
> >
> >
> > --
> > David Riccitelli
> >
> >
> ********************************************************************************
> > InsideOut10 s.r.l.
> > P.IVA: IT-11381771002
> > Fax: +39 0110708239
> > ---
> > LinkedIn: http://it.linkedin.com/in/riccitelli
> > Twitter: ziodave
> > ---
> > Layar Partner Network<
> http://www.layar.com/publishing/developers/list/?page=1&country=&city=&keyword=insideout10&lpn=1
> >
> >
> ********************************************************************************
>
>
>
> --
> | Rupert Westenthaler             rupert.westenthaler@gmail.com
> | Bodenlehenstra�e 11                             ++43-699-11108907
> | A-5500 Bischofshofen
>



-- 
David Riccitelli

********************************************************************************
InsideOut10 s.r.l.
P.IVA: IT-11381771002
Fax: +39 0110708239
---
LinkedIn: http://it.linkedin.com/in/riccitelli
Twitter: ziodave
---
Layar Partner Network<http://www.layar.com/publishing/developers/list/?page=1&country=&city=&keyword=insideout10&lpn=1>
********************************************************************************

Re: [STANBOL-698] Re: issue with http://www.w3.org/2001/XMLSchema#double NaN

Posted by Rupert Westenthaler <ru...@gmail.com>.
Hi David,

can you provide some actual examples (stack traces, Entities that
trigger this ...)

>> "A value is being adapted [mapped-class :: class java.lang.Double][literal
>> :: NAN][literal data-type :: <http://www.w3.org/2001/XMLSchema#double>]."

I think the Execption originates from the Clerezza LiteralFactory. It
might be caused by Double#valueOf(String value) [1] only supporting
"NaN". So the value "NAN" will cause a NumberFormatException. But also
for the xsd:double "NAN" is a invalid value (only "INF", "-INF", "NaN"
and normal floating point values are supported) [2].

So I assume this is related to how illegal RDF literals should be
treated by the Stanbol Entityhub:

(a) Throw an Exception
(b) Convert illegal typed Literal to xsd:String by using their lexical form
(c) Removing illegal values

best
Rupert


[1] http://docs.oracle.com/javase/1.4.2/docs/api/java/lang/Double.html#valueOf%28java.lang.String%29
[2] http://books.xmlschemata.org/relaxng/ch19-77065.html


On Sun, Jul 22, 2012 at 7:41 PM, David Riccitelli <da...@insideout.io> wrote:
> I created https://issues.apache.org/jira/browse/STANBOL-698 for this issue.
>
> BR,
> David
>
> On Sun, Jul 22, 2012 at 8:40 PM, David Riccitelli <da...@insideout.io>wrote:
>
>> Hello,
>>
>> I recently ran into an issue [1]. It seems that sometimes values in
>> resources declared as double, are eventually not numbers and
>> the Resource2ValueAdapter [3] throws an exception:
>>
>>
>> Shall we make the *Resource2ValueAdapter* check whether the literal value
>> can actually be converted to the destination data-type?
>>
>>
>> [1] Error 500 Enhancement Chain failed because of required Engine
>> 'dbpediaLinking' failed with Message: Unable to process ContentItem
>> '&lt;urn:content-item-sha1-c153a98f2f30dd79232ba6af3f71f30e4e6a0093&gt;'
>> with Enhancement Engine 'dbpediaLinking' because the engine was unable to
>> process the content (Engine class:
>> org.apache.stanbol.enhancer.engines.entitytagging.impl.NamedEntityTaggingEngine)(Reason:
>> For input string: "NAN")!
>> [2] org.apache.stanbol.entityhub.model.clerezza.impl.Resource2ValueAdapter
>>
>> BR,
>> David
>>
>> --
>> David Riccitelli
>>
>>
>> ********************************************************************************
>> InsideOut10 s.r.l.
>> P.IVA: IT-11381771002
>> Fax: +39 0110708239
>> ---
>> LinkedIn: http://it.linkedin.com/in/riccitelli
>> Twitter: ziodave
>> ---
>> Layar Partner Network<http://www.layar.com/publishing/developers/list/?page=1&country=&city=&keyword=insideout10&lpn=1>
>>
>> ********************************************************************************
>>
>>
>
>
> --
> David Riccitelli
>
> ********************************************************************************
> InsideOut10 s.r.l.
> P.IVA: IT-11381771002
> Fax: +39 0110708239
> ---
> LinkedIn: http://it.linkedin.com/in/riccitelli
> Twitter: ziodave
> ---
> Layar Partner Network<http://www.layar.com/publishing/developers/list/?page=1&country=&city=&keyword=insideout10&lpn=1>
> ********************************************************************************



-- 
| Rupert Westenthaler             rupert.westenthaler@gmail.com
| Bodenlehenstraße 11                             ++43-699-11108907
| A-5500 Bischofshofen

[STANBOL-698] Re: issue with http://www.w3.org/2001/XMLSchema#double NaN

Posted by David Riccitelli <da...@insideout.io>.
I created https://issues.apache.org/jira/browse/STANBOL-698 for this issue.

BR,
David

On Sun, Jul 22, 2012 at 8:40 PM, David Riccitelli <da...@insideout.io>wrote:

> Hello,
>
> I recently ran into an issue [1]. It seems that sometimes values in
> resources declared as double, are eventually not numbers and
> the Resource2ValueAdapter [3] throws an exception:
>
> "A value is being adapted [mapped-class :: class java.lang.Double][literal
> :: NAN][literal data-type :: <http://www.w3.org/2001/XMLSchema#double>]."
>
> Shall we make the *Resource2ValueAdapter* check whether the literal value
> can actually be converted to the destination data-type?
>
>
> [1] Error 500 Enhancement Chain failed because of required Engine
> 'dbpediaLinking' failed with Message: Unable to process ContentItem
> '&lt;urn:content-item-sha1-c153a98f2f30dd79232ba6af3f71f30e4e6a0093&gt;'
> with Enhancement Engine 'dbpediaLinking' because the engine was unable to
> process the content (Engine class:
> org.apache.stanbol.enhancer.engines.entitytagging.impl.NamedEntityTaggingEngine)(Reason:
> For input string: "NAN")!
> [2] org.apache.stanbol.entityhub.model.clerezza.impl.Resource2ValueAdapter
>
> BR,
> David
>
> --
> David Riccitelli
>
>
> ********************************************************************************
> InsideOut10 s.r.l.
> P.IVA: IT-11381771002
> Fax: +39 0110708239
> ---
> LinkedIn: http://it.linkedin.com/in/riccitelli
> Twitter: ziodave
> ---
> Layar Partner Network<http://www.layar.com/publishing/developers/list/?page=1&country=&city=&keyword=insideout10&lpn=1>
>
> ********************************************************************************
>
>


-- 
David Riccitelli

********************************************************************************
InsideOut10 s.r.l.
P.IVA: IT-11381771002
Fax: +39 0110708239
---
LinkedIn: http://it.linkedin.com/in/riccitelli
Twitter: ziodave
---
Layar Partner Network<http://www.layar.com/publishing/developers/list/?page=1&country=&city=&keyword=insideout10&lpn=1>
********************************************************************************