From 8e476c74114f5af6ef8c25b13cfc8ae13e873ed5 Mon Sep 17 00:00:00 2001 From: Max Jakob Date: Tue, 16 Aug 2011 15:54:45 +0200 Subject: [PATCH] escape homepage URIs --- .../dbpedia/extraction/destinations/Quad.scala | 15 +++++++++++++-- dump/config.properties.default | 2 +- 2 files changed, 14 insertions(+), 3 deletions(-) diff --git a/core/src/main/scala/org/dbpedia/extraction/destinations/Quad.scala b/core/src/main/scala/org/dbpedia/extraction/destinations/Quad.scala index 34fe086b75..93504d26be 100644 --- a/core/src/main/scala/org/dbpedia/extraction/destinations/Quad.scala +++ b/core/src/main/scala/org/dbpedia/extraction/destinations/Quad.scala @@ -8,6 +8,7 @@ import org.dbpedia.extraction.util.Language /** * Represents a statement in the N-Quads format (see: http://sw.deri.org/2008/07/n-quads/) */ +//TODO write out equivalent properties class Quad( val language : Language, val dataset : Dataset, val subject : String, @@ -66,13 +67,23 @@ class Quad( val language : Language, { sb append '"' escapeString(sb, value) //sb append value //#int - sb append "\"^^<" append datatype.uri append "> " + sb append "\"^^<" + escapeString(sb, datatype.uri) + sb append "> " } } else { sb append '<' - 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? + + //HACK + //TODO find a good solution for this + //maybe we should have DBpediaURI and OtherURI as well as Literal objects? + if(predicate == "http://xmlns.com/foaf/0.1/homepage") + escapeString(sb, value) // escape unicode in homepage URI + else + sb append value //this must not be escaped, it is a URI/IRI + sb append "> " } diff --git a/dump/config.properties.default b/dump/config.properties.default index aada63f74e..b770cafaee 100644 --- a/dump/config.properties.default +++ b/dump/config.properties.default @@ -74,7 +74,7 @@ extractors.ru=org.dbpedia.extraction.mappings.MappingExtractor \ org.dbpedia.extraction.mappings.DisambiguationExtractor \ org.dbpedia.extraction.mappings.HomepageExtractor \ org.dbpedia.extraction.mappings.ImageExtractor \ - org.dbpedia.extraction.mappings.InterLanguageLinksExtractorExtractor + org.dbpedia.extraction.mappings.InterLanguageLinksExtractor extractors.sl=org.dbpedia.extraction.mappings.MappingExtractor