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/06/13 10:58:03 UTC

[043/100] [abbrv] [partial] Reverting the erroneous merge by Sebastian according to the instructions in INFRA-6876

http://git-wip-us.apache.org/repos/asf/marmotta/blob/582abb5b/commons/marmotta-commons/src/main/java/org/apache/marmotta/commons/util/DateUtils.java
----------------------------------------------------------------------
diff --git a/commons/marmotta-commons/src/main/java/org/apache/marmotta/commons/util/DateUtils.java b/commons/marmotta-commons/src/main/java/org/apache/marmotta/commons/util/DateUtils.java
index d19f2a5..044cdb5 100644
--- a/commons/marmotta-commons/src/main/java/org/apache/marmotta/commons/util/DateUtils.java
+++ b/commons/marmotta-commons/src/main/java/org/apache/marmotta/commons/util/DateUtils.java
@@ -37,21 +37,15 @@ import java.util.TimeZone;
 public class DateUtils {
 
 
-    public static final SimpleDateFormat ISO8601FORMAT = new SimpleDateFormat("yyyy-MM-dd'T'HH:mm:ss.SSS'Z'");
+    public static final SimpleDateFormat ISO8601FORMAT = createDateFormat("yyyy-MM-dd'T'HH:mm:ss.SSS'Z'", "UTC");
 
-    public static final SimpleDateFormat ISO8601FORMAT_TIME = new SimpleDateFormat("HH:mm:ss.SSS'Z'");
-    public static final SimpleDateFormat ISO8601FORMAT_DATE  = new SimpleDateFormat("yyyy-MM-dd");
+    public static final SimpleDateFormat ISO8601FORMAT_TIME = createDateFormat("HH:mm:ss.SSS'Z'", "UTC");
+    public static final SimpleDateFormat ISO8601FORMAT_DATE  = createDateFormat("yyyy-MM-dd", "UTC");
 
-    public static final SimpleDateFormat FILENAME_FORMAT     = new SimpleDateFormat("yyyyMMdd-HHmmss");
+    public static final SimpleDateFormat FILENAME_FORMAT     = createDateFormat("yyyyMMdd-HHmmss", null);
 
 
-    public static final SimpleDateFormat GMTFORMAT = new SimpleDateFormat("EEE, dd MMM yyyy HH:mm:ss z", new DateFormatSymbols(Locale.US));
-    static {
-        ISO8601FORMAT.setTimeZone(TimeZone.getTimeZone("UTC"));
-        ISO8601FORMAT_TIME.setTimeZone(TimeZone.getTimeZone("UTC"));
-        ISO8601FORMAT_DATE.setTimeZone(TimeZone.getTimeZone("UTC"));
-        GMTFORMAT.setTimeZone(TimeZone.getTimeZone("GMT"));
-    }
+    public static final SimpleDateFormat GMTFORMAT = createDateFormat("EEE, dd MMM yyyy HH:mm:ss z", "GMT");
 
     /**
      * Some parsers will have the date as a ISO-8601 string
@@ -62,29 +56,36 @@ public class DateUtils {
      *  property.
      */
     private static final DateFormat[] iso8601InputFormats = new DateFormat[] {
-        // GMT
-        createDateFormat("EEE, dd MMM yyyy HH:mm:ss'Z'","GMT"),
-        GMTFORMAT,
 
         // yyyy-mm-ddThh...
-        createDateFormat("yyyy-MM-dd'T'HH:mm:ss.SSSZ",null),
-        createDateFormat("yyyy-MM-dd'T'HH:mm:ss'Z'", "UTF"),
+        ISO8601FORMAT,
+        createDateFormat("yyyy-MM-dd'T'HH:mm:ss.SSSZ", null),
+        createDateFormat("yyyy-MM-dd'T'HH:mm:ss'Z'", "UTC"),
         createDateFormat("yyyy-MM-dd'T'HH:mm:ssZ", null),    // With timezone
         createDateFormat("yyyy-MM-dd'T'HH:mm:ss", null),     // Without timezone
         // yyyy-mm-dd hh...
-        createDateFormat("yyyy-MM-dd' 'HH:mm:ss'Z'", "UTF"), // UTC/Zulu
+        createDateFormat("yyyy-MM-dd' 'HH:mm:ss'Z'", "UTC"), // UTC/Zulu
         createDateFormat("yyyy-MM-dd' 'HH:mm:ssZ", null),    // With timezone
         createDateFormat("yyyy-MM-dd' 'HH:mm:ss.SZ", null),    // With timezone
         createDateFormat("yyyy-MM-dd' 'HH:mm:ss", null),     // Without timezone
+        
+        // GMT
+        GMTFORMAT,
+        createDateFormat("EEE, dd MMM yyyy HH:mm:ss'Z'", "GMT"),
+        
+        // Some more date formats
         createDateFormat("EEE MMM dd HH:mm:ss z yyyy", null),     // Word documents
         createDateFormat("EEE MMM d HH:mm:ss z yyyy", null),     // Word documents
         createDateFormat("dd.MM.yyy' 'HH:mm:ss", null),     // German
         createDateFormat("dd.MM.yyy' 'HH:mm", null),     // German
+        
+        // SES-711 (see https://openrdf.atlassian.net/browse/SES-711)
+        ISO8601FORMAT_DATE,
     };
 
-    private static DateFormat createDateFormat(String format, String timezone) {
+    private static SimpleDateFormat createDateFormat(String format, String timezone) {
         SimpleDateFormat sdf =
-                new SimpleDateFormat(format, new DateFormatSymbols(Locale.US));
+                new SimpleDateFormat(format, DateFormatSymbols.getInstance(Locale.US));
         if (timezone != null) {
             sdf.setTimeZone(TimeZone.getTimeZone(timezone));
         }

http://git-wip-us.apache.org/repos/asf/marmotta/blob/582abb5b/commons/marmotta-commons/src/main/java/org/apache/marmotta/commons/vocabulary/XSD.java
----------------------------------------------------------------------
diff --git a/commons/marmotta-commons/src/main/java/org/apache/marmotta/commons/vocabulary/XSD.java b/commons/marmotta-commons/src/main/java/org/apache/marmotta/commons/vocabulary/XSD.java
new file mode 100644
index 0000000..4d42298
--- /dev/null
+++ b/commons/marmotta-commons/src/main/java/org/apache/marmotta/commons/vocabulary/XSD.java
@@ -0,0 +1,325 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.apache.marmotta.commons.vocabulary;
+
+import org.openrdf.model.URI;
+import org.openrdf.model.ValueFactory;
+import org.openrdf.model.impl.ValueFactoryImpl;
+
+/**
+ * XSD Datatypes
+ */
+public class XSD {
+    public static final String NAMESPACE = "http://www.w3.org/2001/XMLSchema#";
+    public static final String PREFIX = "xsd";
+
+    /**
+     * {@code http://www.w3.org/2001/XMLSchema#anyURI}.
+     * <br>
+     * anyURI represents an Internationalized Resource Identifier Reference (IRI). An anyURI value can be absolute or relative and may have an optional fragment identifier (i.e. it may be an IRI Reference). This type should be used when the value fulfills the role of an IRI as defined in RFC 3987 or its successor(s) in the IETF Standards Track.
+     */
+    public static final URI AnyURI;
+
+    /**
+     * {@code http://www.w3.org/2001/XMLSchema#base64Binary}.
+     * <br>
+     * base64Binary represents arbitrary Base64-encoded binary data. For base64Binary data the entire binary stream is encoded using the Base64 Encoding defined in RFC 3548 which is derived from the encoding described in RFC 2045.
+     */
+    public static final URI Base64Binary;
+
+    /**
+     * {@code http://www.w3.org/2001/XMLSchema#boolean}.
+     * <br>
+     * boolean represents the values of two-valued logic.
+     */
+    public static final URI Boolean;
+
+    /**
+     * {@code http://www.w3.org/2001/XMLSchema#byte}.
+     * <br>
+     * byte is derived from short by setting the value of maxInclusive to be 127 and minInclusive to be -128. The base type of byte is short.
+     */
+    public static final URI Byte;
+
+    /**
+     * {@code http://www.w3.org/2001/XMLSchema#date}.
+     * <br>
+     * date represents top-open intervals of exactly one day in length on the timelines of dateTime beginning on the beginning moment of each day up to but not including the beginning moment of the next day). For non-timezoned values the top-open intervals disjointly cover the non-timezoned timeline one per day. For timezoned values the intervals begin at every minute and therefore overlap.
+     */
+    public static final URI Date;
+
+    /**
+     * {@code http://www.w3.org/2001/XMLSchema#dateTime}.
+     * <br>
+     * dateTime represents instants of time optionally marked with a particular time zone offset. Values representing the same instant but having different time zone offsets are equal but not identical.
+     */
+    public static final URI DateTime;
+
+    /**
+     * {@code http://www.w3.org/2001/XMLSchema#dateTimeStamp}.
+     * <br>
+     * The dateTimeStamp datatype is derived from dateTime by giving the value required to its explicitTimezone facet.
+     */
+    public static final URI DateTimeStamp;
+
+    /**
+     * {@code http://www.w3.org/2001/XMLSchema#dayTimeDuration}.
+     * <br>
+     * dayTimeDuration is a datatype derived from duration by restricting its lexical representations to instances of dayTimeDurationLexicalRep.
+     */
+    public static final URI DayTimeDuration;
+
+    /**
+     * {@code http://www.w3.org/2001/XMLSchema#decimal}.
+     * <br>
+     * decimal represents a subset of the real numbers which can be represented by decimal numerals. The value space of decimal is the set of numbers that can be obtained by dividing an integer by a non-negative power of ten i.e. expressible as i10n where i and n are integers and n0. Precision is not reflected in this value space; the number 2.0 is not distinct from the number 2.00. The order relation on decimal is the order relation on real numbers restricted to this subset.
+     */
+    public static final URI Decimal;
+
+    /**
+     * {@code http://www.w3.org/2001/XMLSchema#double}.
+     * <br>
+     * The double datatype is patterned after the IEEE double-precision 64-bit floating point datatype IEEE 754-2008.
+     */
+    public static final URI Double;
+
+    /**
+     * {@code http://www.w3.org/2001/XMLSchema#duration}.
+     * <br>
+     * duration is a datatype that represents durations of time.
+     */
+    public static final URI Duration;
+
+    /**
+     * {@code http://www.w3.org/2001/XMLSchema#float}.
+     * <br>
+     * The float datatype is patterned after the IEEE single-precision 32-bit floating point datatype IEEE 754-2008.
+     */
+    public static final URI Float;
+
+    /**
+     * {@code http://www.w3.org/2001/XMLSchema#gDay}.
+     * <br>
+     * gDay represents whole days within an arbitrary monthdays that recur at the same point in each (Gregorian) month.
+     */
+    public static final URI GDay;
+
+    /**
+     * {@code http://www.w3.org/2001/XMLSchema#gMonth}.
+     * <br>
+     * gMonth represents whole (Gregorian) months within an arbitrary yearmonths that recur at the same point in each year. It might be used for example to say what month annual Thanksgiving celebrations fall in different countries (--11 in the United States --10 in Canada and possibly other months in other countries).
+     */
+    public static final URI GMonth;
+
+    /**
+     * {@code http://www.w3.org/2001/XMLSchema#gMonthDay}.
+     * <br>
+     * gMonthDay represents whole calendar days that recur at the same point in each calendar year or that occur in some arbitrary calendar year. (Obviously days beyond 28 cannot occur in all Februaries; 29 is nonetheless permitted.)
+     */
+    public static final URI GMonthDay;
+
+    /**
+     * {@code http://www.w3.org/2001/XMLSchema#gYear}.
+     * <br>
+     * gYear represents Gregorian calendar years.
+     */
+    public static final URI GYear;
+
+    /**
+     * {@code http://www.w3.org/2001/XMLSchema#gYearMonth}.
+     * <br>
+     * gYearMonth represents specific whole Gregorian months in specific Gregorian years.
+     */
+    public static final URI GYearMonth;
+
+    /**
+     * {@code http://www.w3.org/2001/XMLSchema#hexBinary}.
+     * <br>
+     * hexBinary represents arbitrary hex-encoded binary data.
+     */
+    public static final URI HexBinary;
+
+    /**
+     * {@code http://www.w3.org/2001/XMLSchema#int}.
+     * <br>
+     * int is derived from long by setting the value of maxInclusive to be 2147483647 and minInclusive to be -2147483648. The base type of int is long.
+     */
+    public static final URI Int;
+
+    /**
+     * {@code http://www.w3.org/2001/XMLSchema#integer}.
+     * <br>
+     * integer is derived from decimal by fixing the value of fractionDigits to be 0 and disallowing the trailing decimal point. This results in the standard mathematical concept of the integer numbers. The value space of integer is the infinite set ...-2-1012.... The base type of integer is decimal.
+     */
+    public static final URI Integer;
+
+    /**
+     * {@code http://www.w3.org/2001/XMLSchema#language}.
+     * <br>
+     * language represents formal natural language identifiers as defined by BCP 47 (currently represented by RFC 4646 and RFC 4647) or its successor(s).
+     */
+    public static final URI Language;
+
+    /**
+     * {@code http://www.w3.org/2001/XMLSchema#long}.
+     * <br>
+     * long is derived from integer by setting the value of maxInclusive to be 9223372036854775807 and minInclusive to be -9223372036854775808. The base type of long is integer.
+     */
+    public static final URI Long;
+
+    /**
+     * {@code http://www.w3.org/2001/XMLSchema#negativeInteger}.
+     * <br>
+     * negativeInteger is derived from nonPositiveInteger by setting the value of maxInclusive to be -1. This results in the standard mathematical concept of the negative integers. The value space of negativeInteger is the infinite set ...-2-1. The base type of negativeInteger is nonPositiveInteger.
+     */
+    public static final URI NegativeInteger;
+
+    /**
+     * {@code http://www.w3.org/2001/XMLSchema#nonNegativeInteger}.
+     * <br>
+     * nonNegativeInteger is derived from integer by setting the value of minInclusive to be 0. This results in the standard mathematical concept of the non-negative integers. The value space of nonNegativeInteger is the infinite set 012.... The base type of nonNegativeInteger is integer.
+     */
+    public static final URI NonNegativeInteger;
+
+    /**
+     * {@code http://www.w3.org/2001/XMLSchema#nonPositiveInteger}.
+     * <br>
+     * nonPositiveInteger is derived from integer by setting the value of maxInclusive to be 0. This results in the standard mathematical concept of the non-positive integers. The value space of nonPositiveInteger is the infinite set ...-2-10. The base type of nonPositiveInteger is integer.
+     */
+    public static final URI NonPositiveInteger;
+
+    /**
+     * {@code http://www.w3.org/2001/XMLSchema#normalizedString}.
+     * <br>
+     * normalizedString represents white space normalized strings. The value space of normalizedString is the set of strings that do not contain the carriage return (#xD) line feed (#xA) nor tab (#x9) characters. The lexical space of normalizedString is the set of strings that do not contain the carriage return (#xD) line feed (#xA) nor tab (#x9) characters. The base type of normalizedString is string.
+     */
+    public static final URI NormalizedString;
+
+    /**
+     * {@code http://www.w3.org/2001/XMLSchema#positiveInteger}.
+     * <br>
+     * positiveInteger is derived from nonNegativeInteger by setting the value of minInclusive to be 1. This results in the standard mathematical concept of the positive integer numbers. The value space of positiveInteger is the infinite set 12.... The base type of positiveInteger is nonNegativeInteger.
+     */
+    public static final URI PositiveInteger;
+
+    /**
+     * {@code http://www.w3.org/2001/XMLSchema#short}.
+     * <br>
+     * short is derived from int by setting the value of maxInclusive to be 32767 and minInclusive to be -32768. The base type of short is int.
+     */
+    public static final URI Short;
+
+    /**
+     * {@code http://www.w3.org/2001/XMLSchema#string}.
+     * <br>
+     * The string datatype represents character strings in XML.
+     */
+    public static final URI String;
+
+    /**
+     * {@code http://www.w3.org/2001/XMLSchema#time}.
+     * <br>
+     * time represents instants of time that recur at the same point in each calendar day or that occur in some arbitrary calendar day.
+     */
+    public static final URI Time;
+
+    /**
+     * {@code http://www.w3.org/2001/XMLSchema#token}.
+     * <br>
+     * token represents tokenized strings. The value space of token is the set of strings that do not contain the carriage return (#xD) line feed (#xA) nor tab (#x9) characters that have no leading or trailing spaces (#x20) and that have no internal sequences of two or more spaces. The lexical space of token is the set of strings that do not contain the carriage return (#xD) line feed (#xA) nor tab (#x9) characters that have no leading or trailing spaces (#x20) and that have no internal sequences of two or more spaces. The base type of token is normalizedString.
+     */
+    public static final URI Token;
+
+    /**
+     * {@code http://www.w3.org/2001/XMLSchema#unsignedByte}.
+     * <br>
+     * unsignedByte is derived from unsignedShort by setting the value of maxInclusive to be 255. The base type of unsignedByte is unsignedShort.
+     */
+    public static final URI UnsignedByte;
+
+    /**
+     * {@code http://www.w3.org/2001/XMLSchema#unsignedInt}.
+     * <br>
+     * unsignedInt is derived from unsignedLong by setting the value of maxInclusive to be 4294967295. The base type of unsignedInt is unsignedLong.
+     */
+    public static final URI UnsignedInt;
+
+    /**
+     * {@code http://www.w3.org/2001/XMLSchema#unsignedLong}.
+     * <br>
+     * unsignedLong is derived from nonNegativeInteger by setting the value of maxInclusive to be 18446744073709551615. The base type of unsignedLong is nonNegativeInteger.
+     */
+    public static final URI UnsignedLong;
+
+    /**
+     * {@code http://www.w3.org/2001/XMLSchema#unsignedShort}.
+     * <br>
+     * unsignedShort is derived from unsignedInt by setting the value of maxInclusive to be 65535. The base type of unsignedShort is unsignedInt.
+     */
+    public static final URI UnsignedShort;
+
+    /**
+     * {@code http://www.w3.org/2001/XMLSchema#yearMonthDuration}.
+     * <br>
+     * yearMonthDuration is a datatype derived from duration by restricting its lexical representations to instances of yearMonthDurationLexicalRep.
+     */
+    public static final URI YearMonthDuration;
+
+
+    static {
+        final ValueFactory vf = ValueFactoryImpl.getInstance();
+
+        AnyURI = vf.createURI(NAMESPACE, "anyURI");
+        Base64Binary = vf.createURI(NAMESPACE, "base64Binary");
+        Boolean = vf.createURI(NAMESPACE, "boolean");
+        Byte = vf.createURI(NAMESPACE, "byte");
+        Date = vf.createURI(NAMESPACE, "date");
+        DateTime = vf.createURI(NAMESPACE, "dateTime");
+        DateTimeStamp = vf.createURI(NAMESPACE, "dateTimeStamp");
+        DayTimeDuration = vf.createURI(NAMESPACE, "dayTimeDuration");
+        Decimal = vf.createURI(NAMESPACE, "decimal");
+        Double = vf.createURI(NAMESPACE, "double");
+        Duration = vf.createURI(NAMESPACE, "duration");
+        Float = vf.createURI(NAMESPACE, "float");
+        GDay = vf.createURI(NAMESPACE, "gDay");
+        GMonth = vf.createURI(NAMESPACE, "gMonth");
+        GMonthDay = vf.createURI(NAMESPACE, "gMonthDay");
+        GYear = vf.createURI(NAMESPACE, "gYear");
+        GYearMonth = vf.createURI(NAMESPACE, "gYearMonth");
+        HexBinary = vf.createURI(NAMESPACE, "hexBinary");
+        Int = vf.createURI(NAMESPACE, "int");
+        Integer = vf.createURI(NAMESPACE, "integer");
+        Language = vf.createURI(NAMESPACE, "language");
+        Long = vf.createURI(NAMESPACE, "long");
+        NegativeInteger = vf.createURI(NAMESPACE, "negativeInteger");
+        NonNegativeInteger = vf.createURI(NAMESPACE, "nonNegativeInteger");
+        NonPositiveInteger = vf.createURI(NAMESPACE, "nonPositiveInteger");
+        NormalizedString = vf.createURI(NAMESPACE, "normalizedString");
+        PositiveInteger = vf.createURI(NAMESPACE, "positiveInteger");
+        Short = vf.createURI(NAMESPACE, "short");
+        String = vf.createURI(NAMESPACE, "string");
+        Time = vf.createURI(NAMESPACE, "time");
+        Token = vf.createURI(NAMESPACE, "token");
+        UnsignedByte = vf.createURI(NAMESPACE, "unsignedByte");
+        UnsignedInt = vf.createURI(NAMESPACE, "unsignedInt");
+        UnsignedLong = vf.createURI(NAMESPACE, "unsignedLong");
+        UnsignedShort = vf.createURI(NAMESPACE, "unsignedShort");
+        YearMonthDuration = vf.createURI(NAMESPACE, "yearMonthDuration");
+    }
+
+}

http://git-wip-us.apache.org/repos/asf/marmotta/blob/582abb5b/commons/marmotta-commons/src/main/resources/META-INF/LICENSE
----------------------------------------------------------------------
diff --git a/commons/marmotta-commons/src/main/resources/META-INF/LICENSE b/commons/marmotta-commons/src/main/resources/META-INF/LICENSE
new file mode 100644
index 0000000..8a179ca
--- /dev/null
+++ b/commons/marmotta-commons/src/main/resources/META-INF/LICENSE
@@ -0,0 +1,234 @@
+
+                                 Apache License
+                           Version 2.0, January 2004
+                        http://www.apache.org/licenses/
+
+   TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
+
+   1. Definitions.
+
+      "License" shall mean the terms and conditions for use, reproduction,
+      and distribution as defined by Sections 1 through 9 of this document.
+
+      "Licensor" shall mean the copyright owner or entity authorized by
+      the copyright owner that is granting the License.
+
+      "Legal Entity" shall mean the union of the acting entity and all
+      other entities that control, are controlled by, or are under common
+      control with that entity. For the purposes of this definition,
+      "control" means (i) the power, direct or indirect, to cause the
+      direction or management of such entity, whether by contract or
+      otherwise, or (ii) ownership of fifty percent (50%) or more of the
+      outstanding shares, or (iii) beneficial ownership of such entity.
+
+      "You" (or "Your") shall mean an individual or Legal Entity
+      exercising permissions granted by this License.
+
+      "Source" form shall mean the preferred form for making modifications,
+      including but not limited to software source code, documentation
+      source, and configuration files.
+
+      "Object" form shall mean any form resulting from mechanical
+      transformation or translation of a Source form, including but
+      not limited to compiled object code, generated documentation,
+      and conversions to other media types.
+
+      "Work" shall mean the work of authorship, whether in Source or
+      Object form, made available under the License, as indicated by a
+      copyright notice that is included in or attached to the work
+      (an example is provided in the Appendix below).
+
+      "Derivative Works" shall mean any work, whether in Source or Object
+      form, that is based on (or derived from) the Work and for which the
+      editorial revisions, annotations, elaborations, or other modifications
+      represent, as a whole, an original work of authorship. For the purposes
+      of this License, Derivative Works shall not include works that remain
+      separable from, or merely link (or bind by name) to the interfaces of,
+      the Work and Derivative Works thereof.
+
+      "Contribution" shall mean any work of authorship, including
+      the original version of the Work and any modifications or additions
+      to that Work or Derivative Works thereof, that is intentionally
+      submitted to Licensor for inclusion in the Work by the copyright owner
+      or by an individual or Legal Entity authorized to submit on behalf of
+      the copyright owner. For the purposes of this definition, "submitted"
+      means any form of electronic, verbal, or written communication sent
+      to the Licensor or its representatives, including but not limited to
+      communication on electronic mailing lists, source code control systems,
+      and issue tracking systems that are managed by, or on behalf of, the
+      Licensor for the purpose of discussing and improving the Work, but
+      excluding communication that is conspicuously marked or otherwise
+      designated in writing by the copyright owner as "Not a Contribution."
+
+      "Contributor" shall mean Licensor and any individual or Legal Entity
+      on behalf of whom a Contribution has been received by Licensor and
+      subsequently incorporated within the Work.
+
+   2. Grant of Copyright License. Subject to the terms and conditions of
+      this License, each Contributor hereby grants to You a perpetual,
+      worldwide, non-exclusive, no-charge, royalty-free, irrevocable
+      copyright license to reproduce, prepare Derivative Works of,
+      publicly display, publicly perform, sublicense, and distribute the
+      Work and such Derivative Works in Source or Object form.
+
+   3. Grant of Patent License. Subject to the terms and conditions of
+      this License, each Contributor hereby grants to You a perpetual,
+      worldwide, non-exclusive, no-charge, royalty-free, irrevocable
+      (except as stated in this section) patent license to make, have made,
+      use, offer to sell, sell, import, and otherwise transfer the Work,
+      where such license applies only to those patent claims licensable
+      by such Contributor that are necessarily infringed by their
+      Contribution(s) alone or by combination of their Contribution(s)
+      with the Work to which such Contribution(s) was submitted. If You
+      institute patent litigation against any entity (including a
+      cross-claim or counterclaim in a lawsuit) alleging that the Work
+      or a Contribution incorporated within the Work constitutes direct
+      or contributory patent infringement, then any patent licenses
+      granted to You under this License for that Work shall terminate
+      as of the date such litigation is filed.
+
+   4. Redistribution. You may reproduce and distribute copies of the
+      Work or Derivative Works thereof in any medium, with or without
+      modifications, and in Source or Object form, provided that You
+      meet the following conditions:
+
+      (a) You must give any other recipients of the Work or
+          Derivative Works a copy of this License; and
+
+      (b) You must cause any modified files to carry prominent notices
+          stating that You changed the files; and
+
+      (c) You must retain, in the Source form of any Derivative Works
+          that You distribute, all copyright, patent, trademark, and
+          attribution notices from the Source form of the Work,
+          excluding those notices that do not pertain to any part of
+          the Derivative Works; and
+
+      (d) If the Work includes a "NOTICE" text file as part of its
+          distribution, then any Derivative Works that You distribute must
+          include a readable copy of the attribution notices contained
+          within such NOTICE file, excluding those notices that do not
+          pertain to any part of the Derivative Works, in at least one
+          of the following places: within a NOTICE text file distributed
+          as part of the Derivative Works; within the Source form or
+          documentation, if provided along with the Derivative Works; or,
+          within a display generated by the Derivative Works, if and
+          wherever such third-party notices normally appear. The contents
+          of the NOTICE file are for informational purposes only and
+          do not modify the License. You may add Your own attribution
+          notices within Derivative Works that You distribute, alongside
+          or as an addendum to the NOTICE text from the Work, provided
+          that such additional attribution notices cannot be construed
+          as modifying the License.
+
+      You may add Your own copyright statement to Your modifications and
+      may provide additional or different license terms and conditions
+      for use, reproduction, or distribution of Your modifications, or
+      for any such Derivative Works as a whole, provided Your use,
+      reproduction, and distribution of the Work otherwise complies with
+      the conditions stated in this License.
+
+   5. Submission of Contributions. Unless You explicitly state otherwise,
+      any Contribution intentionally submitted for inclusion in the Work
+      by You to the Licensor shall be under the terms and conditions of
+      this License, without any additional terms or conditions.
+      Notwithstanding the above, nothing herein shall supersede or modify
+      the terms of any separate license agreement you may have executed
+      with Licensor regarding such Contributions.
+
+   6. Trademarks. This License does not grant permission to use the trade
+      names, trademarks, service marks, or product names of the Licensor,
+      except as required for reasonable and customary use in describing the
+      origin of the Work and reproducing the content of the NOTICE file.
+
+   7. Disclaimer of Warranty. Unless required by applicable law or
+      agreed to in writing, Licensor provides the Work (and each
+      Contributor provides its Contributions) on an "AS IS" BASIS,
+      WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
+      implied, including, without limitation, any warranties or conditions
+      of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
+      PARTICULAR PURPOSE. You are solely responsible for determining the
+      appropriateness of using or redistributing the Work and assume any
+      risks associated with Your exercise of permissions under this License.
+
+   8. Limitation of Liability. In no event and under no legal theory,
+      whether in tort (including negligence), contract, or otherwise,
+      unless required by applicable law (such as deliberate and grossly
+      negligent acts) or agreed to in writing, shall any Contributor be
+      liable to You for damages, including any direct, indirect, special,
+      incidental, or consequential damages of any character arising as a
+      result of this License or out of the use or inability to use the
+      Work (including but not limited to damages for loss of goodwill,
+      work stoppage, computer failure or malfunction, or any and all
+      other commercial damages or losses), even if such Contributor
+      has been advised of the possibility of such damages.
+
+   9. Accepting Warranty or Additional Liability. While redistributing
+      the Work or Derivative Works thereof, You may choose to offer,
+      and charge a fee for, acceptance of support, warranty, indemnity,
+      or other liability obligations and/or rights consistent with this
+      License. However, in accepting such obligations, You may act only
+      on Your own behalf and on Your sole responsibility, not on behalf
+      of any other Contributor, and only if You agree to indemnify,
+      defend, and hold each Contributor harmless for any liability
+      incurred by, or claims asserted against, such Contributor by reason
+      of your accepting any such warranty or additional liability.
+
+   END OF TERMS AND CONDITIONS
+
+   APPENDIX: How to apply the Apache License to your work.
+
+      To apply the Apache License to your work, attach the following
+      boilerplate notice, with the fields enclosed by brackets "[]"
+      replaced with your own identifying information. (Don't include
+      the brackets!)  The text should be enclosed in the appropriate
+      comment syntax for the file format. We also recommend that a
+      file or class name and description of purpose be included on the
+      same "printed page" as the copyright notice for easier
+      identification within third-party archives.
+
+   Copyright [yyyy] [name of copyright owner]
+
+   Licensed under the Apache License, Version 2.0 (the "License");
+   you may not use this file except in compliance with the License.
+   You may obtain a copy of the License at
+
+       http://www.apache.org/licenses/LICENSE-2.0
+
+   Unless required by applicable law or agreed to in writing, software
+   distributed under the License is distributed on an "AS IS" BASIS,
+   WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+   See the License for the specific language governing permissions and
+   limitations under the License.
+
+
+This module includes source code from the Javolution project, licensed under
+BSD license:
+
+   Javolution - Java(tm) Solution for Real-Time and Embedded Systems
+   Copyright (c) 2012, Javolution (http://javolution.org/)
+   All rights reserved.
+
+   Redistribution and use in source and binary forms, with or without
+   modification, are permitted provided that the following conditions are met:
+
+      1. Redistributions of source code must retain the above copyright
+         notice, this list of conditions and the following disclaimer.
+
+      2. Redistributions in binary form must reproduce the above copyright
+         notice, this list of conditions and the following disclaimer in the
+         documentation and/or other materials provided with the distribution.
+
+   THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+   "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+   LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+   A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR
+   CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
+   EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
+   PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
+   PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
+   LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
+   NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
+   SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+
+

http://git-wip-us.apache.org/repos/asf/marmotta/blob/582abb5b/commons/marmotta-commons/src/main/resources/META-INF/NOTICE
----------------------------------------------------------------------
diff --git a/commons/marmotta-commons/src/main/resources/META-INF/NOTICE b/commons/marmotta-commons/src/main/resources/META-INF/NOTICE
new file mode 100644
index 0000000..06ee0eb
--- /dev/null
+++ b/commons/marmotta-commons/src/main/resources/META-INF/NOTICE
@@ -0,0 +1,18 @@
+Apache Marmotta Commons
+Copyright 2012-2013 The Apache Software Foundation
+
+This product includes software developed at
+The Apache Software Foundation (http://www.apache.org/).
+
+Portions of this software were originally based on the following:
+
+    Copyright 2008-2012 Salzburg Research Forschungsgesellschaft mbH
+
+These have been licensed to the Apache Software Foundation under a software grant.
+
+This product also includes some third-party source components:
+
+ * The module commons/marmotta-commons contains a modified and reduced version
+   of the Javolution library. Javolution has copyright (c) 2012, Javolution and
+   is licensed under BSD license. The original source code is available from
+   http://javolution.org

http://git-wip-us.apache.org/repos/asf/marmotta/blob/582abb5b/commons/marmotta-commons/src/test/java/org/apache/marmotta/commons/collections/EquivalenceHashSet2Test.java
----------------------------------------------------------------------
diff --git a/commons/marmotta-commons/src/test/java/org/apache/marmotta/commons/collections/EquivalenceHashSet2Test.java b/commons/marmotta-commons/src/test/java/org/apache/marmotta/commons/collections/EquivalenceHashSet2Test.java
new file mode 100644
index 0000000..185b0be
--- /dev/null
+++ b/commons/marmotta-commons/src/test/java/org/apache/marmotta/commons/collections/EquivalenceHashSet2Test.java
@@ -0,0 +1,62 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.apache.marmotta.commons.collections;
+
+import com.google.common.base.Equivalence;
+import javolution.util.FastSet;
+import javolution.util.function.Equality;
+
+import java.util.Set;
+
+/**
+ * Add file description here!
+ *
+ * @author Sebastian Schaffert (sschaffert@apache.org)
+ */
+public class EquivalenceHashSet2Test extends EquivalenceHashSetTest {
+
+    @Override
+    public Set<String> createHashSet(final Equivalence<String> equivalence) {
+        return new FastSet<>(new Equality<String>() {
+            @Override
+            public int hashCodeOf(String object) {
+                return equivalence.hash(object);
+            }
+
+            @Override
+            public boolean areEqual(String left, String right) {
+                return equivalence.equivalent(left, right);
+            }
+
+            @Override
+            public int compare(String left, String right) {
+                return equivalence.hash(left) - equivalence.hash(right);
+            }
+
+            @Override
+            public int hashCode() {
+                return equivalence.hashCode();
+            }
+
+            @Override
+            public boolean equals(Object obj) {
+                return obj.hashCode() == hashCode();
+            }
+        });
+    }
+}

http://git-wip-us.apache.org/repos/asf/marmotta/blob/582abb5b/commons/marmotta-commons/src/test/java/org/apache/marmotta/commons/collections/EquivalenceHashSetTest.java
----------------------------------------------------------------------
diff --git a/commons/marmotta-commons/src/test/java/org/apache/marmotta/commons/collections/EquivalenceHashSetTest.java b/commons/marmotta-commons/src/test/java/org/apache/marmotta/commons/collections/EquivalenceHashSetTest.java
new file mode 100644
index 0000000..a01813c
--- /dev/null
+++ b/commons/marmotta-commons/src/test/java/org/apache/marmotta/commons/collections/EquivalenceHashSetTest.java
@@ -0,0 +1,138 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.apache.marmotta.commons.collections;
+
+import com.google.common.base.Equivalence;
+import org.junit.Assert;
+import org.junit.Test;
+
+import java.util.Set;
+
+/**
+ * Add file description here!
+ *
+ * @author Sebastian Schaffert (sschaffert@apache.org)
+ */
+public class EquivalenceHashSetTest {
+
+    // a simple equivalence function on strings, saying they are equal if their first character is the same
+    Equivalence<String> equivalence = new Equivalence<String>() {
+        @Override
+        protected boolean doEquivalent(String a, String b) {
+            return a.charAt(0) == b.charAt(0);
+        }
+
+        @Override
+        protected int doHash(String s) {
+            return s.charAt(0) * 31;
+        }
+    };
+
+    public Set<String> createHashSet(Equivalence<String> equivalence) {
+        return new EquivalenceHashSet<>(equivalence);
+    }
+
+    @Test
+    public void testEquivalence() {
+        Assert.assertTrue(equivalence.equivalent("abc","axy"));
+        Assert.assertFalse(equivalence.equivalent("abc", "xyz"));
+
+        Assert.assertTrue(equivalence.hash("abc") == equivalence.hash("axy"));
+        Assert.assertFalse(equivalence.hash("abc") == equivalence.hash("xyz"));
+    }
+
+    @Test
+    public void testSetContains() {
+        String a = "abc";
+        String b = "axy";
+        String c = "xyz";
+
+        Set<String> set = createHashSet(equivalence);
+        set.add(a);
+
+        // set should now also contain b (because first character the same)
+        Assert.assertTrue(set.contains(b));
+
+        set.add(b);
+
+        // adding b should not change the set
+        Assert.assertEquals(1, set.size());
+
+        set.add(c);
+
+        Assert.assertEquals(2, set.size());
+
+    }
+
+
+    @Test
+    public void testSetEquals() {
+        String a1 = "abc";
+        String a2 = "axy";
+        String b1 = "bcd";
+        String b2 = "bxy";
+        String c1 = "cde";
+
+        Set<String> set1 = createHashSet(equivalence);
+        Set<String> set2 = createHashSet(equivalence);
+
+        // test empty sets
+        Assert.assertEquals(set1,set2);
+
+        set1.add(a1);
+        set1.add(b1);
+
+        set2.add(b2);
+        set2.add(a2);
+
+
+        Assert.assertEquals(2, set1.size());
+        Assert.assertEquals(2, set2.size());
+
+
+        // test sets with elements, insertion order different
+        Assert.assertEquals(set1,set2);
+        Assert.assertEquals(set1.hashCode(), set2.hashCode());
+
+        set1.add(c1);
+
+        Assert.assertNotEquals(set1,set2);
+        Assert.assertNotEquals(set1.hashCode(), set2.hashCode());
+
+
+    }
+
+    @Test
+    public void testIteration() {
+        String a = "abc";
+        String b = "axy";
+        String c = "xyz";
+
+        Set<String> set = createHashSet(equivalence);
+        set.add(a);
+        set.add(b);
+        set.add(c);
+
+        int count = 0;
+        for(String x : set) {
+            count++;
+        }
+        Assert.assertEquals(2,count);
+    }
+
+}

http://git-wip-us.apache.org/repos/asf/marmotta/blob/582abb5b/commons/marmotta-commons/src/test/java/org/apache/marmotta/commons/sesame/model/LiteralCommonsTest.java
----------------------------------------------------------------------
diff --git a/commons/marmotta-commons/src/test/java/org/apache/marmotta/commons/sesame/model/LiteralCommonsTest.java b/commons/marmotta-commons/src/test/java/org/apache/marmotta/commons/sesame/model/LiteralCommonsTest.java
index 9cad20a..4ac7a06 100644
--- a/commons/marmotta-commons/src/test/java/org/apache/marmotta/commons/sesame/model/LiteralCommonsTest.java
+++ b/commons/marmotta-commons/src/test/java/org/apache/marmotta/commons/sesame/model/LiteralCommonsTest.java
@@ -17,7 +17,7 @@
  */
 package org.apache.marmotta.commons.sesame.model;
 
-import org.apache.commons.lang.RandomStringUtils;
+import org.apache.commons.lang3.RandomStringUtils;
 import org.apache.marmotta.commons.sesame.model.LiteralCommons;
 import org.apache.marmotta.commons.sesame.model.Namespaces;
 import org.apache.marmotta.commons.util.DateUtils;
@@ -26,6 +26,8 @@ import org.junit.Test;
 import org.openrdf.model.Literal;
 import org.openrdf.model.URI;
 import org.openrdf.model.ValueFactory;
+import org.openrdf.model.vocabulary.RDF;
+import org.openrdf.model.vocabulary.XMLSchema;
 import org.openrdf.repository.Repository;
 import org.openrdf.repository.sail.SailRepository;
 import org.openrdf.sail.memory.MemoryStore;
@@ -101,37 +103,38 @@ public class LiteralCommonsTest {
     public void testGetXSDType() {
 
         // String
-        Assert.assertEquals(Namespaces.NS_XSD + "string" , LiteralCommons.getXSDType(String.class));
+        Assert.assertEquals(XMLSchema.STRING.stringValue() , LiteralCommons.getXSDType(String.class));
 
         // int and Integer
-        Assert.assertEquals(Namespaces.NS_XSD + "integer", LiteralCommons.getXSDType(int.class));
-        Assert.assertEquals(Namespaces.NS_XSD + "integer", LiteralCommons.getXSDType(Integer.class));
+        Assert.assertEquals(XMLSchema.INTEGER.stringValue(), LiteralCommons.getXSDType(int.class));
+        Assert.assertEquals(XMLSchema.INTEGER.stringValue(), LiteralCommons.getXSDType(Integer.class));
 
 
         // long and Long
-        Assert.assertEquals(Namespaces.NS_XSD + "long", LiteralCommons.getXSDType(long.class));
-        Assert.assertEquals(Namespaces.NS_XSD + "long", LiteralCommons.getXSDType(Long.class));
+        Assert.assertEquals(XMLSchema.LONG.stringValue(), LiteralCommons.getXSDType(long.class));
+        Assert.assertEquals(XMLSchema.LONG.stringValue(), LiteralCommons.getXSDType(Long.class));
 
         // double and Double
-        Assert.assertEquals(Namespaces.NS_XSD + "double", LiteralCommons.getXSDType(double.class));
-        Assert.assertEquals(Namespaces.NS_XSD + "double", LiteralCommons.getXSDType(Double.class));
+        Assert.assertEquals(XMLSchema.DOUBLE.stringValue(), LiteralCommons.getXSDType(double.class));
+        Assert.assertEquals(XMLSchema.DOUBLE.stringValue(), LiteralCommons.getXSDType(Double.class));
 
         // float and Float
-        Assert.assertEquals(Namespaces.NS_XSD + "float", LiteralCommons.getXSDType(float.class));
-        Assert.assertEquals(Namespaces.NS_XSD + "float", LiteralCommons.getXSDType(Float.class));
+        Assert.assertEquals(XMLSchema.FLOAT.stringValue(), LiteralCommons.getXSDType(float.class));
+        Assert.assertEquals(XMLSchema.FLOAT.stringValue(), LiteralCommons.getXSDType(Float.class));
 
 
         // boolean and Boolean
-        Assert.assertEquals(Namespaces.NS_XSD + "boolean", LiteralCommons.getXSDType(boolean.class));
-        Assert.assertEquals(Namespaces.NS_XSD + "boolean", LiteralCommons.getXSDType(Boolean.class));
+        Assert.assertEquals(XMLSchema.BOOLEAN.stringValue(), LiteralCommons.getXSDType(boolean.class));
+        Assert.assertEquals(XMLSchema.BOOLEAN.stringValue(), LiteralCommons.getXSDType(Boolean.class));
 
 
         // Date
-        Assert.assertEquals(Namespaces.NS_XSD + "dateTime", LiteralCommons.getXSDType(Date.class));
+        Assert.assertEquals(XMLSchema.DATETIME.stringValue(), LiteralCommons.getXSDType(Date.class));
 
     }
     
+    @Test
     public void testGetRDFLangStringType() throws Exception {
-    	Assert.assertEquals(Namespaces.NS_RDF+ "langString", LiteralCommons.getRDFLangStringType());
+    	Assert.assertEquals(RDF.LANGSTRING.stringValue(), LiteralCommons.getRDFLangStringType());
 	}
 }

http://git-wip-us.apache.org/repos/asf/marmotta/blob/582abb5b/commons/marmotta-commons/src/test/java/org/apache/marmotta/commons/sesame/model/StatementCommonsTest.java
----------------------------------------------------------------------
diff --git a/commons/marmotta-commons/src/test/java/org/apache/marmotta/commons/sesame/model/StatementCommonsTest.java b/commons/marmotta-commons/src/test/java/org/apache/marmotta/commons/sesame/model/StatementCommonsTest.java
new file mode 100644
index 0000000..5e286ba
--- /dev/null
+++ b/commons/marmotta-commons/src/test/java/org/apache/marmotta/commons/sesame/model/StatementCommonsTest.java
@@ -0,0 +1,225 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.apache.marmotta.commons.sesame.model;
+
+import com.google.common.base.Equivalence;
+import org.apache.commons.lang3.RandomStringUtils;
+import org.junit.Assert;
+import org.junit.Before;
+import org.junit.Test;
+import org.openrdf.model.*;
+import org.openrdf.model.impl.ValueFactoryImpl;
+
+import java.util.*;
+
+/**
+ * Add file description here!
+ *
+ * @author Sebastian Schaffert (sschaffert@apache.org)
+ */
+public class StatementCommonsTest {
+
+    protected static Random rnd = new Random();
+
+
+    Statement stmt1, stmt2, stmt3, stmt4;
+
+    ValueFactory valueFactory;
+
+    @Before
+    public void setup() {
+        valueFactory = new ValueFactoryImpl();
+
+        Resource s1 = randomURI();
+        URI p1 = randomURI();
+        URI p2 = randomURI();
+        Value o1 = randomObject();
+        Resource c1 = randomURI();
+        Resource c2 = randomURI();
+
+
+        stmt1 = valueFactory.createStatement(s1,p1,o1,c1);
+        stmt2 = valueFactory.createStatement(s1,p1,o1,c2);
+        stmt3 = valueFactory.createStatement(s1,p2,o1,c1);
+        stmt4 = valueFactory.createStatement(s1,p1,o1,c1);
+    }
+
+
+    @Test
+    public void testTripleEquivalence() {
+        Equivalence<Statement> e = StatementCommons.tripleEquivalence();
+
+        Assert.assertTrue(e.equivalent(stmt1,stmt2));
+        Assert.assertTrue(e.equivalent(stmt1,stmt4));
+        Assert.assertFalse(e.equivalent(stmt1,stmt3));
+    }
+
+    @Test
+    public void testQuadrupleEquivalence() {
+        Equivalence<Statement> e = StatementCommons.tripleEquivalence();
+
+        Assert.assertTrue(e.equivalent(stmt1,stmt2));
+        Assert.assertTrue(e.equivalent(stmt1,stmt4));
+        Assert.assertFalse(e.equivalent(stmt1,stmt3));
+    }
+
+    @Test
+    public void testTripleSet() {
+        Set<Statement> set = StatementCommons.newTripleSet();
+
+        set.add(stmt1);
+
+        // triple 2 just has different context, so should be contained already
+        Assert.assertTrue(set.contains(stmt2));
+
+        // adding triple 2 should not change size
+        set.add(stmt2);
+
+        Assert.assertEquals(1,set.size());
+
+        // statement 3 is different, so not contained and size increased
+        Assert.assertFalse(set.contains(stmt3));
+
+        set.add(stmt3);
+
+        Assert.assertEquals(2,set.size());
+
+    }
+
+    @Test
+    public void testQuadrupleSet() {
+        Set<Statement> set = StatementCommons.newQuadrupleSet();
+
+        set.add(stmt1);
+
+        // triple 2 has different context, so should not be contained already
+        Assert.assertFalse(set.contains(stmt2));
+
+        // adding triple 2 should change size
+        set.add(stmt2);
+
+        Assert.assertEquals(2,set.size());
+
+        // statement 3 is different, so not contained and size increased
+        Assert.assertFalse(set.contains(stmt3));
+
+        set.add(stmt3);
+
+        Assert.assertEquals(3,set.size());
+
+    }
+
+
+    @Test
+    public void testTripleMap() {
+        Map<Statement, String> map = StatementCommons.newTripleMap();
+
+        String s1 = RandomStringUtils.random(8);
+        String s2 = RandomStringUtils.random(8);
+        String s3 = RandomStringUtils.random(8);
+
+        map.put(stmt1, s1);
+
+        // triple 2 just has different context, so should be contained already
+        Assert.assertEquals(s1, map.get(stmt2));
+
+        // adding triple 2 should not change size
+        map.put(stmt2,s2);
+
+        Assert.assertEquals(1, map.size());
+
+        // value now replaced?
+        Assert.assertEquals(s2, map.get(stmt1));
+
+        // statement 3 is different, so not contained and size increased
+        Assert.assertFalse(map.containsKey(stmt3));
+
+        map.put(stmt3,s3);
+
+        Assert.assertEquals(2, map.size());
+
+    }
+
+    @Test
+    public void testQuadrupleMap() {
+        Map<Statement, String> map = StatementCommons.newQuadrupleMap();
+
+        String s1 = RandomStringUtils.random(8);
+        String s2 = RandomStringUtils.random(8);
+        String s3 = RandomStringUtils.random(8);
+
+        map.put(stmt1, s1);
+
+        // triple 2 just has different context, so should be contained already
+        Assert.assertNotEquals(s1, map.get(stmt2));
+
+        // adding triple 2 should change size
+        map.put(stmt2,s2);
+
+        Assert.assertEquals(2, map.size());
+
+        // value not replaced?
+        Assert.assertEquals(s1, map.get(stmt1));
+
+        // statement 3 is different, so not contained and size increased
+        Assert.assertFalse(map.containsKey(stmt3));
+
+        map.put(stmt3,s3);
+
+        Assert.assertEquals(3, map.size());
+
+    }
+
+
+    /**
+     * Return a random URI, with a 10% chance of returning a URI that has already been used.
+     * @return
+     */
+    protected URI randomURI() {
+        URI resource = valueFactory.createURI("http://localhost/" + RandomStringUtils.randomAlphanumeric(8));
+        return resource;
+    }
+
+    /**
+     * Return a random RDF value, either a reused object (10% chance) or of any other kind.
+     * @return
+     */
+    protected Value randomObject() {
+        Value object;
+        switch(rnd.nextInt(6)) {
+            case 0: object = valueFactory.createURI("http://localhost/" + RandomStringUtils.randomAlphanumeric(8));
+                break;
+            case 1: object = valueFactory.createBNode();
+                break;
+            case 2: object = valueFactory.createLiteral(RandomStringUtils.randomAscii(40));
+                break;
+            case 3: object = valueFactory.createLiteral(rnd.nextInt());
+                break;
+            case 4: object = valueFactory.createLiteral(rnd.nextDouble());
+                break;
+            case 5: object = valueFactory.createLiteral(rnd.nextBoolean());
+                break;
+            default: object = valueFactory.createURI("http://localhost/" + RandomStringUtils.randomAlphanumeric(8));
+                break;
+
+        }
+        return object;
+
+
+    }
+}

http://git-wip-us.apache.org/repos/asf/marmotta/blob/582abb5b/commons/marmotta-commons/src/test/java/org/apache/marmotta/commons/util/DateUtilsTest.java
----------------------------------------------------------------------
diff --git a/commons/marmotta-commons/src/test/java/org/apache/marmotta/commons/util/DateUtilsTest.java b/commons/marmotta-commons/src/test/java/org/apache/marmotta/commons/util/DateUtilsTest.java
new file mode 100644
index 0000000..53b52a2
--- /dev/null
+++ b/commons/marmotta-commons/src/test/java/org/apache/marmotta/commons/util/DateUtilsTest.java
@@ -0,0 +1,44 @@
+/**
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.marmotta.commons.util;
+
+import java.util.Date;
+
+import org.junit.Assert;
+import org.junit.Test;
+
+/**
+ * Unit-Tests for {@link DateUtils}.
+ */
+public class DateUtilsTest {
+
+    @Test
+    public void testParseIso8601Date() {
+        // MARMOTTA-282
+        Date now = new Date(System.currentTimeMillis());
+        
+        Assert.assertEquals(now, DateUtils.parseDate(DateUtils.ISO8601FORMAT.format(now)));
+    }
+
+    @Test
+    public void testCalendarRoundTrip() {
+        Date now = new Date(System.currentTimeMillis());
+        Assert.assertEquals(now, DateUtils.getDate(DateUtils.getXMLCalendar(now)));
+    }
+
+}

http://git-wip-us.apache.org/repos/asf/marmotta/blob/582abb5b/commons/pom.xml
----------------------------------------------------------------------
diff --git a/commons/pom.xml b/commons/pom.xml
index 05b28bf..06ba1eb 100644
--- a/commons/pom.xml
+++ b/commons/pom.xml
@@ -21,7 +21,7 @@
     <parent>
         <groupId>org.apache.marmotta</groupId>
         <artifactId>marmotta-parent</artifactId>
-        <version>3.1.0-incubating-SNAPSHOT</version>
+        <version>3.1.0-incubating</version>
         <relativePath>../parent</relativePath>
     </parent>
 
@@ -56,8 +56,6 @@
         <module>sesame-filter</module>
         <module>sesame-tools-rio-api</module>
         <module>sesame-tools-rio-ical</module>
-        <module>sesame-tools-rio-jsonld</module>
-        <module>sesame-tools-rio-rdfjson</module>
         <module>sesame-tools-rio-rss</module>
         <module>sesame-tools-rio-vcard</module>
         <module>sesame-tools-facading</module>

http://git-wip-us.apache.org/repos/asf/marmotta/blob/582abb5b/commons/sesame-filter/pom.xml
----------------------------------------------------------------------
diff --git a/commons/sesame-filter/pom.xml b/commons/sesame-filter/pom.xml
index 10c433e..36be4ae 100644
--- a/commons/sesame-filter/pom.xml
+++ b/commons/sesame-filter/pom.xml
@@ -21,7 +21,7 @@
     <parent>
         <groupId>org.apache.marmotta</groupId>
         <artifactId>marmotta-parent</artifactId>
-        <version>3.1.0-incubating-SNAPSHOT</version>
+        <version>3.1.0-incubating</version>
         <relativePath>../../parent</relativePath>
     </parent>
 
@@ -94,8 +94,8 @@
             <scope>test</scope>
         </dependency>
         <dependency>
-            <groupId>commons-lang</groupId>
-            <artifactId>commons-lang</artifactId>
+            <groupId>org.apache.commons</groupId>
+            <artifactId>commons-lang3</artifactId>
             <scope>test</scope>
         </dependency>
 

http://git-wip-us.apache.org/repos/asf/marmotta/blob/582abb5b/commons/sesame-tools-facading/pom.xml
----------------------------------------------------------------------
diff --git a/commons/sesame-tools-facading/pom.xml b/commons/sesame-tools-facading/pom.xml
index 021b47a..9dfd8a5 100644
--- a/commons/sesame-tools-facading/pom.xml
+++ b/commons/sesame-tools-facading/pom.xml
@@ -21,7 +21,7 @@
     <parent>
         <groupId>org.apache.marmotta</groupId>
         <artifactId>marmotta-parent</artifactId>
-        <version>3.1.0-incubating-SNAPSHOT</version>
+        <version>3.1.0-incubating</version>
         <relativePath>../../parent</relativePath>
     </parent>
 
@@ -109,6 +109,17 @@
             <artifactId>slf4j-simple</artifactId>
             <scope>test</scope>
         </dependency>
+        <dependency>
+            <groupId>org.apache.marmotta</groupId>
+            <artifactId>kiwi-triplestore</artifactId>
+            <scope>test</scope>
+        </dependency>
+                <dependency>
+            <groupId>com.h2database</groupId>
+            <artifactId>h2</artifactId>
+            <scope>test</scope>
+        </dependency>
+        
     </dependencies>
 
 </project>

http://git-wip-us.apache.org/repos/asf/marmotta/blob/582abb5b/commons/sesame-tools-facading/src/main/java/org/apache/marmotta/commons/sesame/facading/impl/FacadingImpl.java
----------------------------------------------------------------------
diff --git a/commons/sesame-tools-facading/src/main/java/org/apache/marmotta/commons/sesame/facading/impl/FacadingImpl.java b/commons/sesame-tools-facading/src/main/java/org/apache/marmotta/commons/sesame/facading/impl/FacadingImpl.java
index e10cd13..8cfba98 100644
--- a/commons/sesame-tools-facading/src/main/java/org/apache/marmotta/commons/sesame/facading/impl/FacadingImpl.java
+++ b/commons/sesame-tools-facading/src/main/java/org/apache/marmotta/commons/sesame/facading/impl/FacadingImpl.java
@@ -27,7 +27,6 @@ import org.apache.marmotta.commons.sesame.facading.annotations.RDFType;
 import org.apache.marmotta.commons.sesame.facading.api.Facading;
 import org.apache.marmotta.commons.sesame.facading.model.Facade;
 import org.apache.marmotta.commons.sesame.facading.util.FacadeUtils;
-import org.apache.marmotta.commons.sesame.model.Namespaces;
 import org.openrdf.model.Resource;
 import org.openrdf.model.URI;
 import org.openrdf.repository.RepositoryConnection;
@@ -38,18 +37,19 @@ import org.slf4j.LoggerFactory;
 
 /**
  * Offers methods for loading and proxying Facades. A {@link Facade} is an interface that defines a
- * Java object with convenient Java methods around a KiWiResource and makes it possible to use RDF
+ * Java object with convenient Java methods around a {@link Resource} and makes it possible to use RDF
  * properties like Java Bean properties from inside Java.
  * <p/>
- * The facading service is used by many other services, e.g. ContentItemService and TaggingService,
- * to provide access on a higher level than raw RDF resources.
- * 
- * 
+ * The facading service is to provide access on a higher level than raw RDF resources.
  * <p/>
- * User: Sebastian Schaffert
+ * @author Sebastian Schaffert <ss...@apache.org>
+ * @author Jakob Frank <ja...@apache.org>
  */
 public class FacadingImpl implements Facading {
 
+    private static final URI RDF_TYPE = org.openrdf.model.vocabulary.RDF.TYPE;
+
+
     private static Logger log = LoggerFactory.getLogger(FacadingImpl.class);
 
 
@@ -61,13 +61,13 @@ public class FacadingImpl implements Facading {
     }
 
     /**
-     * Create an instance of C that facades the resource given as argument using the {@link RDF} annotations provided
-     * to the getter or setter methods of Cto map to properties of the resource in the triple store.
+     * Create an instance of {@code C} that facades the resource given as argument using the {@link RDF} annotations provided
+     * to the getter or setter methods of {@code C} to map to properties of the resource in the triple store.
      *
      *
      * @param r    the resource to facade
      * @param type the facade type as a class
-     * @return
+     * @return a facading proxy of type {@code C}
      */
     @Override
     public <C extends Facade> C createFacade(Resource r, Class<C> type) {
@@ -76,57 +76,65 @@ public class FacadingImpl implements Facading {
         if(FacadeUtils.isFacadeAnnotationPresent(type, RDFContext.class)) {
             String s_context = FacadeUtils.getFacadeAnnotation(type,RDFContext.class).value();
             context = connection.getValueFactory().createURI(s_context);
+            log.debug("applying context {} for facade {} of {}", context, type.getSimpleName(), r);
         }
         return createFacade(r, type, context);
     }
 
     /**
-     * Create an instance of C that facades the resource given as argument using the {@link RDF} annotations provided
-     * to the getter or setter methods of Cto map to properties of the resource in the triple store.
+     * Create an instance of {@code C} that facades the resource given as argument using the {@link RDF} annotations provided
+     * to the getter or setter methods of {@code C} to map to properties of the resource in the triple store.
      * Additionally, it puts the facade into the given context, a present {@link RDFContext} annotation is ignored.
      * This is useful if the {@link RDFContext} annotation for Facades is not applicable,
      * e.g. if the context is dynamically generated.
-
-     *
      *
      * @param r       the resource to facade
      * @param type    the facade type as a class
      * @param context the context of the facade
-     * @return
+     * @return a facading proxy of type {@code C}
      */
     @Override
     public <C extends Facade> C createFacade(Resource r, Class<C> type, URI context) {
         if(r == null) {
+            log.trace("null facade for null resouce");
             return null;
-        } else if(type.isInterface()) {
+        } else 
             // if the interface is a Facade, we execute the query and then
             // create an invocation handler for each result to create proxy objects
-            if(FacadeUtils.isFacade(type)) {
+            if(type.isInterface() && FacadeUtils.isFacade(type)) {
                 try {
                     // support @RDFType annotation in facade
-                    if(FacadeUtils.isFacadeAnnotationPresent(type,RDFType.class)) {
-                        String[]        a_type = FacadeUtils.getFacadeAnnotation(type,RDFType.class).value();
+                    if(FacadeUtils.isFacadeAnnotationPresent(type, RDFType.class)) {
+                        if (!connection.isOpen()) { throw new IllegalStateException("the connection is already closed, cannot access triple-store."); }
+                        if (!connection.isActive()) { throw new IllegalStateException("no active transaction, cannot access triple-store."); }
+
+                        String[] a_type = FacadeUtils.getFacadeAnnotation(type, RDFType.class).value();
                         for(String s_type : a_type) {
-                            URI r_type = connection.getValueFactory().createURI(s_type);
-                            URI p_type = connection.getValueFactory().createURI(Namespaces.NS_RDF + "type");
-                            connection.add(r, p_type, r_type, context);
+                            final URI r_type = connection.getValueFactory().createURI(s_type);
+                            connection.add(r, RDF_TYPE, r_type, context);
+                            log.trace("added type {} to {} because of RDFType-Annotation", r_type, r);
+                            if(!connection.hasStatement(r, RDF_TYPE, r_type,true,context)) {
+                                log.error("error adding type for facade!");
+                            }
                         }
                     }
 
-                    FacadingInvocationHandler handler = new FacadingInvocationHandler(r,context,type,this,connection);
-                    return type.cast(Proxy.newProxyInstance(type.getClassLoader(),
-                            new Class[]{type},
-                            handler));
+                    FacadingInvocationHandler handler = new FacadingInvocationHandler(r, context, type, this, connection);
+                    if (log.isDebugEnabled()) {
+                        if (context != null) {
+                            log.debug("New Facading: {} delegating to {} (@{})", type.getSimpleName(), r, context);
+                        } else {
+                            log.debug("New Facading: {} delegating to {}", type.getSimpleName(), r);
+                        }
+                    }
+                    return type.cast(Proxy.newProxyInstance(type.getClassLoader(), new Class[]{type}, handler));
                 } catch (RepositoryException e) {
-                    log.error("error while accessing triple store",e);
+                    log.error("error while accessing triple store", e);
                     return null;
                 }
             } else {
                 throw new IllegalArgumentException("interface passed as parameter is not a Facade (" + type.getCanonicalName() + ")");
             }
-        } else {
-            throw new IllegalArgumentException("interface passed as parameter is not a Facade (" + type.getCanonicalName() + ")");
-        }
     }
 
     /**
@@ -145,6 +153,7 @@ public class FacadingImpl implements Facading {
         if(FacadeUtils.isFacadeAnnotationPresent(type, RDFContext.class)) {
             String s_context = FacadeUtils.getFacadeAnnotation(type,RDFContext.class).value();
             context = connection.getValueFactory().createURI(s_context);
+            log.debug("applying context {} for facade {} of {}", context, type.getSimpleName(), list);
         }
         return createFacade(list, type, context);
     }
@@ -161,11 +170,12 @@ public class FacadingImpl implements Facading {
      */
     @Override
     public <C extends Facade> Collection<C> createFacade(Collection<? extends Resource> list, Class<C> type, URI context) {
-        log.debug("createFacadeList: creating {} facade over {} content items",type.getName(),list.size());
+        log.trace("createFacadeList: creating {} facade over {} content items",type.getName(),list.size());
         LinkedList<C> result = new LinkedList<C>();
         if(type.isAnnotationPresent(RDFFilter.class)) {
             try {
-                final URI p_type = connection.getValueFactory().createURI(Namespaces.NS_RDF + "type");
+                if (!connection.isOpen()) { throw new IllegalStateException("the connection is already closed, cannot access triple-store."); }
+                if (!connection.isActive()) { throw new IllegalStateException("no active transaction, cannot access triple-store."); }
 
                 // if the RDFType annotation is present, filter out content items that are of the wrong type
                 LinkedList<URI> acceptable_types = new LinkedList<URI>();
@@ -181,9 +191,9 @@ public class FacadingImpl implements Facading {
                 for(Resource item : list) {
                     boolean accept = acceptable_types.size() == 0; // true for empty filter
                     for(URI rdf_type : acceptable_types) {
-                        if(connection.hasStatement(item, p_type, rdf_type, true)) {
+                        if(connection.hasStatement(item, RDF_TYPE, rdf_type, true)) {
                             accept = true;
-                            log.debug("accepting resource #0 because type matches (#1)",item.toString(),rdf_type.stringValue());
+                            log.trace("accepting resource {} because type matches ({})",item.toString(),rdf_type.stringValue());
                             break;
                         }
                     }
@@ -191,7 +201,7 @@ public class FacadingImpl implements Facading {
                         result.add(createFacade(item,type,context));
                     }
                 }
-                log.debug("createFacadeList: filtered #0 content items because they did not match the necessary criteria",list.size()-result.size());
+                log.debug("createFacadeList: filtered {} content items because they did not match the necessary criteria",list.size()-result.size());
             } catch (RepositoryException ex) {
                 log.error("error while accessing RDF repository",ex);
             }
@@ -248,18 +258,27 @@ public class FacadingImpl implements Facading {
     public <C extends Facade> boolean isFacadeable(Resource r, Class<C> type, URI context) {
         if (FacadeUtils.isFacadeAnnotationPresent(type, RDFType.class)) {
             try {
-                final URI p_type = connection.getValueFactory().createURI(Namespaces.NS_RDF + "type");
+                if (!connection.isOpen()) { throw new IllegalStateException("the connection is already closed, cannot access triple store."); }
+                if (!connection.isActive()) { throw new IllegalStateException("no active transaction, cannot access triple-store."); }
 
                 String[] rdfTypes = FacadeUtils.getFacadeAnnotation(type, RDFType.class).value();
                 boolean facadeable = true;
                 for (String s_type : rdfTypes) {
-                    facadeable &= connection.hasStatement(r, p_type, connection.getValueFactory().createURI(s_type), true, context);
+                    if(context != null) {
+                        facadeable &= connection.hasStatement(r, RDF_TYPE, connection.getValueFactory().createURI(s_type), true, context);
+                    } else {
+                        facadeable &= connection.hasStatement(r, RDF_TYPE, connection.getValueFactory().createURI(s_type), true);
+                    }
                 }
                 // also check for @RDFFilter
                 if (FacadeUtils.isFacadeAnnotationPresent(type, RDFFilter.class)) {
                     String[] filterTypes = FacadeUtils.getFacadeAnnotation(type, RDFFilter.class).value();
                     for (String s_type : filterTypes) {
-                        facadeable &= connection.hasStatement(r, p_type, connection.getValueFactory().createURI(s_type), true, context);
+                        if(context != null) {
+                            facadeable &= connection.hasStatement(r, RDF_TYPE, connection.getValueFactory().createURI(s_type), true, context);
+                        } else {
+                            facadeable &= connection.hasStatement(r, RDF_TYPE, connection.getValueFactory().createURI(s_type), true);
+                        }
                     }
                 }
                 return facadeable;

http://git-wip-us.apache.org/repos/asf/marmotta/blob/582abb5b/commons/sesame-tools-facading/src/main/java/org/apache/marmotta/commons/sesame/facading/impl/FacadingInvocationHandler.java
----------------------------------------------------------------------
diff --git a/commons/sesame-tools-facading/src/main/java/org/apache/marmotta/commons/sesame/facading/impl/FacadingInvocationHandler.java b/commons/sesame-tools-facading/src/main/java/org/apache/marmotta/commons/sesame/facading/impl/FacadingInvocationHandler.java
index fb3fbcd..fb70791 100644
--- a/commons/sesame-tools-facading/src/main/java/org/apache/marmotta/commons/sesame/facading/impl/FacadingInvocationHandler.java
+++ b/commons/sesame-tools-facading/src/main/java/org/apache/marmotta/commons/sesame/facading/impl/FacadingInvocationHandler.java
@@ -49,7 +49,8 @@ import java.util.*;
  * implementation as parameter. Interfaces that make use of this invocation handler need to extend
  * the {@link Facade} interface.
  * 
- * @author Sebastian Schaffert
+ * @author Sebastian Schaffert <ss...@apache.org>
+ * @author Jakob Frank <ja...@apache.org>
  */
 class FacadingInvocationHandler implements InvocationHandler {
 
@@ -57,7 +58,7 @@ class FacadingInvocationHandler implements InvocationHandler {
         GET(false, 0, "get"),
         SET(true, 1, "set"),
         ADD(true, 1, "add"),
-        DEL(true, 0, "del", "delete", "remove"),
+        DEL(true, 0, "del", "delete", "remove", "rm"),
         HAS(false, 0, "has", "is");
 
 
@@ -129,7 +130,7 @@ class FacadingInvocationHandler implements InvocationHandler {
 
     private final HashMap<String, Object> fieldCache;
 
-    private Logger log = LoggerFactory.getLogger(FacadingInvocationHandler.class);
+    private final Logger log;
 
     /**
      * Indicates if the cache is used, by default is false.
@@ -137,6 +138,7 @@ class FacadingInvocationHandler implements InvocationHandler {
     private boolean useCache;
 
     public FacadingInvocationHandler(Resource item, URI context, Class<? extends Facade> facade, Facading facadingService, RepositoryConnection connection) {
+        this.log = LoggerFactory.getLogger(facade.getName() + "!" + this.getClass().getSimpleName() + "@" + item.stringValue());
         this.delegate = item;
         this.facadingService = facadingService;
         this.declaredFacade = facade;
@@ -224,7 +226,8 @@ class FacadingInvocationHandler implements InvocationHandler {
      */
     @Override
     public Object invoke(Object proxy, Method method, Object[] args) throws InstantiationException, IllegalAccessException, RepositoryException {
-        if (!connection.isOpen()) { throw new IllegalAccessException("the connection is already closed, cannot access proxy methods"); }
+        if (!connection.isOpen()) { throw new IllegalAccessException("the connection is already closed, cannot access proxy methods."); }
+        if (!connection.isActive()) { throw new IllegalAccessException("no active transaction, cannot access triple-store."); }
 
         // handle default methods:
         if (FacadingInvocationHelper.checkMethodSig(method, "hashCode")) {
@@ -470,13 +473,16 @@ class FacadingInvocationHandler implements InvocationHandler {
                 connection.remove((Resource) null, prop, delegate, context);
             } else if (!predicate.isInverse() && loc != null) {
                 final RepositoryResult<Statement> statements = connection.getStatements(delegate, prop, null, false, context);
-                while (statements.hasNext()) {
-                    final Statement s = statements.next();
-                    if (FacadingInvocationHelper.checkLocale(loc, s.getObject())) {
-                        connection.remove(s);
+                try {
+                    while (statements.hasNext()) {
+                        final Statement s = statements.next();
+                        if (FacadingInvocationHelper.checkLocale(loc, s.getObject())) {
+                            connection.remove(s);
+                        }
                     }
+                } finally {
+                    statements.close();
                 }
-                statements.close();
             } else if (predicate.isInverse() && loc != null) { throw new IllegalArgumentException("A combination of @RDFInverse and a Literal is not possible");
             }
         }
@@ -612,7 +618,7 @@ class FacadingInvocationHandler implements InvocationHandler {
                     final Collection<Object> result = FacadingInvocationHelper.createCollection(collectionType, Collections.<Object> emptyList());
                     final URI property = connection.getValueFactory().createURI(rdf_property);
 
-                    for (final String s : getProperties(entity, property, null, null)) {
+                    for (final String s : getProperties(entity, property, loc, context)) {
                         result.add(FacadeUtils.transformToBaseType(s, tCls));
                     }
 
@@ -643,7 +649,6 @@ class FacadingInvocationHandler implements InvocationHandler {
         URI property = connection.getValueFactory().createURI(rdf_property);
 
         RepositoryResult<Statement> triples = connection.getStatements(entity, property, null, false);
-
         try {
             if (triples.hasNext()) {
                 Statement triple = triples.next();
@@ -676,7 +681,6 @@ class FacadingInvocationHandler implements InvocationHandler {
         URI property = connection.getValueFactory().createURI(rdf_property);
 
         RepositoryResult<Statement> triples = connection.getStatements(null, property, entity, false);
-
         try {
             if (triples.hasNext()) {
                 Statement triple = triples.next();
@@ -705,19 +709,20 @@ class FacadingInvocationHandler implements InvocationHandler {
      * 
      */
     private <C> Set<C> queryOutgoingAll(Resource entity, String rdf_property, Class<C> returnType) throws RepositoryException {
-        URI property = connection.getValueFactory().createURI(rdf_property);
-
-        RepositoryResult<Statement> triples = connection.getStatements(entity, property, null, false);
-
-        Set<C> dupSet = new LinkedHashSet<C>();
+        final URI property = connection.getValueFactory().createURI(rdf_property);
 
-        while (triples.hasNext()) {
-            Statement triple = triples.next();
-            if (returnType.isInstance(triple.getObject())) {
-                dupSet.add(returnType.cast(triple.getObject()));
+        final Set<C> dupSet = new LinkedHashSet<C>();
+        final RepositoryResult<Statement> triples = connection.getStatements(entity, property, null, false);
+        try {
+            while (triples.hasNext()) {
+                Statement triple = triples.next();
+                if (returnType.isInstance(triple.getObject())) {
+                    dupSet.add(returnType.cast(triple.getObject()));
+                }
             }
+        } finally {
+            triples.close();
         }
-        triples.close();
 
         return dupSet;
 
@@ -730,20 +735,20 @@ class FacadingInvocationHandler implements InvocationHandler {
      * 
      */
     private <C> Set<C> queryIncomingAll(Resource entity, String rdf_property, Class<C> returnType) throws RepositoryException {
+        final URI property = connection.getValueFactory().createURI(rdf_property);
 
-        URI property = connection.getValueFactory().createURI(rdf_property);
-
-        RepositoryResult<Statement> triples = connection.getStatements(null, property, entity, false);
-
-        Set<C> dupSet = new LinkedHashSet<C>();
-
-        while (triples.hasNext()) {
-            Statement triple = triples.next();
-            if (returnType.isInstance(triple.getSubject())) {
-                dupSet.add(returnType.cast(triple.getSubject()));
+        final Set<C> dupSet = new LinkedHashSet<C>();
+        final RepositoryResult<Statement> triples = connection.getStatements(null, property, entity, false);
+        try {
+            while (triples.hasNext()) {
+                Statement triple = triples.next();
+                if (returnType.isInstance(triple.getSubject())) {
+                    dupSet.add(returnType.cast(triple.getSubject()));
+                }
             }
+        } finally {
+            triples.close();
         }
-        triples.close();
 
         return dupSet;
     }
@@ -769,23 +774,25 @@ class FacadingInvocationHandler implements InvocationHandler {
     }
 
     private Set<String> getProperties(Resource entity, URI property, Locale loc, URI context) throws RepositoryException {
-        String lang = loc == null ? null : loc.getLanguage().toLowerCase();
-
-        RepositoryResult<Statement> candidates = connection.getStatements(entity, property, null, false, context);
+        final String lang = loc == null ? null : loc.getLanguage().toLowerCase();
 
-        Set<String> values = new HashSet<String>();
-        while (candidates.hasNext()) {
-            Statement triple = candidates.next();
+        final Set<String> values = new HashSet<String>();
+        final RepositoryResult<Statement> candidates = connection.getStatements(entity, property, null, false, context);
+        try {
+            while (candidates.hasNext()) {
+                Statement triple = candidates.next();
 
-            if (triple.getObject() instanceof Literal) {
-                Literal l = (Literal) triple.getObject();
+                if (triple.getObject() instanceof Literal) {
+                    Literal l = (Literal) triple.getObject();
 
-                if (lang == null || lang.equals(l.getLanguage())) {
-                    values.add(l.stringValue());
+                    if (lang == null || lang.equals(l.getLanguage())) {
+                        values.add(l.stringValue());
+                    }
                 }
             }
+        } finally {
+            candidates.close();
         }
-        candidates.close();
 
         return values;
     }

http://git-wip-us.apache.org/repos/asf/marmotta/blob/582abb5b/commons/sesame-tools-facading/src/main/java/org/apache/marmotta/commons/sesame/facading/util/FacadeUtils.java
----------------------------------------------------------------------
diff --git a/commons/sesame-tools-facading/src/main/java/org/apache/marmotta/commons/sesame/facading/util/FacadeUtils.java b/commons/sesame-tools-facading/src/main/java/org/apache/marmotta/commons/sesame/facading/util/FacadeUtils.java
index f5bf702..3c29da5 100644
--- a/commons/sesame-tools-facading/src/main/java/org/apache/marmotta/commons/sesame/facading/util/FacadeUtils.java
+++ b/commons/sesame-tools-facading/src/main/java/org/apache/marmotta/commons/sesame/facading/util/FacadeUtils.java
@@ -17,6 +17,7 @@
 package org.apache.marmotta.commons.sesame.facading.util;
 
 
+import org.apache.commons.lang3.LocaleUtils;
 import org.apache.marmotta.commons.sesame.facading.model.Facade;
 import org.apache.marmotta.commons.util.DateUtils;
 import org.openrdf.model.Resource;
@@ -295,40 +296,50 @@ public class FacadeUtils {
      * @return
      * @throws IllegalArgumentException
      */
+    @SuppressWarnings("unchecked")
     public static <T> T transformToBaseType(String value, Class<T> returnType) throws IllegalArgumentException {
         // transformation to appropriate primitive type
+        /*
+         * README: the "dirty" cast: "(T) x" instead of "returnType.cast(x)" is required since
+         * .cast does not work for primitive types (int, double, float, etc...).
+         * Somehow it results in a ClassCastException
+         */
         if(Integer.class.equals(returnType) || int.class.equals(returnType)) {
             if(value == null) {
-                return returnType.cast(0);
+                return (T)(Integer)(0);
             }
-            return returnType.cast(Integer.parseInt(value));
+            return (T)(Integer.decode(value));
         } else if(Long.class.equals(returnType) || long.class.equals(returnType)) {
             if(value == null) {
-                return returnType.cast(0L);
+                return (T)(Long)(0L);
             }
-            return returnType.cast(Long.parseLong(value));
+            return (T)(Long.decode(value));
         } else if(Double.class.equals(returnType) || double.class.equals(returnType)) {
             if(value == null) {
-                return returnType.cast(0.0);
+                return (T)(Double)(0.0);
             }
-            return returnType.cast(Double.parseDouble(value));
+            return (T)(Double.valueOf(value));
         } else if(Float.class.equals(returnType) || float.class.equals(returnType)) {
             if(value == null) {
-                return returnType.cast(0.0F);
+                return (T)(Float)(0.0F);
             }
-            return returnType.cast(Float.parseFloat(value));
+            return (T)(Float.valueOf(value));
         } else if(Byte.class.equals(returnType) || byte.class.equals(returnType)) {
             if(value == null) {
-                return returnType.cast((byte) 0);
+                return (T)(Byte)((byte) 0);
             }
-            return returnType.cast(Byte.parseByte(value));
+            return (T)(Byte.decode(value));
         } else if(Boolean.class.equals(returnType) || boolean.class.equals(returnType)) {
-            return returnType.cast(Boolean.parseBoolean(value));
+            return (T)(Boolean.valueOf(value));
         } else if(Character.class.equals(returnType) || char.class.equals(returnType)) {
             if(value == null) {
-                return null;
+                if (Character.class.equals(returnType)){
+                    return null;
+                } else {
+                    return (T) new Character((char) 0);
+                }
             } else if(value.length() > 0) {
-                return returnType.cast(value.charAt(0));
+                return (T)(Character)(value.charAt(0));
             } else {
                 return null;
             }
@@ -336,7 +347,7 @@ public class FacadeUtils {
             if(value == null) {
                 return null;
             } else {
-                return returnType.cast(new Locale(value));
+                return returnType.cast(LocaleUtils.toLocale(value));
             }
         } else if (Date.class.equals(returnType)) {
             if(value == null) {