AKSW / OntoWiki

Semantic data wiki as well as Linked Data publishing engine
https://ontowiki.net
205 stars 51 forks source link

Resource URI's with urlencoded characters are problematic #151

Open frodeseverin opened 12 years ago

frodeseverin commented 12 years ago

This issue is related to issue #145. The issue is discussed at length there. However, I need to clarify a few things. Hence this separate issue.

Whenever there exists in the knowledge base resources with special characters in their names, things does not work as expected. Links are broken, and some views, such as the "Source" tab, does not work properly.

I have created a test resource to explain the problem. Theese are created using OntoWiki. As can be seen, the Turtle source is correct, but the OntoWiki interaction with them are not.

Turtle source:

# Exported with the Erfurt API - http://aksw.org/Projects/Erfurt

@base <http://data.bbib.no/data/> .
@prefix foaf: <http://xmlns.com/foaf/0.1/> .
@prefix owl: <http://www.w3.org/2002/07/owl#> .
@prefix rdf: <http://www.w3.org/1999/02/22-rdf-syntax-ns#> .
@prefix rdfs: <http://www.w3.org/2000/01/rdf-schema#> .
@prefix dct: <http://purl.org/dc/terms/> .
@prefix dc: <http://purl.org/dc/elements/1.1/> .
@prefix skos: <http://www.w3.org/2004/02/skos/core#> .
@prefix vs: <http://www.w3.org/2003/06/sw-vocab-status/ns#> .
@prefix doco: <http://purl.org/spar/doco/> .
@prefix event: <http://purl.org/NET/c4dm/event.owl#> .
@prefix ex: <http://example.com/> .
@prefix fabio: <http://purl.org/spar/fabio/> .
@prefix frbr: <http://purl.org/vocab/frbr/core#> .
@prefix geo: <http://www.w3.org/2003/01/geo/wgs84_pos#> .
@prefix geonames: <http://www.geonames.org/ontology#> .
@prefix lode: <http://linkedevents.org/ontology/> .
@prefix m: <http://www.kanzaki.com/ns/music#> .
@prefix mo: <http://purl.org/ontology/mo/> .
@prefix nco: <http://www.semanticdesktop.org/ontologies/2007/03/22/nco#> .
@prefix nid3: <http://www.semanticdesktop.org/ontologies/2007/05/10/nid3#> .
@prefix pro: <http://purl.org/spar/pro/> .
@prefix time: <http://www.w3.org/2006/time#> .
@prefix whois: <http://www.kanzaki.com/ns/whois#> .
@prefix xsd: <http://www.w3.org/2001/XMLSchema#> .
@prefix bibo: <http://purl.org/ontology/bibo/> .
@prefix bio: <http://purl.org/vocab/bio/0.1/> .
@prefix schema: <http://schema.org/> .
@prefix ont: <http://purl.org/net/ns/ontology-annot#> .
@prefix wn: <http://xmlns.com/wordnet/1.6/> .
@prefix ns4: <http://dbpedia.org/ontology/> .
@prefix ns5: <http://data.bergenbibliotek.no/> .
@prefix ns6: <http://data.bbib.no/data/> .

<http://data.bbib.no/data/Agent/Emmerich_K%C3%A1lm%C3%A1n> frbr:creatorOf <http://data.bbib.no/data/Musical_Work/Die_Bajadere_Utvalg>, <http://data.bbib.no/data/Musical_Work/Die_Cs%C3%A1rd%C3%A1sf%C3%BCrstin_Utvalg> ;
                                                           m:performs <http://data.bbib.no/data/fr%C3%B8hode%20p%C3%A5%20tur> ;
                                                           whois:stage <http://data.bbib.no/data/Agent/Emmerich_K%C3%A1lm%C3%A1n/Stage/Birth>, <http://data.bbib.no/data/Agent/Emmerich_K%C3%A1lm%C3%A1n/Stage/Death> ;
                                                           a m:Composer, nco:Contact, foaf:Person ;
                                                           rdfs:label "Emmerich Kálmán" ;
                                                           owl:sameAs <http://dbpedia.org/resource/Emmerich_K%C3%A1lm%C3%A1n> ;
                                                           skos:altLabel "Kálmán, Emerich" ;
                                                           skos:hiddenLabel "Emmerich Kálmán" ;
                                                           foaf:familyName "Kálmán" ;
                                                           foaf:givenName "Emmerich" .

<http://data.bbib.no/data/fr%C3%B8hode%20p%C3%A5%20tur> rdfs:label "Test of functionality of resources with urencoded URI's." ;
                                                        ex:desc1 "Literally \"http://data.bbib.no/data/frøhode på tur\"" ;
                                                        ex:desc2 "The URI of this resource is \"http://data.bbib.no/data/fr%C3%B8hode%20p%C3%A5%20tur\"" ;
                                                        ex:desc3 "This should be passed to OntoWiki as http://data.bbib.no/view/r/fr%C3%B8hode%20p%C3%A5%20tur. This link produces an error message: Supplied resource <http://data.bbib.no/data/frøhode på tur> is not a valid URI." ;
                                                        ex:desc4 "Rather, the OntoWiki interface produces this as a link to http://data.bbib.no/view/r/fr%25C3%25B8hode%2520p%25C3%25A5%2520tur, as can be seen on the page http://data.bbib.no/resource/properties/?r=http%3A%2F%2Fdata.bbib.no%2Fdata%2FAgent%2FEmmerich_K%25C3%25A1lm%25C3%25A1n. Following this link produces an error: Supplied resource <http://data.bbib.no/data/frøhode på tur> is not a valid URI." ;
                                                        ex:desc5 "However, a valid URL that OntoWiki understands is http://data.bbib.no/resource/properties/?r=http%3A%2F%2Fdata.bbib.no%2Fdata%2Ffr%25C3%25B8hode%2520p%25C3%25A5%2520tur. Adding properties here integrates into the OntoWiki interface. Note that the last part of the URI has been urlencoded as well, effectively encoding \"%C3%B8\" as \"%25C3%25B8\". " .
frodeseverin commented 12 years ago

Importing the above Turtle source into an empty knowledge base in OntoWiki exaplifies the problem.

Note that following the link for "Performs" under the "Emmerich Kálmán" resource does not work. However, expanding the resource by clicking the "+" icon does.

Replacing "Agent%2FEmmerich_K%25C3%25A1lm%25C3%25A1n" in the URL address bar of the browser with "fr%25C3%25B8hode%2520p%25C3%25A5%2520tur" displays a page for the resource in OntoWiki.

frodeseverin commented 12 years ago

Now here is an interesting discovery:

The error now seems to stem mainly from some of the the links generated in the user interface, which are handled wrongly in the Rewrites on nginx. I'll try to switch to Apache, and see whether that makes any difference to the Rewrite situation.

Anyway, here is an example:

http://data.bbib.no/view/?r=http%3A%2F%2Fdata.bbib.no%2Fdata%2FAgent%2FBj%25C3%25B8rnstjerne_Bj%25C3%25B8rnson lists my knowledge of Bjørnstjærne Bjørnson. All thing seems to be OK. I can navigate with the links that are present in the 'Instances linking here' box, both to his 'Fire Digte ...' and back again to the author.

If, however, I try to navigate from the resource page of 'Fire Digte ...' http://data.bbib.no/view/?r=http%3A%2F%2Fdata.bbib.no%2Fdata%2FMusical_Work%2FFire_Digte_fra_Fiskerjenten_af_Bj._Bj%25C3%25B8rnson_Takk_for_dit_r%25C3%25A5d using the link as presented in the field 'nid3:textWriter' as given below: http://data.bbib.no/view/r/Bj%25C3%25B8rnstjerne_Bj%25C3%25B8rnson things do not work.

I'll be back with more info.

;)Frode

frodeseverin commented 12 years ago

Valid Turtle for the resources in question:

Bjørnson:

# Exported with the Erfurt API - http://aksw.org/Projects/Erfurt

@base <http://data.bbib.no/data/> .
@prefix foaf: <http://xmlns.com/foaf/0.1/> .
@prefix owl: <http://www.w3.org/2002/07/owl#> .
@prefix rdf: <http://www.w3.org/1999/02/22-rdf-syntax-ns#> .
@prefix rdfs: <http://www.w3.org/2000/01/rdf-schema#> .
@prefix xsd: <http://www.w3.org/2001/XMLSchema#> .
@prefix dct: <http://purl.org/dc/terms/> .
@prefix dc: <http://purl.org/dc/elements/1.1/> .
@prefix skos: <http://www.w3.org/2004/02/skos/core#> .
@prefix vs: <http://www.w3.org/2003/06/sw-vocab-status/ns#> .
@prefix doco: <http://purl.org/spar/doco/> .
@prefix event: <http://purl.org/NET/c4dm/event.owl#> .
@prefix ex: <http://example.com/> .
@prefix fabio: <http://purl.org/spar/fabio/> .
@prefix frbr: <http://purl.org/vocab/frbr/core#> .
@prefix geo: <http://www.w3.org/2003/01/geo/wgs84_pos#> .
@prefix geonames: <http://www.geonames.org/ontology#> .
@prefix lode: <http://linkedevents.org/ontology/> .
@prefix m: <http://www.kanzaki.com/ns/music#> .
@prefix mo: <http://purl.org/ontology/mo/> .
@prefix nco: <http://www.semanticdesktop.org/ontologies/2007/03/22/nco#> .
@prefix nid3: <http://www.semanticdesktop.org/ontologies/2007/05/10/nid3#> .
@prefix pro: <http://purl.org/spar/pro/> .
@prefix time: <http://www.w3.org/2006/time#> .
@prefix whois: <http://www.kanzaki.com/ns/whois#> .
@prefix bibo: <http://purl.org/ontology/bibo/> .
@prefix bio: <http://purl.org/vocab/bio/0.1/> .
@prefix schema: <http://schema.org/> .
@prefix ont: <http://purl.org/net/ns/ontology-annot#> .
@prefix wn: <http://xmlns.com/wordnet/1.6/> .
@prefix ns4: <http://dbpedia.org/ontology/> .
@prefix ns5: <http://data.bergenbibliotek.no/> .
@prefix ns6: <http://data.bbib.no/data/> .

<http://data.bbib.no/data/Agent/Bj%C3%B8rnstjerne_Bj%C3%B8rnson> frbr:creatorOf <http://data.bbib.no/data/Musical_Work/Arnljot_Gelline_Olavsdr%C3%A5pa>, <http://data.bbib.no/data/Musical_Work/Arnljot_Gelline_Skif%C3%A6rden>, <http://data.bbib.no/data/Musical_Work/Bergliot>, <http://data.bbib.no/data/Musical_Work/Fire_Digte_fra_Fiskerjenten_af_Bj._Bj%C3%B8rnson_Det_f%C3%B8rste_m%C3%B8te>, <http://data.bbib.no/data/Musical_Work/Fire_Digte_fra_Fiskerjenten_af_Bj._Bj%C3%B8rnson_Takk_for_dit_r%C3%A5d> ;
                                                                 whois:stage <http://data.bbib.no/data/Agent/Bj%C3%B8rnstjerne_Bj%C3%B8rnson/Stage/Birth>, <http://data.bbib.no/data/Agent/Bj%C3%B8rnstjerne_Bj%C3%B8rnson/Stage/Death> ;
                                                                 a m:Composer, nco:Contact, foaf:Person ;
                                                                 rdfs:label "Bjørnstjerne  Bjørnson" ;
                                                                 owl:sameAs <http://dbpedia.org/resource/Bj%C3%B8rnstjerne_Bj%C3%B8rnson> ;
                                                                 skos:hiddenLabel "Bjørnstjerne Bjørnson" ;
                                                                 foaf:familyName "Bjørnson" ;
                                                                 foaf:givenName "Bjørnstjerne " .

Fire Digte

# Exported with the Erfurt API - http://aksw.org/Projects/Erfurt

@base <http://data.bbib.no/data/> .
@prefix foaf: <http://xmlns.com/foaf/0.1/> .
@prefix owl: <http://www.w3.org/2002/07/owl#> .
@prefix rdf: <http://www.w3.org/1999/02/22-rdf-syntax-ns#> .
@prefix rdfs: <http://www.w3.org/2000/01/rdf-schema#> .
@prefix xsd: <http://www.w3.org/2001/XMLSchema#> .
@prefix dct: <http://purl.org/dc/terms/> .
@prefix dc: <http://purl.org/dc/elements/1.1/> .
@prefix skos: <http://www.w3.org/2004/02/skos/core#> .
@prefix vs: <http://www.w3.org/2003/06/sw-vocab-status/ns#> .
@prefix doco: <http://purl.org/spar/doco/> .
@prefix event: <http://purl.org/NET/c4dm/event.owl#> .
@prefix ex: <http://example.com/> .
@prefix fabio: <http://purl.org/spar/fabio/> .
@prefix frbr: <http://purl.org/vocab/frbr/core#> .
@prefix geo: <http://www.w3.org/2003/01/geo/wgs84_pos#> .
@prefix geonames: <http://www.geonames.org/ontology#> .
@prefix lode: <http://linkedevents.org/ontology/> .
@prefix m: <http://www.kanzaki.com/ns/music#> .
@prefix mo: <http://purl.org/ontology/mo/> .
@prefix nco: <http://www.semanticdesktop.org/ontologies/2007/03/22/nco#> .
@prefix nid3: <http://www.semanticdesktop.org/ontologies/2007/05/10/nid3#> .
@prefix pro: <http://purl.org/spar/pro/> .
@prefix time: <http://www.w3.org/2006/time#> .
@prefix whois: <http://www.kanzaki.com/ns/whois#> .
@prefix bibo: <http://purl.org/ontology/bibo/> .
@prefix bio: <http://purl.org/vocab/bio/0.1/> .
@prefix schema: <http://schema.org/> .
@prefix ont: <http://purl.org/net/ns/ontology-annot#> .
@prefix wn: <http://xmlns.com/wordnet/1.6/> .
@prefix ns4: <http://dbpedia.org/ontology/> .
@prefix ns5: <http://data.bergenbibliotek.no/> .
@prefix ns6: <http://data.bbib.no/data/> .

<http://data.bbib.no/data/Musical_Work/Fire_Digte_fra_Fiskerjenten_af_Bj._Bj%C3%B8rnson_Takk_for_dit_r%C3%A5d> ns5:Komposisjonstype "nmbf:Sanger" ;
                                                                                                               mo:instrument m:Soprano ;
                                                                                                               mo:performed_in <http://data.bbib.no/data/Performance/BFO_17051949_p_9> ;
                                                                                                               mo:primary_instrument m:Orchestra ;
                                                                                                               m:composer <http://data.bbib.no/data/Agent/Bj%C3%B8rnstjerne_Bj%C3%B8rnson>, <http://data.bbib.no/data/Agent/Edvard_Grieg> ;
                                                                                                               m:opus "op. 21/4" ;
                                                                                                               nid3:composer ns6:Edvard_Grieg ;
                                                                                                               nid3:textWriter <http://data.bbib.no/data/Bj%C3%B8rnstjerne_Bj%C3%B8rnson> ;
                                                                                                               a m:Movement, m:Musical_Work ;
                                                                                                               rdfs:label "Fire Digte fra Fiskerjenten af Bj. Bjørnson. Takk for dit råd" ;
                                                                                                               skos:altLabel "Takk for ditt råd" ;
                                                                                                               skos:prefLabel "Fire Digte fra Fiskerjenten af Bj. Bjørnson. Takk for dit råd" .

;)Frode

frodeseverin commented 12 years ago

I have now tested this with Apache, and that gives the same results.

Clicking the object link of 'nid3:textWriter' in the resource view of "Fire Digte ..." in OntoWiki lands my browser at http://data.bbib.no/view/r/Bj%25C3%25B8rnstjerne_Bj%25C3%25B8rnson which is of course empty.

The data for Bjørnson is stored at this URI http://data.bbib.no/data/Agent/Bj%C3%B8rnstjerne_Bj%C3%B8rnson and accessible in OntoWiki at http://data.bbib.no/view/?r=http%3A%2F%2Fdata.bbib.no%2Fdata%2FAgent%2FBj%25C3%25B8rnstjerne_Bj%25C3%25B8rnson If I try to remove the erraneous '%25' encodings of the '%' character such: http://data.bbib.no/view/r/Bj%C3%B8rnstjerne_Bj%C3%B8rnson things does not work either.

The Linked Data Server does not work for the resources with international queries.

There seems to be something wrong both in the parsing of resource links, both in the production of HTML tags for the interface, and in the consumption of the resource URI's in the scripts handling the parameters to http://data.bbib.no/view/r/

;)Frode