clerezza-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From m...@apache.org
Subject git commit: CLEREZZA-945: Convert Timestamp to TypedLiteral
Date Tue, 12 Aug 2014 07:57:53 GMT
Repository: clerezza
Updated Branches:
  refs/heads/master 47495f25b -> 70b63d940


CLEREZZA-945: Convert Timestamp to TypedLiteral


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

Branch: refs/heads/master
Commit: 70b63d940ec9ffb0b325eb5fc6c5edfa362961ca
Parents: 47495f2
Author: Minto van der Sluis <misl@apache.org>
Authored: Tue Aug 12 09:57:16 2014 +0200
Committer: Minto van der Sluis <misl@apache.org>
Committed: Tue Aug 12 09:57:16 2014 +0200

----------------------------------------------------------------------
 .../clerezza/rdf/virtuoso/storage/access/DataAccess.java      | 7 +++++++
 1 file changed, 7 insertions(+)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/clerezza/blob/70b63d94/rdf.virtuoso.storage/src/main/java/org/apache/clerezza/rdf/virtuoso/storage/access/DataAccess.java
----------------------------------------------------------------------
diff --git a/rdf.virtuoso.storage/src/main/java/org/apache/clerezza/rdf/virtuoso/storage/access/DataAccess.java
b/rdf.virtuoso.storage/src/main/java/org/apache/clerezza/rdf/virtuoso/storage/access/DataAccess.java
index 8b87ea5..f44a9c1 100644
--- a/rdf.virtuoso.storage/src/main/java/org/apache/clerezza/rdf/virtuoso/storage/access/DataAccess.java
+++ b/rdf.virtuoso.storage/src/main/java/org/apache/clerezza/rdf/virtuoso/storage/access/DataAccess.java
@@ -25,6 +25,8 @@ import java.sql.PreparedStatement;
 import java.sql.ResultSet;
 import java.sql.SQLException;
 import java.sql.Statement;
+import java.sql.Timestamp;
+import java.text.SimpleDateFormat;
 import java.util.ArrayList;
 import java.util.Arrays;
 import java.util.Collection;
@@ -108,6 +110,9 @@ public class DataAccess {
 	private final static UriRef XMLLiteral = new UriRef("http://www.w3.org/1999/02/22-rdf-syntax-ns#XMLLiteral");
 	private final static UriRef XMLLiteralShadowed = new UriRef("urn:x-clerezza:rdf#XMLLiteral");
 	
+	private final static UriRef XMLType_Timestamp = new UriRef("http://www.w3.org/2001/XMLSchema#dateTime");
+	private static final SimpleDateFormat ISO8601FORMAT = new SimpleDateFormat("yyyy-MM-dd'T'HH:mm:ssZ"
);
+	
 	private final static String ASK_COLUMNNAME = "__ask_retval";  
 	
 	/**
@@ -897,6 +902,8 @@ public class DataAccess {
 					}
 				}
 			}
+		} else if (o instanceof Timestamp) {
+			return new TypedLiteralImpl(ISO8601FORMAT.format(Timestamp.class.cast(o)),XMLType_Timestamp);
 		} else if (o == null) {
 			// Raise an exception
 			throw new IllegalStateException("Object cannot be NULL!");


Mime
View raw message