Ok,
think I found the error. I'd like to have the answer as Json Object, but
apparently it doesn't work. If I get the response as RDF there is no error,
while using Json I got the error.
Pablo can you try this experiment as well? And any idea about the reason?
Cheers,
Stefano
On 18/mag/2012, at 11.50, Pablo Mendes wrote:
>
> Hi Stefano,
> I cannot reproduce. It seems that the error is in your encoder. I used cURL
> with four combinations. I used the text without special chars such as [ * ,
> etc. and I also used the text copied + pasted from your e-mail (granted that
> character encoding could have been lost in this operation - I only tested URL
> encoding). I also tested with each of our disambiguator classes. Everything
> seemed to work, although the disambiguations are not particularly good. :)
> Short texts are a known limitation at the moment.
>
> Here is what I get:
>
> curl -H "Accept:text/xml" "http://spotlight.dbpedia.org/rest/annotate"
> --data-urlencode "text=Residential Search List Page - Mortgage advice from
> SPF, WT.conv, Mortgage Advice From SPF, WT.tx_e, conv, WT.dl, 85" --data
> "disambiguator=Occurrences&confidence=0.0&support=0"
>
> <?xml version="1.0" encoding="utf-8"?>
> <Annotation text="Residential Search List Page - Mortgage advice from SPF,
> WT.conv, Mortgage Advice From SPF, WT.tx_e, conv, WT.dl, 85" confidence="0.0"
> support="0" types="" sparql="" policy="whitelist">
> <Resources>
> <Resource URI="http://dbpedia.org/resource/Residential_area" support="192"
> types="Freebase:/geography/geographical_feature_category"
> surfaceForm="Residential" offset="0" similarityScore="0.040789756923913956"
> percentageOfSecondRank="0.7955611700604699"/>
> <Resource URI="http://dbpedia.org/resource/The_Search" support="36"
> types="Schema:CreativeWork,Schema:Movie,DBpedia:Http://www.w3.org/2002/07/owl#Thing,DBpedia:Work,DBpedia:Film,Freebase:/film/film,Freebase:/award/award_nominated_work,Freebase:/award/award_winning_work,Freebase:/award/ranked_item"
> surfaceForm="Search" offset="12" similarityScore="0.0583575963973999"
> percentageOfSecondRank="0.8555990304143286"/>
> <Resource URI="http://dbpedia.org/resource/List_%28computing%29"
> support="119" types="" surfaceForm="List" offset="19"
> similarityScore="0.08060692995786667"
> percentageOfSecondRank="0.9967060358101796"/>
> <Resource URI="http://dbpedia.org/resource/Financial_adviser" support="82"
> types="Freebase:/people/profession,Freebase:/book/book_subject"
> surfaceForm="Mortgage advice" offset="31"
> similarityScore="0.031936049461364746" percentageOfSecondRank="-1.0"/>
> <Resource URI="http://dbpedia.org/resource/Singapore_Police_Force"
> support="247"
> types="Freebase:/organization/organization,Freebase:/government/government_agency,Freebase:/business/employer"
> surfaceForm="SPF" offset="52" similarityScore="0.074439637362957"
> percentageOfSecondRank="0.994765851552764"/>
> <Resource URI="http://dbpedia.org/resource/Wt_%28web_toolkit%29" support="2"
> types="" surfaceForm="WT" offset="57" similarityScore="0.0890926867723465"
> percentageOfSecondRank="0.6443274182630978"/>
> <Resource URI="http://dbpedia.org/resource/Financial_adviser" support="82"
> types="Freebase:/people/profession,Freebase:/book/book_subject"
> surfaceForm="Mortgage Advice" offset="66"
> similarityScore="0.031936049461364746" percentageOfSecondRank="-1.0"/>
> <Resource URI="http://dbpedia.org/resource/Singapore_Police_Force"
> support="247"
> types="Freebase:/organization/organization,Freebase:/government/government_agency,Freebase:/business/employer"
> surfaceForm="SPF" offset="87" similarityScore="0.074439637362957"
> percentageOfSecondRank="0.994765851552764"/>
> <Resource URI="http://dbpedia.org/resource/Wt_%28web_toolkit%29" support="2"
> types="" surfaceForm="WT" offset="92" similarityScore="0.0890926867723465"
> percentageOfSecondRank="0.6443274182630978"/>
> <Resource URI="http://dbpedia.org/resource/Wt_%28web_toolkit%29" support="2"
> types="" surfaceForm="WT" offset="107" similarityScore="0.0890926867723465"
> percentageOfSecondRank="0.6443274182630978"/>
> </Resources>
> </Annotation>
>
> curl -H "Accept:text/xml" "http://spotlight.dbpedia.org/rest/annotate"
> --data-urlencode "text=Residential Search List Page - Mortgage advice from
> SPF, WT.conv, Mortgage Advice From SPF, WT.tx_e, conv, WT.dl, 85],
> selector:a[href*=mortgages]}]}," --data
> "disambiguator=Occurrences&confidence=0.0&support=0"
>
> <?xml version="1.0" encoding="utf-8"?>
> <Annotation text="Residential Search List Page - Mortgage advice from SPF,
> WT.conv, Mortgage Advice From SPF, WT.tx_e, conv, WT.dl, 85],
> selector:a[href*=mortgages]}]}," confidence="0.0" support="0" types=""
> sparql="" policy="whitelist">
> <Resources>
> <Resource URI="http://dbpedia.org/resource/Residential_area" support="192"
> types="Freebase:/geography/geographical_feature_category"
> surfaceForm="Residential" offset="0" similarityScore="0.03599096089601517"
> percentageOfSecondRank="0.7955611851468495"/>
> <Resource URI="http://dbpedia.org/resource/The_Search" support="36"
> types="Schema:CreativeWork,Schema:Movie,DBpedia:Http://www.w3.org/2002/07/owl#Thing,DBpedia:Work,DBpedia:Film,Freebase:/film/film,Freebase:/award/award_nominated_work,Freebase:/award/award_winning_work,Freebase:/award/ranked_item"
> surfaceForm="Search" offset="12" similarityScore="0.05149199813604355"
> percentageOfSecondRank="0.8555989830330427"/>
> <Resource URI="http://dbpedia.org/resource/List_%28computing%29"
> support="119" types="" surfaceForm="List" offset="19"
> similarityScore="0.05697178840637207"
> percentageOfSecondRank="0.9967060627016576"/>
> <Resource URI="http://dbpedia.org/resource/Financial_adviser" support="82"
> types="Freebase:/people/profession,Freebase:/book/book_subject"
> surfaceForm="Mortgage advice" offset="31"
> similarityScore="0.0281788669526577" percentageOfSecondRank="-1.0"/>
> <Resource URI="http://dbpedia.org/resource/Singapore_Police_Force"
> support="247"
> types="Freebase:/organization/organization,Freebase:/government/government_agency,Freebase:/business/employer"
> surfaceForm="SPF" offset="52" similarityScore="0.06568203121423721"
> percentageOfSecondRank="0.9947659248115832"/>
> <Resource URI="http://dbpedia.org/resource/Wt_%28web_toolkit%29" support="2"
> types="" surfaceForm="WT" offset="57" similarityScore="0.07861119508743286"
> percentageOfSecondRank="0.6443273804153079"/>
> <Resource URI="http://dbpedia.org/resource/Financial_adviser" support="82"
> types="Freebase:/people/profession,Freebase:/book/book_subject"
> surfaceForm="Mortgage Advice" offset="66"
> similarityScore="0.0281788669526577" percentageOfSecondRank="-1.0"/>
> <Resource URI="http://dbpedia.org/resource/Singapore_Police_Force"
> support="247"
> types="Freebase:/organization/organization,Freebase:/government/government_agency,Freebase:/business/employer"
> surfaceForm="SPF" offset="87" similarityScore="0.06568203121423721"
> percentageOfSecondRank="0.9947659248115832"/>
> <Resource URI="http://dbpedia.org/resource/Wt_%28web_toolkit%29" support="2"
> types="" surfaceForm="WT" offset="92" similarityScore="0.07861119508743286"
> percentageOfSecondRank="0.6443273804153079"/>
> <Resource URI="http://dbpedia.org/resource/Wt_%28web_toolkit%29" support="2"
> types="" surfaceForm="WT" offset="107" similarityScore="0.07861119508743286"
> percentageOfSecondRank="0.6443273804153079"/>
> <Resource URI="http://dbpedia.org/resource/Selector_%28disc_jockey%29"
> support="24" types="" surfaceForm="selector" offset="119"
> similarityScore="0.08863186091184616"
> percentageOfSecondRank="0.9573594143292429"/>
> <Resource URI="http://dbpedia.org/resource/Hyperlink" support="315" types=""
> surfaceForm="href" offset="130" similarityScore="0.06399745494127274"
> percentageOfSecondRank="0.9285210021010308"/>
> <Resource URI="http://dbpedia.org/resource/Mortgage_loan" support="1214"
> types="" surfaceForm="mortgages" offset="136"
> similarityScore="0.03378088399767876" percentageOfSecondRank="-1.0"/>
> </Resources>
> </Annotation>
>
>
> curl -H "Accept:text/xml" "http://spotlight.dbpedia.org/rest/annotate"
> --data-urlencode "text=Residential Search List Page - Mortgage advice from
> SPF, WT.conv, Mortgage Advice From SPF, WT.tx_e, conv, WT.dl, 85],
> selector:a[href*=mortgages]}]}," --data "disambiguator=Document"
>
> <?xml version="1.0" encoding="utf-8"?>
> <Annotation text="Residential Search List Page - Mortgage advice from SPF,
> WT.conv, Mortgage Advice From SPF, WT.tx_e, conv, WT.dl, 85],
> selector:a[href*=mortgages]}]}," confidence="0.5" support="30" types=""
> sparql="" policy="whitelist">
> <Resources>
> <Resource URI="http://dbpedia.org/resource/The_Search" support="36" types=""
> surfaceForm="Search" offset="12" similarityScore="0.3879143297672272"
> percentageOfSecondRank="-1.0"/>
> <Resource URI="http://dbpedia.org/resource/Sender_Policy_Framework"
> support="51" types="" surfaceForm="SPF" offset="52"
> similarityScore="0.5335691571235657" percentageOfSecondRank="-1.0"/>
> <Resource URI="http://dbpedia.org/resource/Wiktionary" support="139" types=""
> surfaceForm="WT" offset="57" similarityScore="0.530541181564331"
> percentageOfSecondRank="-1.0"/>
> <Resource URI="http://dbpedia.org/resource/Sender_Policy_Framework"
> support="51" types="" surfaceForm="SPF" offset="87"
> similarityScore="0.5335691571235657" percentageOfSecondRank="-1.0"/>
> <Resource URI="http://dbpedia.org/resource/Wiktionary" support="139" types=""
> surfaceForm="WT" offset="92" similarityScore="0.530541181564331"
> percentageOfSecondRank="-1.0"/>
> <Resource URI="http://dbpedia.org/resource/Wiktionary" support="139" types=""
> surfaceForm="WT" offset="107" similarityScore="0.530541181564331"
> percentageOfSecondRank="-1.0"/>
> <Resource URI="http://dbpedia.org/resource/Hyperlink" support="315" types=""
> surfaceForm="href" offset="130" similarityScore="0.7982102632522583"
> percentageOfSecondRank="-1.0"/>
> <Resource URI="http://dbpedia.org/resource/Mortgage_loan" support="1214"
> types="" surfaceForm="mortgages" offset="136"
> similarityScore="0.2976882755756378" percentageOfSecondRank="-1.0"/>
> </Resources>
> </Annotation>
>
>
> curl -H "Accept:text/xml" "http://spotlight.dbpedia.org/rest/annotate"
> --data-urlencode "text=Residential Search List Page - Mortgage advice from
> SPF, WT.conv, Mortgage Advice From SPF, WT.tx_e, conv, WT.dl, 85" --data
> "disambiguator=Document"
>
> <?xml version="1.0" encoding="utf-8"?>
> <Annotation text="Residential Search List Page - Mortgage advice from SPF,
> WT.conv, Mortgage Advice From SPF, WT.tx_e, conv, WT.dl, 85" confidence="0.5"
> support="30" types="" sparql="" policy="whitelist">
> <Resources>
> <Resource URI="http://dbpedia.org/resource/Residential_area" support="192"
> types="" surfaceForm="Residential" offset="0"
> similarityScore="0.22358134388923645" percentageOfSecondRank="-1.0"/>
> <Resource URI="http://dbpedia.org/resource/The_Search" support="36" types=""
> surfaceForm="Search" offset="12" similarityScore="0.5016080141067505"
> percentageOfSecondRank="-1.0"/>
> <Resource URI="http://dbpedia.org/resource/Sender_Policy_Framework"
> support="51" types="" surfaceForm="SPF" offset="52"
> similarityScore="0.6899529099464417" percentageOfSecondRank="-1.0"/>
> <Resource URI="http://dbpedia.org/resource/Wiktionary" support="139" types=""
> surfaceForm="WT" offset="57" similarityScore="0.6860374212265015"
> percentageOfSecondRank="-1.0"/>
> <Resource URI="http://dbpedia.org/resource/Sender_Policy_Framework"
> support="51" types="" surfaceForm="SPF" offset="87"
> similarityScore="0.6899529099464417" percentageOfSecondRank="-1.0"/>
> <Resource URI="http://dbpedia.org/resource/Wiktionary" support="139" types=""
> surfaceForm="WT" offset="92" similarityScore="0.6860374212265015"
> percentageOfSecondRank="-1.0"/>
> <Resource URI="http://dbpedia.org/resource/Wiktionary" support="139" types=""
> surfaceForm="WT" offset="107" similarityScore="0.6860374212265015"
> percentageOfSecondRank="-1.0"/>
> </Resources>
> </Annotation>
>
>
> Cheers,
> Pablo
>
>
> On Fri, May 18, 2012 at 11:16 AM, Stefano Ortona <[email protected]> wrote:
> Hi Max,
>
> here an example of text
>
> Residential Search List Page - Mortgage advice from SPF, WT.conv, Mortgage
> Advice From SPF, WT.tx_e, conv, WT.dl, 85], selector:a[href*=mortgages]}]},
>
> Encoding it once simply doesn't work and return a 400 Error, i have to encode
> it twice (and yes I'm using java.net.URLEncoder).
>
> Cheers,
> Stefano
>
>
> On 17/mag/2012, at 19.07, Max Jakob wrote:
>
>> Hi Stefano,
>>
>> URL-encoding the text once, for example using for example with
>> java.net.URLEncoder.encode, should be sufficient to send it to the web
>> service and to get proper entity annotations.
>>
>> If this is not the case for you, please send the example that fails.
>>
>> Cheers,
>> Max
>>
>> On Thu, May 17, 2012 at 6:40 PM, Stefano Ortona <[email protected]> wrote:
>>> Hi everybody,
>>>
>>> I'm trying the REST web-service and for some kind of text i get a weird
>>> situation: I encode the text as UTF-8 and in this way i get a 400 error
>>> from the server. But if I encode the same text twice, it goes fine and
>>> server can process the request.
>>> Unfortunatelly encoding text twice add additional character to the original
>>> text and Spotlight doesn't recognize the entities as it should.
>>> Any suggestion? (I know that including the service in my own
>>> server/application would solve the problem, but before doing that i'd like
>>> to try the service).
>>>
>>> Cheers,
>>> Stefano
>>> ------------------------------------------------------------------------------
>>> Live Security Virtual Conference
>>> Exclusive live event will cover all the ways today's security and
>>> threat landscape has changed and how IT managers can respond. Discussions
>>> will include endpoint security, mobile security and the latest in malware
>>> threats. http://www.accelacomm.com/jaw/sfrnl04242012/114/50122263/
>>> _______________________________________________
>>> Dbp-spotlight-users mailing list
>>> [email protected]
>>> https://lists.sourceforge.net/lists/listinfo/dbp-spotlight-users
>>
>
>
> ------------------------------------------------------------------------------
> Live Security Virtual Conference
> Exclusive live event will cover all the ways today's security and
> threat landscape has changed and how IT managers can respond. Discussions
> will include endpoint security, mobile security and the latest in malware
> threats. http://www.accelacomm.com/jaw/sfrnl04242012/114/50122263/
> _______________________________________________
> Dbp-spotlight-users mailing list
> [email protected]
> https://lists.sourceforge.net/lists/listinfo/dbp-spotlight-users
>
>
------------------------------------------------------------------------------
Live Security Virtual Conference
Exclusive live event will cover all the ways today's security and
threat landscape has changed and how IT managers can respond. Discussions
will include endpoint security, mobile security and the latest in malware
threats. http://www.accelacomm.com/jaw/sfrnl04242012/114/50122263/
_______________________________________________
Dbp-spotlight-users mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/dbp-spotlight-users