You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@marmotta.apache.org by ss...@apache.org on 2014/02/04 12:03:16 UTC

git commit: - try being more liberal with calendar formats

Updated Branches:
  refs/heads/develop c2bea53f1 -> a7fe31d9b


- try being more liberal with calendar formats


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

Branch: refs/heads/develop
Commit: a7fe31d9b7af32ce52e01a58a3dde21b390fa89c
Parents: c2bea53
Author: Sebastian Schaffert <ss...@apache.org>
Authored: Tue Feb 4 12:03:11 2014 +0100
Committer: Sebastian Schaffert <ss...@apache.org>
Committed: Tue Feb 4 12:03:11 2014 +0100

----------------------------------------------------------------------
 .../org/apache/marmotta/kiwi/model/rdf/KiWiLiteral.java     | 9 ++++++++-
 1 file changed, 8 insertions(+), 1 deletion(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/marmotta/blob/a7fe31d9/libraries/kiwi/kiwi-triplestore/src/main/java/org/apache/marmotta/kiwi/model/rdf/KiWiLiteral.java
----------------------------------------------------------------------
diff --git a/libraries/kiwi/kiwi-triplestore/src/main/java/org/apache/marmotta/kiwi/model/rdf/KiWiLiteral.java b/libraries/kiwi/kiwi-triplestore/src/main/java/org/apache/marmotta/kiwi/model/rdf/KiWiLiteral.java
index ee2c0a1..e39cf09 100644
--- a/libraries/kiwi/kiwi-triplestore/src/main/java/org/apache/marmotta/kiwi/model/rdf/KiWiLiteral.java
+++ b/libraries/kiwi/kiwi-triplestore/src/main/java/org/apache/marmotta/kiwi/model/rdf/KiWiLiteral.java
@@ -18,6 +18,7 @@
 package org.apache.marmotta.kiwi.model.rdf;
 
 import org.apache.marmotta.commons.sesame.model.Namespaces;
+import org.apache.marmotta.commons.util.DateUtils;
 import org.openrdf.model.Literal;
 import org.openrdf.model.URI;
 import org.openrdf.model.datatypes.XMLDatatypeUtil;
@@ -350,7 +351,13 @@ public abstract class KiWiLiteral extends KiWiNode implements Literal {
      */
     @Override
     public XMLGregorianCalendar calendarValue() {
-        return XMLDatatypeUtil.parseCalendar(getLabel());
+        try {
+            return XMLDatatypeUtil.parseCalendar(getLabel());
+        } catch(IllegalArgumentException ex) {
+            // try harder to parse the label, sometimes they have stupid formats ...
+            Date cv = DateUtils.parseDate(getLabel());
+            return DateUtils.getXMLCalendar(cv);
+        }
     }
 
     /**