You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@marmotta.apache.org by wi...@apache.org on 2014/01/17 15:48:20 UTC

git commit: MARMOTTA-423: fixing should be olvy performed in case the format is turtle

Updated Branches:
  refs/heads/develop 9e737af91 -> 7caa45575


MARMOTTA-423: fixing should be olvy performed in case the format is turtle


Project: http://git-wip-us.apache.org/repos/asf/marmotta/repo
Commit: http://git-wip-us.apache.org/repos/asf/marmotta/commit/7caa4557
Tree: http://git-wip-us.apache.org/repos/asf/marmotta/tree/7caa4557
Diff: http://git-wip-us.apache.org/repos/asf/marmotta/diff/7caa4557

Branch: refs/heads/develop
Commit: 7caa4557500e1d85f257c4459760ffcdce680512
Parents: 9e737af
Author: Sergio Fernández <wi...@apache.org>
Authored: Fri Jan 17 15:29:04 2014 +0100
Committer: Sergio Fernández <wi...@apache.org>
Committed: Fri Jan 17 15:29:04 2014 +0100

----------------------------------------------------------------------
 .../provider/freebase/FreebaseProvider.java     | 20 +++++++++++---------
 1 file changed, 11 insertions(+), 9 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/marmotta/blob/7caa4557/libraries/ldclient/ldclient-provider-freebase/src/main/java/org/apache/marmotta/ldclient/provider/freebase/FreebaseProvider.java
----------------------------------------------------------------------
diff --git a/libraries/ldclient/ldclient-provider-freebase/src/main/java/org/apache/marmotta/ldclient/provider/freebase/FreebaseProvider.java b/libraries/ldclient/ldclient-provider-freebase/src/main/java/org/apache/marmotta/ldclient/provider/freebase/FreebaseProvider.java
index 699c294..423ac53 100644
--- a/libraries/ldclient/ldclient-provider-freebase/src/main/java/org/apache/marmotta/ldclient/provider/freebase/FreebaseProvider.java
+++ b/libraries/ldclient/ldclient-provider-freebase/src/main/java/org/apache/marmotta/ldclient/provider/freebase/FreebaseProvider.java
@@ -97,16 +97,18 @@ public class FreebaseProvider extends AbstractHttpProvider {
             format = Rio.getWriterFormatForMIMEType(contentType, DEFAULT_RDF_FORMAT);
         }
 
-        String encoding = DEFAULT_ENCODING;
-        Matcher m = CHARSET_PATTERN.matcher(contentType);
-        if (StringUtils.isNotBlank(contentType) && m.find()) {
-            encoding = m.group(1).trim().toUpperCase();
-        } else {
-            encoding = DEFAULT_ENCODING;
-        }
-
         try {
-            ModelCommons.add(triples, fix(in, encoding), resourceUri, format, new Predicate<Statement>() {
+            if (DEFAULT_RDF_FORMAT.equals(format)) {
+                String encoding;
+                Matcher m = CHARSET_PATTERN.matcher(contentType);
+                if (StringUtils.isNotBlank(contentType) && m.find()) {
+                    encoding = m.group(1).trim().toUpperCase();
+                } else {
+                    encoding = DEFAULT_ENCODING;
+                }
+                in = fix(in, encoding);
+            }
+            ModelCommons.add(triples, in, resourceUri, format, new Predicate<Statement>() {
                 @Override
                 public boolean test(Statement param) {
                     return StringUtils.equals(param.getSubject().stringValue(), resourceUri);