Skip to content

Commit

Permalink
escape homepage URIs
Browse files Browse the repository at this point in the history
  • Loading branch information
maxjakob committed Aug 16, 2011
1 parent ef9f36d commit 8e476c7
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 3 deletions.
15 changes: 13 additions & 2 deletions core/src/main/scala/org/dbpedia/extraction/destinations/Quad.scala
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down Expand Up @@ -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 "> "
}

Expand Down
2 changes: 1 addition & 1 deletion dump/config.properties.default
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down

0 comments on commit 8e476c7

Please sign in to comment.