Hi florent
Using a '#' in the URI has the disadvantages, that browsers will not
send the part behind the hash to the server because they assume, that
they need to download the whole document and navigate to the anchor
within the document.
Using curl (or javascript) I think the full URL should be sent to the
server (was not able to find some good information about this, but at
least "curl -v" says that it sends the whole URL to the server).
However on the server side Jersey does also not provide the #{anchor}
part of the URL.
Sending
> "http://localhost:8080/entityhub/sites/entity?id=http://www.test.fr/terminology#entity_gradient_1306341921902"
will parse only "http://www.test.fr/terminology" to a method annotated with
@GET
@Path("/entity")
public Response getEntity(@QueryParam(value = "id") String id) {
// get the Entity
...
URL encoding the '#' to '%23' causes Jersey to parse
"http://www.test.fr/terminology#entity_gradient_1306341921902".
In this case the query for an entity with this ID is correctly parsed
to the ReferencedSite ( '#' not '%23'). So if you parse '%23' and the
indexed Entity uses '#' it should work as long as Entities are cached
locally. If a remote service is used, than the same problem of the '#'
reappears for the remote service.
To test on my side I have done the following:
* renamed the Entities of the IPTC worldregions from
"http://cv.iptc.org/newscodes/worldregion/r001" to
"http://cv.iptc.org/newscodes/worldregion#r001"
* indexed the IPTC using the indexing tools
* installed the index to the entityhub
* curl -v
"http://localhost:8080/entityhub/sites/entity?id=http://cv.iptc.org/newscodes/worldregion%23r001"
Assuming that
> curl
> "http://localhost:8080/entityhub/sites/entity?id=http://www.test.fr/terminology%23space_mathematiques_1306341820765"
> ==> answer is
> Entity with ID
> 'http://www.test.fr/terminology#space_mathematiques_1306341820765' not found
> an any referenced site
>
happend on a referenced site with a full cache (e.g. as created by the
Indexing Utility. I was not able to reproduce the Error. If the
referenced site uses a remote service to dereferenced entity ids (e.g.
the Cool URI) this might happen. In this case I suggest to directly
test the remote service.
best
Rupert Westenthaler
On Mon, Jun 13, 2011 at 1:06 PM, florent andré
<[email protected]> wrote:
> Hi Rupert,
> Hope you are fine.
>
> I have another problem...
> In my skos, entity are identify by an #, like this :
>
> <rdf:Description
> rdf:about="http://www.test.fr/terminology#entity_gradient_1306341921902">
> <skos:broader
> rdf:resource="http://www.test.fr/terminology#entity_operateur_mathematique_1306341918995"/>
> <skos:prefLabel>GRADIENT</skos:prefLabel>
> <skos:inScheme
> rdf:resource="http://www.test.fr/terminology#space_mathematiques_1306341820765"/>
> <rdf:type rdf:resource="http://www.w3.org/2004/02/skos/core#Concept"/>
> </rdf:Description>
>
> And I can't arrive to find the entity with the entity endpoint.
>
> * With the # char :
> curl
> "http://localhost:8080/entityhub/sites/entity?id=http://www.test.fr/terminology#entity_gradient_1306341921902"
> ==> answer is
> Entity with ID 'http://www.test.fr/terminology' not found an any referenced
> site
>
> ==> the part after the # is remove
>
> * With replacement of the # by %23 (the urlencode equivalent) :
> curl
> "http://localhost:8080/entityhub/sites/entity?id=http://www.test.fr/terminology%23space_mathematiques_1306341820765"
> ==> answer is
> Entity with ID
> 'http://www.test.fr/terminology#space_mathematiques_1306341820765' not found
> an any referenced site
>
> ==> all the id is keep, but still not found...
> The result is the same if I urlencode all the entity id.
>
> This is related to a bug or something I do wrong ?
>
> Thanks.
> ++
>
>
--
| Rupert Westenthaler [email protected]
| Bodenlehenstraße 11 ++43-699-11108907
| A-5500 Bischofshofen