Skip to content

Commit 8e476c7

Browse files
committed
escape homepage URIs
1 parent ef9f36d commit 8e476c7

File tree

2 files changed

+14
-3
lines changed

2 files changed

+14
-3
lines changed

core/src/main/scala/org/dbpedia/extraction/destinations/Quad.scala

Lines changed: 13 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@ import org.dbpedia.extraction.util.Language
88
/**
99
* Represents a statement in the N-Quads format (see: http://sw.deri.org/2008/07/n-quads/)
1010
*/
11+
//TODO write out equivalent properties
1112
class Quad( val language : Language,
1213
val dataset : Dataset,
1314
val subject : String,
@@ -66,13 +67,23 @@ class Quad( val language : Language,
6667
{
6768
sb append '"'
6869
escapeString(sb, value) //sb append value //#int
69-
sb append "\"^^<" append datatype.uri append "> "
70+
sb append "\"^^<"
71+
escapeString(sb, datatype.uri)
72+
sb append "> "
7073
}
7174
}
7275
else
7376
{
7477
sb append '<'
75-
sb append value //this must not be escaped, it is a URI/IRI //TODO URIs should be escaped if they contain unicode chars! (for example homepages) -> Max: maybe we should have DBpediaURI and OtherURI as well as Literal objects?
78+
79+
//HACK
80+
//TODO find a good solution for this
81+
//maybe we should have DBpediaURI and OtherURI as well as Literal objects?
82+
if(predicate == "http://xmlns.com/foaf/0.1/homepage")
83+
escapeString(sb, value) // escape unicode in homepage URI
84+
else
85+
sb append value //this must not be escaped, it is a URI/IRI
86+
7687
sb append "> "
7788
}
7889

dump/config.properties.default

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -74,7 +74,7 @@ extractors.ru=org.dbpedia.extraction.mappings.MappingExtractor \
7474
org.dbpedia.extraction.mappings.DisambiguationExtractor \
7575
org.dbpedia.extraction.mappings.HomepageExtractor \
7676
org.dbpedia.extraction.mappings.ImageExtractor \
77-
org.dbpedia.extraction.mappings.InterLanguageLinksExtractorExtractor
77+
org.dbpedia.extraction.mappings.InterLanguageLinksExtractor
7878

7979
extractors.sl=org.dbpedia.extraction.mappings.MappingExtractor
8080

0 commit comments

Comments
 (0)