You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@marmotta.apache.org by ja...@apache.org on 2013/02/27 14:01:11 UTC

[5/12] MARMOTTA-108: renamed packages in marmotta-client-java also did some cleanup (removed clients for services that are not part of marmotta)

http://git-wip-us.apache.org/repos/asf/incubator-marmotta/blob/ed88a640/client/marmotta-client-java/src/main/java/org/apache/marmotta/client/exception/NotFoundException.java
----------------------------------------------------------------------
diff --git a/client/marmotta-client-java/src/main/java/org/apache/marmotta/client/exception/NotFoundException.java b/client/marmotta-client-java/src/main/java/org/apache/marmotta/client/exception/NotFoundException.java
new file mode 100644
index 0000000..2a0cc36
--- /dev/null
+++ b/client/marmotta-client-java/src/main/java/org/apache/marmotta/client/exception/NotFoundException.java
@@ -0,0 +1,82 @@
+/**
+ * Copyright (C) 2013 The Apache Software Foundation.
+ *
+ * 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.
+ */
+package org.apache.marmotta.client.exception;
+
+/**
+ * Add file description here!
+ * <p/>
+ * Author: Sebastian Schaffert
+ */
+public class NotFoundException extends MarmottaClientException {
+
+	private static final long serialVersionUID = 351578221586139119L;
+
+	/**
+     * Constructs a new exception with <code>null</code> as its detail message.
+     * The cause is not initialized, and may subsequently be initialized by a
+     * call to {@link #initCause}.
+     */
+    public NotFoundException() {
+    }
+
+    /**
+     * Constructs a new exception with the specified detail message.  The
+     * cause is not initialized, and may subsequently be initialized by
+     * a call to {@link #initCause}.
+     *
+     * @param message the detail message. The detail message is saved for
+     *                later retrieval by the {@link #getMessage()} method.
+     */
+    public NotFoundException(String message) {
+        super(message);
+    }
+
+    /**
+     * Constructs a new exception with the specified detail message and
+     * cause.  <p>Note that the detail message associated with
+     * <code>cause</code> is <i>not</i> automatically incorporated in
+     * this exception's detail message.
+     *
+     * @param message the detail message (which is saved for later retrieval
+     *                by the {@link #getMessage()} method).
+     * @param cause   the cause (which is saved for later retrieval by the
+     *                {@link #getCause()} method).  (A <tt>null</tt> value is
+     *                permitted, and indicates that the cause is nonexistent or
+     *                unknown.)
+     * @since 1.4
+     */
+    public NotFoundException(String message, Throwable cause) {
+        super(message, cause);
+    }
+
+    /**
+     * Constructs a new exception with the specified cause and a detail
+     * message of <tt>(cause==null ? null : cause.toString())</tt> (which
+     * typically contains the class and detail message of <tt>cause</tt>).
+     * This constructor is useful for exceptions that are little more than
+     * wrappers for other throwables (for example, {@link
+     * java.security.PrivilegedActionException}).
+     *
+     * @param cause the cause (which is saved for later retrieval by the
+     *              {@link #getCause()} method).  (A <tt>null</tt> value is
+     *              permitted, and indicates that the cause is nonexistent or
+     *              unknown.)
+     * @since 1.4
+     */
+    public NotFoundException(Throwable cause) {
+        super(cause);
+    }
+}

http://git-wip-us.apache.org/repos/asf/incubator-marmotta/blob/ed88a640/client/marmotta-client-java/src/main/java/org/apache/marmotta/client/exception/ParseException.java
----------------------------------------------------------------------
diff --git a/client/marmotta-client-java/src/main/java/org/apache/marmotta/client/exception/ParseException.java b/client/marmotta-client-java/src/main/java/org/apache/marmotta/client/exception/ParseException.java
new file mode 100644
index 0000000..7761810
--- /dev/null
+++ b/client/marmotta-client-java/src/main/java/org/apache/marmotta/client/exception/ParseException.java
@@ -0,0 +1,82 @@
+/**
+ * Copyright (C) 2013 The Apache Software Foundation.
+ *
+ * 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.
+ */
+package org.apache.marmotta.client.exception;
+
+/**
+ * Add file description here!
+ * <p/>
+ * Author: Sebastian Schaffert
+ */
+public class ParseException extends MarmottaClientException {
+
+	private static final long serialVersionUID = 5432804879420775394L;
+
+	/**
+     * Constructs a new exception with <code>null</code> as its detail message.
+     * The cause is not initialized, and may subsequently be initialized by a
+     * call to {@link #initCause}.
+     */
+    public ParseException() {
+    }
+
+    /**
+     * Constructs a new exception with the specified detail message.  The
+     * cause is not initialized, and may subsequently be initialized by
+     * a call to {@link #initCause}.
+     *
+     * @param message the detail message. The detail message is saved for
+     *                later retrieval by the {@link #getMessage()} method.
+     */
+    public ParseException(String message) {
+        super(message);
+    }
+
+    /**
+     * Constructs a new exception with the specified detail message and
+     * cause.  <p>Note that the detail message associated with
+     * <code>cause</code> is <i>not</i> automatically incorporated in
+     * this exception's detail message.
+     *
+     * @param message the detail message (which is saved for later retrieval
+     *                by the {@link #getMessage()} method).
+     * @param cause   the cause (which is saved for later retrieval by the
+     *                {@link #getCause()} method).  (A <tt>null</tt> value is
+     *                permitted, and indicates that the cause is nonexistent or
+     *                unknown.)
+     * @since 1.4
+     */
+    public ParseException(String message, Throwable cause) {
+        super(message, cause);
+    }
+
+    /**
+     * Constructs a new exception with the specified cause and a detail
+     * message of <tt>(cause==null ? null : cause.toString())</tt> (which
+     * typically contains the class and detail message of <tt>cause</tt>).
+     * This constructor is useful for exceptions that are little more than
+     * wrappers for other throwables (for example, {@link
+     * java.security.PrivilegedActionException}).
+     *
+     * @param cause the cause (which is saved for later retrieval by the
+     *              {@link #getCause()} method).  (A <tt>null</tt> value is
+     *              permitted, and indicates that the cause is nonexistent or
+     *              unknown.)
+     * @since 1.4
+     */
+    public ParseException(Throwable cause) {
+        super(cause);
+    }
+}

http://git-wip-us.apache.org/repos/asf/incubator-marmotta/blob/ed88a640/client/marmotta-client-java/src/main/java/org/apache/marmotta/client/model/classification/Classification.java
----------------------------------------------------------------------
diff --git a/client/marmotta-client-java/src/main/java/org/apache/marmotta/client/model/classification/Classification.java b/client/marmotta-client-java/src/main/java/org/apache/marmotta/client/model/classification/Classification.java
new file mode 100644
index 0000000..2c14e98
--- /dev/null
+++ b/client/marmotta-client-java/src/main/java/org/apache/marmotta/client/model/classification/Classification.java
@@ -0,0 +1,79 @@
+/**
+ * Copyright (C) 2013 The Apache Software Foundation.
+ *
+ * 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.
+ */
+package org.apache.marmotta.client.model.classification;
+
+import org.apache.marmotta.client.model.rdf.URI;
+
+
+/**
+ * A classification result of the classifier; for each category, provides a probability value indicating how much
+ * the text fits to a category.
+ * <p/>
+ * Author: Sebastian Schaffert
+ */
+public class Classification implements Comparable<Classification> {
+
+
+    private URI category;
+    private double probability;
+
+    public Classification(URI category, double probability) {
+        this.category = category;
+        this.probability = probability;
+    }
+
+    /**
+     * The category for which the classifier computed a probability
+     *
+     * @return
+     */
+    public URI getCategory() {
+        return category;
+    }
+
+    /**
+     * The probability the text fits to this category.
+     *
+     * @return
+     */
+    public double getProbability() {
+        return probability;
+    }
+
+    /**
+     * Compares this object with the specified object for order.  Returns a
+     * negative integer, zero, or a positive integer as this object is less
+     * than, equal to, or greater than the specified object.
+     * <p/>
+     * Classifiers with higher probability take precedence (are smaller) than classifiers with lower probability.
+     *
+     * @param o the object to be compared.
+     * @return a negative integer, zero, or a positive integer as this object
+     *         is less than, equal to, or greater than the specified object.
+     * @throws ClassCastException if the specified object's type prevents it
+     *                            from being compared to this object.
+     */
+    @Override
+    public int compareTo(Classification o) {
+        if(getProbability() > o.getProbability()) {
+            return -1;
+        } else if(getProbability() < o.getProbability()) {
+            return 1;
+        } else {
+            return 0;
+        }
+    }
+}

http://git-wip-us.apache.org/repos/asf/incubator-marmotta/blob/ed88a640/client/marmotta-client-java/src/main/java/org/apache/marmotta/client/model/config/Configuration.java
----------------------------------------------------------------------
diff --git a/client/marmotta-client-java/src/main/java/org/apache/marmotta/client/model/config/Configuration.java b/client/marmotta-client-java/src/main/java/org/apache/marmotta/client/model/config/Configuration.java
new file mode 100644
index 0000000..8bb937c
--- /dev/null
+++ b/client/marmotta-client-java/src/main/java/org/apache/marmotta/client/model/config/Configuration.java
@@ -0,0 +1,71 @@
+/**
+ * Copyright (C) 2013 The Apache Software Foundation.
+ *
+ * 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.
+ */
+package org.apache.marmotta.client.model.config;
+
+import java.util.ArrayList;
+import java.util.Collection;
+import java.util.List;
+
+/**
+ * Add file description here!
+ * <p/>
+ * Author: Sebastian Schaffert
+ */
+public class Configuration {
+    
+    private String key;
+    
+    private Object value;
+
+
+    public Configuration(String key, Object value) {
+        this.key = key;
+        this.value = value;
+    }
+
+
+    public String getKey() {
+        return key;
+    }
+
+    public Object getValue() {
+        return value;
+    }
+    
+    public String getString() {
+        if(value instanceof Collection) {
+            if(((Collection<?>) value).isEmpty()) {
+                return null;   
+            } else {
+                return ((Collection<?>) value).iterator().next().toString();
+            }
+        } else {
+            return value.toString();
+        }
+    }
+    
+    public List<String> getList() {
+        List<String> result = new ArrayList<String>();
+        if(value instanceof Collection) {
+            for(Object o : (Collection<?>) value) {
+                result.add(o.toString());
+            }
+        } else {
+            result.add(value.toString());
+        }
+        return result;
+    }
+}

http://git-wip-us.apache.org/repos/asf/incubator-marmotta/blob/ed88a640/client/marmotta-client-java/src/main/java/org/apache/marmotta/client/model/content/ByteContent.java
----------------------------------------------------------------------
diff --git a/client/marmotta-client-java/src/main/java/org/apache/marmotta/client/model/content/ByteContent.java b/client/marmotta-client-java/src/main/java/org/apache/marmotta/client/model/content/ByteContent.java
new file mode 100644
index 0000000..f9cddbe
--- /dev/null
+++ b/client/marmotta-client-java/src/main/java/org/apache/marmotta/client/model/content/ByteContent.java
@@ -0,0 +1,55 @@
+/**
+ * Copyright (C) 2013 The Apache Software Foundation.
+ *
+ * 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.
+ */
+package org.apache.marmotta.client.model.content;
+
+import java.io.ByteArrayInputStream;
+import java.io.InputStream;
+
+/**
+ * Add file description here!
+ * <p/>
+ * Author: Sebastian Schaffert
+ */
+public class ByteContent extends Content {
+
+    private byte[] bytes;
+
+    public ByteContent(byte[] bytes, String mimeType, long size) {
+        super(mimeType, size);
+        this.bytes = bytes;
+    }
+
+    /**
+     * Return the content of this object as stream. Note that the stream is only guaranteed to be consumable once.
+     *
+     * @return
+     */
+    @Override
+    public InputStream getStream() {
+        return new ByteArrayInputStream(bytes);
+    }
+
+    /**
+     * Return the content of this object as byte array. Note that when calling this method it is not safe to
+     * call the getStream method afterwards.
+     *
+     * @return
+     */
+    @Override
+    public byte[] getBytes() {
+        return bytes;
+    }
+}

http://git-wip-us.apache.org/repos/asf/incubator-marmotta/blob/ed88a640/client/marmotta-client-java/src/main/java/org/apache/marmotta/client/model/content/Content.java
----------------------------------------------------------------------
diff --git a/client/marmotta-client-java/src/main/java/org/apache/marmotta/client/model/content/Content.java b/client/marmotta-client-java/src/main/java/org/apache/marmotta/client/model/content/Content.java
new file mode 100644
index 0000000..de781b7
--- /dev/null
+++ b/client/marmotta-client-java/src/main/java/org/apache/marmotta/client/model/content/Content.java
@@ -0,0 +1,61 @@
+/**
+ * Copyright (C) 2013 The Apache Software Foundation.
+ *
+ * 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.
+ */
+package org.apache.marmotta.client.model.content;
+
+import java.io.InputStream;
+
+/**
+ * Representation of media content returned by the Apache Marmotta. Provides an InputStream for
+ * reading the media data. Optionally, supports reading all content into a byte array.
+ *
+ * <p/>
+ * Author: Sebastian Schaffert
+ */
+public abstract class Content {
+    
+    private String mimeType;
+
+    private long size;
+
+
+    public Content(String mimeType, long size) {
+        this.mimeType = mimeType;
+        this.size = size;
+    }
+
+    /**
+     * Return the content of this object as stream. Note that the stream is only guaranteed to be consumable once.
+     * @return
+     */
+    public abstract InputStream getStream();
+
+
+    /**
+     * Return the content of this object as byte array. Note that when calling this method it is not safe to
+     * call the getStream method afterwards.
+     * @return
+     */
+    public abstract byte[] getBytes();
+
+
+    public String getMimeType() {
+        return mimeType;
+    }
+
+    public long getSize() {
+        return size;
+    }
+}

http://git-wip-us.apache.org/repos/asf/incubator-marmotta/blob/ed88a640/client/marmotta-client-java/src/main/java/org/apache/marmotta/client/model/content/StreamContent.java
----------------------------------------------------------------------
diff --git a/client/marmotta-client-java/src/main/java/org/apache/marmotta/client/model/content/StreamContent.java b/client/marmotta-client-java/src/main/java/org/apache/marmotta/client/model/content/StreamContent.java
new file mode 100644
index 0000000..472fc87
--- /dev/null
+++ b/client/marmotta-client-java/src/main/java/org/apache/marmotta/client/model/content/StreamContent.java
@@ -0,0 +1,61 @@
+/**
+ * Copyright (C) 2013 The Apache Software Foundation.
+ *
+ * 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.
+ */
+package org.apache.marmotta.client.model.content;
+
+import com.google.common.io.ByteStreams;
+
+import java.io.IOException;
+import java.io.InputStream;
+
+/**
+ * Add file description here!
+ * <p/>
+ * Author: Sebastian Schaffert
+ */
+public class StreamContent extends Content {
+
+    private InputStream data;
+
+    public StreamContent(InputStream data, String mimeType, long size) {
+        super(mimeType, size);
+        this.data = data;
+    }
+
+    /**
+     * Return the content of this object as stream. Note that the stream is only guaranteed to be consumable once.
+     *
+     * @return
+     */
+    @Override
+    public InputStream getStream() {
+        return data;
+    }
+
+    /**
+     * Return the content of this object as byte array. Note that when calling this method it is not safe to
+     * call the getStream method afterwards.
+     *
+     * @return
+     */
+    @Override
+    public byte[] getBytes() {
+        try {
+            return ByteStreams.toByteArray(data);
+        } catch (IOException e) {
+            return null;
+        }
+    }
+}

http://git-wip-us.apache.org/repos/asf/incubator-marmotta/blob/ed88a640/client/marmotta-client-java/src/main/java/org/apache/marmotta/client/model/content/StringContent.java
----------------------------------------------------------------------
diff --git a/client/marmotta-client-java/src/main/java/org/apache/marmotta/client/model/content/StringContent.java b/client/marmotta-client-java/src/main/java/org/apache/marmotta/client/model/content/StringContent.java
new file mode 100644
index 0000000..4405596
--- /dev/null
+++ b/client/marmotta-client-java/src/main/java/org/apache/marmotta/client/model/content/StringContent.java
@@ -0,0 +1,68 @@
+/**
+ * Copyright (C) 2013 The Apache Software Foundation.
+ *
+ * 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.
+ */
+package org.apache.marmotta.client.model.content;
+
+import java.io.ByteArrayInputStream;
+import java.io.InputStream;
+import java.io.UnsupportedEncodingException;
+
+/**
+ * Add file description here!
+ * <p/>
+ * Author: Sebastian Schaffert
+ */
+public class StringContent extends Content {
+    
+    private String data;
+
+    public StringContent(String data, String mimeType)  {
+        super(mimeType, data.getBytes().length);
+        this.data = data;
+    }
+
+    public String getData() {
+        return data;
+    }
+
+    public void setData(String data) {
+        this.data = data;
+    }
+
+    /**
+     * Return the content of this object as stream. Note that the stream is only guaranteed to be consumable once.
+     *
+     * @return
+     */
+    @Override
+    public InputStream getStream() {
+        return new ByteArrayInputStream(getBytes());
+    }
+
+    /**
+     * Return the content of this object as byte array. Note that when calling this method it is not safe to
+     * call the getStream method afterwards.
+     *
+     * @return
+     */
+    @Override
+    public byte[] getBytes() {
+        try {
+            return data.getBytes("utf-8");
+        } catch (UnsupportedEncodingException e) {
+            return data.getBytes();
+        }
+    }
+}

http://git-wip-us.apache.org/repos/asf/incubator-marmotta/blob/ed88a640/client/marmotta-client-java/src/main/java/org/apache/marmotta/client/model/meta/Metadata.java
----------------------------------------------------------------------
diff --git a/client/marmotta-client-java/src/main/java/org/apache/marmotta/client/model/meta/Metadata.java b/client/marmotta-client-java/src/main/java/org/apache/marmotta/client/model/meta/Metadata.java
new file mode 100644
index 0000000..8d1b799
--- /dev/null
+++ b/client/marmotta-client-java/src/main/java/org/apache/marmotta/client/model/meta/Metadata.java
@@ -0,0 +1,94 @@
+/**
+ * Copyright (C) 2013 The Apache Software Foundation.
+ *
+ * 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.
+ */
+package org.apache.marmotta.client.model.meta;
+
+import com.google.common.base.Preconditions;
+import com.google.common.collect.ImmutableSet;
+
+import java.util.HashMap;
+import java.util.Map;
+import java.util.Set;
+
+import org.apache.marmotta.client.model.rdf.Literal;
+import org.apache.marmotta.client.model.rdf.RDFNode;
+
+/**
+ * Add file description here!
+ * <p/>
+ * Author: Sebastian Schaffert
+ */
+public class Metadata extends HashMap<String,Set<RDFNode>> {
+    
+	private static final long serialVersionUID = 1L;
+
+	private String subject;
+
+    /**
+     * Constructs an empty <tt>HashMap</tt> with the default initial capacity
+     * (16) and the default load factor (0.75).
+     */
+    public Metadata(String subject) {
+        this.subject = subject;
+    }
+
+    public String getSubject() {
+        return subject;
+    }
+    
+    public RDFNode getFirst(String propertyUri) {
+        Preconditions.checkNotNull(get(propertyUri));
+        Preconditions.checkState(get(propertyUri).iterator().hasNext());
+
+        return get(propertyUri).iterator().next();
+    }
+
+
+    /**
+     * Convert a more simple property map into a metadata representation. Note that all keys of the property map still
+     * are required to be valid RDF URI resources. All properties will have string literal values in the resulting metadata.
+     *
+     * @param resource
+     * @param map
+     * @return
+     */
+    public static Metadata fromPropertiesMap(String resource, Map<String,String> map) {
+        Metadata m = new Metadata(resource);
+        for(Map.Entry<String,String> entry : map.entrySet()) {
+            m.put(entry.getKey(), ImmutableSet.<RDFNode>of(new Literal(entry.getValue())));
+        }
+        return m;
+    }
+
+    /**
+     * Convert a metadata representation into a simpler property map, potentially loosing information. Only the
+     * first literal value of a property is copied to the resulting map.
+     *
+     * @param metadata
+     * @return
+     */
+    public static Map<String,String> toPropertiesMap(Metadata metadata) {
+        Map<String,String> result = new HashMap<String, String>();
+        for(Map.Entry<String,Set<RDFNode>> entry : metadata.entrySet()) {
+            for(RDFNode n : entry.getValue())  {
+                if(n instanceof Literal) {
+                    result.put(entry.getKey(),((Literal) n).getContent());
+                    break;
+                }
+            }
+        }
+        return result;
+    }
+}

http://git-wip-us.apache.org/repos/asf/incubator-marmotta/blob/ed88a640/client/marmotta-client-java/src/main/java/org/apache/marmotta/client/model/rdf/BNode.java
----------------------------------------------------------------------
diff --git a/client/marmotta-client-java/src/main/java/org/apache/marmotta/client/model/rdf/BNode.java b/client/marmotta-client-java/src/main/java/org/apache/marmotta/client/model/rdf/BNode.java
new file mode 100644
index 0000000..d521052
--- /dev/null
+++ b/client/marmotta-client-java/src/main/java/org/apache/marmotta/client/model/rdf/BNode.java
@@ -0,0 +1,55 @@
+/**
+ * Copyright (C) 2013 The Apache Software Foundation.
+ *
+ * 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.
+ */
+package org.apache.marmotta.client.model.rdf;
+
+/**
+ * Add file description here!
+ * <p/>
+ * Author: Sebastian Schaffert
+ */
+public class BNode extends RDFNode { 
+    
+    private String anonId;
+
+    public BNode(String anonId) {
+        this.anonId = anonId;
+    }
+
+    public String getAnonId() {
+        return anonId;
+    }
+
+    public void setAnonId(String anonId) {
+        this.anonId = anonId;
+    }
+
+    @Override
+    public boolean equals(Object o) {
+        if (this == o) return true;
+        if (o == null || getClass() != o.getClass()) return false;
+
+        BNode bNode = (BNode) o;
+
+        if (anonId != null ? !anonId.equals(bNode.anonId) : bNode.anonId != null) return false;
+
+        return true;
+    }
+
+    @Override
+    public int hashCode() {
+        return anonId != null ? anonId.hashCode() : 0;
+    }
+}

http://git-wip-us.apache.org/repos/asf/incubator-marmotta/blob/ed88a640/client/marmotta-client-java/src/main/java/org/apache/marmotta/client/model/rdf/Literal.java
----------------------------------------------------------------------
diff --git a/client/marmotta-client-java/src/main/java/org/apache/marmotta/client/model/rdf/Literal.java b/client/marmotta-client-java/src/main/java/org/apache/marmotta/client/model/rdf/Literal.java
new file mode 100644
index 0000000..0df65b0
--- /dev/null
+++ b/client/marmotta-client-java/src/main/java/org/apache/marmotta/client/model/rdf/Literal.java
@@ -0,0 +1,120 @@
+/**
+ * Copyright (C) 2013 The Apache Software Foundation.
+ *
+ * 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.
+ */
+package org.apache.marmotta.client.model.rdf;
+
+/**
+ * A lightweight RDF Literal implementation providing the base functionalities.
+ * <p/>
+ * Author: Sebastian Schaffert
+ */
+public class Literal extends RDFNode {
+    
+    private String content;
+    
+    private String language;
+    
+    private URI type;
+
+
+    public Literal(String content) {
+        this.content = content;
+    }
+
+    public Literal(String content, String language) {
+        this.content = content;
+        this.language = language;
+    }
+
+    public Literal(String content, URI type) {
+        this.content = content;
+        this.type = type;
+    }
+
+
+    public String getContent() {
+        return content;
+    }
+
+    public void setContent(String content) {
+        this.content = content;
+    }
+
+    public String getLanguage() {
+        return language;
+    }
+
+    public void setLanguage(String language) {
+        this.language = language;
+    }
+
+    public URI getType() {
+        return type;
+    }
+
+    public void setType(URI type) {
+        this.type = type;
+    }
+    
+    
+    public int getInt() {
+        return Integer.parseInt(content);
+    }
+    
+    public long getLong() {
+        return Long.parseLong(content);
+    }
+
+    public double getDouble() {
+        return Double.parseDouble(content);
+    }
+
+    public float getFloat() {
+        return Float.parseFloat(content);
+    }
+
+    public boolean getBoolean() {
+        return Boolean.getBoolean(content);
+    }
+
+    @Override
+    public boolean equals(Object o) {
+        if (this == o) return true;
+        if (o == null || getClass() != o.getClass()) return false;
+
+        Literal literal = (Literal) o;
+
+        if (!content.equals(literal.content)) return false;
+        if (language != null ? !language.equals(literal.language) : literal.language != null) return false;
+        if (type != null ? !type.equals(literal.type) : literal.type != null) return false;
+
+        return true;
+    }
+
+    @Override
+    public int hashCode() {
+        int result = content.hashCode();
+        result = 31 * result + (language != null ? language.hashCode() : 0);
+        result = 31 * result + (type != null ? type.hashCode() : 0);
+        return result;
+    }
+
+
+    @Override
+    public String toString() {
+        return content;
+    }
+}
+

http://git-wip-us.apache.org/repos/asf/incubator-marmotta/blob/ed88a640/client/marmotta-client-java/src/main/java/org/apache/marmotta/client/model/rdf/RDFNode.java
----------------------------------------------------------------------
diff --git a/client/marmotta-client-java/src/main/java/org/apache/marmotta/client/model/rdf/RDFNode.java b/client/marmotta-client-java/src/main/java/org/apache/marmotta/client/model/rdf/RDFNode.java
new file mode 100644
index 0000000..5b4a520
--- /dev/null
+++ b/client/marmotta-client-java/src/main/java/org/apache/marmotta/client/model/rdf/RDFNode.java
@@ -0,0 +1,24 @@
+/**
+ * Copyright (C) 2013 The Apache Software Foundation.
+ *
+ * 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.
+ */
+package org.apache.marmotta.client.model.rdf;
+
+/**
+ * Add file description here!
+ * <p/>
+ * Author: Sebastian Schaffert
+ */
+public class RDFNode {
+}

http://git-wip-us.apache.org/repos/asf/incubator-marmotta/blob/ed88a640/client/marmotta-client-java/src/main/java/org/apache/marmotta/client/model/rdf/URI.java
----------------------------------------------------------------------
diff --git a/client/marmotta-client-java/src/main/java/org/apache/marmotta/client/model/rdf/URI.java b/client/marmotta-client-java/src/main/java/org/apache/marmotta/client/model/rdf/URI.java
new file mode 100644
index 0000000..90a4510
--- /dev/null
+++ b/client/marmotta-client-java/src/main/java/org/apache/marmotta/client/model/rdf/URI.java
@@ -0,0 +1,82 @@
+/**
+ * Copyright (C) 2013 The Apache Software Foundation.
+ *
+ * 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.
+ */
+package org.apache.marmotta.client.model.rdf;
+
+/**
+ * Add file description here!
+ * <p/>
+ * Author: Sebastian Schaffert
+ */
+public class URI extends RDFNode {
+    
+    private String uri;
+
+    public URI(String uri) {
+        this.uri = uri;
+    }
+
+    public String getUri() {
+        return uri;
+    }
+
+    public void setUri(String uri) {
+        this.uri = uri;
+    }
+
+
+    @Override
+    public boolean equals(Object o) {
+        if (this == o) return true;
+        if (o == null || getClass() != o.getClass()) return false;
+
+        URI uri1 = (URI) o;
+
+        if (!uri.equals(uri1.uri)) return false;
+
+        return true;
+    }
+
+    @Override
+    public int hashCode() {
+        return uri.hashCode();
+    }
+
+    /**
+     * Returns a string representation of the object. In general, the
+     * <code>toString</code> method returns a string that
+     * "textually represents" this object. The result should
+     * be a concise but informative representation that is easy for a
+     * person to read.
+     * It is recommended that all subclasses override this method.
+     * <p/>
+     * The <code>toString</code> method for class <code>Object</code>
+     * returns a string consisting of the name of the class of which the
+     * object is an instance, the at-sign character `<code>@</code>', and
+     * the unsigned hexadecimal representation of the hash code of the
+     * object. In other words, this method returns a string equal to the
+     * value of:
+     * <blockquote>
+     * <pre>
+     * getClass().getName() + '@' + Integer.toHexString(hashCode())
+     * </pre></blockquote>
+     *
+     * @return a string representation of the object.
+     */
+    @Override
+    public String toString() {
+        return uri;
+    }
+}

http://git-wip-us.apache.org/repos/asf/incubator-marmotta/blob/ed88a640/client/marmotta-client-java/src/main/java/org/apache/marmotta/client/model/sparql/SPARQLResult.java
----------------------------------------------------------------------
diff --git a/client/marmotta-client-java/src/main/java/org/apache/marmotta/client/model/sparql/SPARQLResult.java b/client/marmotta-client-java/src/main/java/org/apache/marmotta/client/model/sparql/SPARQLResult.java
new file mode 100644
index 0000000..383f3dd
--- /dev/null
+++ b/client/marmotta-client-java/src/main/java/org/apache/marmotta/client/model/sparql/SPARQLResult.java
@@ -0,0 +1,48 @@
+/**
+ * Copyright (C) 2013 The Apache Software Foundation.
+ *
+ * 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.
+ */
+package org.apache.marmotta.client.model.sparql;
+
+
+import java.util.LinkedList;
+import java.util.Map;
+import java.util.Set;
+
+import org.apache.marmotta.client.model.rdf.RDFNode;
+
+/**
+ * Provides a list of result bindings and information about the available fields.
+ * 
+ * @author Sebastian Schaffert
+ */
+public class SPARQLResult extends LinkedList<Map<String,RDFNode>> {
+    
+    private static final long serialVersionUID = -527039638847863378L;
+    
+    private Set<String> fieldNames;
+
+    /**
+     * Constructs an empty list.
+     */
+    public SPARQLResult(Set<String> fieldNames) {
+        this.fieldNames = fieldNames;
+    }
+
+
+    public Set<String> getFieldNames() {
+        return fieldNames;
+    }
+    
+}

http://git-wip-us.apache.org/repos/asf/incubator-marmotta/blob/ed88a640/client/marmotta-client-java/src/main/java/org/apache/marmotta/client/util/CollectionUtils.java
----------------------------------------------------------------------
diff --git a/client/marmotta-client-java/src/main/java/org/apache/marmotta/client/util/CollectionUtils.java b/client/marmotta-client-java/src/main/java/org/apache/marmotta/client/util/CollectionUtils.java
new file mode 100644
index 0000000..d4b0f41
--- /dev/null
+++ b/client/marmotta-client-java/src/main/java/org/apache/marmotta/client/util/CollectionUtils.java
@@ -0,0 +1,142 @@
+/**
+ * Copyright (C) 2013 The Apache Software Foundation.
+ *
+ * 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.
+ */
+package org.apache.marmotta.client.util;
+
+import java.text.Format;
+import java.util.ArrayList;
+import java.util.Collection;
+import java.util.HashSet;
+import java.util.LinkedList;
+import java.util.List;
+import java.util.Set;
+
+/**
+ * This class contains static helper methods for supporting java collections
+ * in Java 5.
+ *
+ * @author Sebastian Schaffert
+ */
+public class CollectionUtils {
+	
+	private CollectionUtils() {
+		// static only
+	}
+
+    /**
+     * Convert any iterable into a list
+     * @param <T>
+     * @param iterable
+     * @return
+     */
+    @SuppressWarnings("unchecked")
+    public static <T> List<T> toList(Iterable<T> iterable) {
+        return toCollection(LinkedList.class,iterable);
+    }
+
+    /**
+     * Convert any iterable into a set
+     * @param <T>
+     * @param iterable
+     * @return
+     */
+    @SuppressWarnings("unchecked")
+    public static <T> Set<T> toSet(Iterable<T> iterable) {
+        return toCollection(HashSet.class,iterable);
+    }
+
+    private static <C extends Collection<T>,T> C toCollection(Class<C> cls, Iterable<T> iterable) {
+        try {
+            C result = cls.newInstance();
+
+            for(T item : iterable) {
+                result.add(item);
+            }
+
+            return result;
+        } catch(InstantiationException ex) {
+            return null;
+        } catch(IllegalAccessException ex) {
+            return null;
+        }
+    }
+
+    public static <T> T first(Iterable<T> iterable) {
+        return iterable.iterator().next();
+    }
+
+
+    public static <T> String fold(Collection<T> elements, String separator) {
+        StringBuilder builder = new StringBuilder();
+        ArrayList<T> list = new ArrayList<T>(elements);
+        for(int i=0; i<list.size(); i++) {
+            builder.append(list.get(i).toString());
+            if(i < list.size()-1) {
+                builder.append(separator);
+            }
+        }
+        return builder.toString();
+    }
+
+
+    public static <T> String fold(Collection<T> elements, Format format, String separator) {
+        StringBuilder builder = new StringBuilder();
+        ArrayList<T> list = new ArrayList<T>(elements);
+        for(int i=0; i<list.size(); i++) {
+            builder.append(format.format(list.get(i)));
+            if(i < list.size()-1) {
+                builder.append(separator);
+            }
+        }
+        return builder.toString();
+    }
+
+    public static <T> String fold(Collection<T> elements, StringSerializer<T> format, String separator) {
+        StringBuilder builder = new StringBuilder();
+        ArrayList<T> list = new ArrayList<T>(elements);
+        for(int i=0; i<list.size(); i++) {
+            builder.append(format.serialize(list.get(i)));
+            if(i < list.size()-1) {
+                builder.append(separator);
+            }
+        }
+        return builder.toString();
+    }
+
+
+    /**
+     * Concatenate the collection of lists passed as argument into a new array list.
+     * @param lists
+     * @param <T>
+     * @return
+     */
+    public static <T> List<T> concat(Collection<? extends Collection<T>> lists) {
+        int size = 0;
+        for(Collection<T> list : lists) {
+            size += list.size();
+        }
+        List<T> result = new ArrayList<T>(size);
+        for(Collection<T> list : lists) {
+            result.addAll(list);
+        }
+        return result;
+    }
+
+
+    public interface StringSerializer<T> {
+        public String serialize(T t);
+    }
+
+}

http://git-wip-us.apache.org/repos/asf/incubator-marmotta/blob/ed88a640/client/marmotta-client-java/src/main/java/org/apache/marmotta/client/util/HTTPUtil.java
----------------------------------------------------------------------
diff --git a/client/marmotta-client-java/src/main/java/org/apache/marmotta/client/util/HTTPUtil.java b/client/marmotta-client-java/src/main/java/org/apache/marmotta/client/util/HTTPUtil.java
new file mode 100644
index 0000000..dab3d32
--- /dev/null
+++ b/client/marmotta-client-java/src/main/java/org/apache/marmotta/client/util/HTTPUtil.java
@@ -0,0 +1,137 @@
+/**
+ * Copyright (C) 2013 The Apache Software Foundation.
+ *
+ * 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.
+ */
+package org.apache.marmotta.client.util;
+
+import org.apache.commons.lang.StringUtils;
+import org.apache.http.Header;
+import org.apache.http.HttpRequest;
+import org.apache.http.HttpResponse;
+import org.apache.http.HttpStatus;
+import org.apache.http.ProtocolException;
+import org.apache.http.client.HttpClient;
+import org.apache.http.client.HttpRequestRetryHandler;
+import org.apache.http.client.methods.HttpGet;
+import org.apache.http.client.methods.HttpHead;
+import org.apache.http.client.methods.HttpPost;
+import org.apache.http.client.params.ClientPNames;
+import org.apache.http.impl.client.DefaultHttpClient;
+import org.apache.http.impl.client.DefaultRedirectStrategy;
+import org.apache.http.params.BasicHttpParams;
+import org.apache.http.params.CoreConnectionPNames;
+import org.apache.http.params.CoreProtocolPNames;
+import org.apache.http.params.HttpParams;
+import org.apache.http.protocol.HttpContext;
+import org.apache.marmotta.client.ClientConfiguration;
+import org.apache.marmotta.client.MarmottaClient;
+
+import java.io.IOException;
+
+/**
+ * HTTP Utilities
+ * 
+ * @author Sebastian Schaffert
+ * @author Sergio Fernández
+ */
+public class HTTPUtil {
+
+    private static final String CONTEXT = "context";
+
+	public static HttpClient createClient(ClientConfiguration config) {
+
+        HttpParams httpParams = new BasicHttpParams();
+        httpParams.setParameter(CoreProtocolPNames.USER_AGENT, "Marmotta Client Library/"+ MarmottaClient.VERSION);
+
+        httpParams.setIntParameter(CoreConnectionPNames.SO_TIMEOUT, config.getSoTimeout());
+        httpParams.setIntParameter(CoreConnectionPNames.CONNECTION_TIMEOUT, config.getConnectionTimeout());
+
+        httpParams.setBooleanParameter(ClientPNames.HANDLE_REDIRECTS,true);
+        httpParams.setIntParameter(ClientPNames.MAX_REDIRECTS,3);
+
+        if (StringUtils.isNotBlank(config.getMarmottaContext())) {
+        	httpParams.setParameter(CONTEXT, config.getMarmottaContext());
+        }
+        
+        DefaultHttpClient client;
+        if (config.getConectionManager() != null) {
+            client = new DefaultHttpClient(config.getConectionManager(), httpParams);
+        } else {
+            client = new DefaultHttpClient(httpParams);
+        }
+        client.setRedirectStrategy(new MarmottaRedirectStrategy());
+        client.setHttpRequestRetryHandler(new MarmottaHttpRequestRetryHandler());
+        return client;
+    }
+	
+	public static HttpPost createPost(String path, ClientConfiguration config) {
+    	String serviceUrl = config.getMarmottaUri() + path ;
+    	
+    	//FIXME: switch to a more elegant way, such as Jersey's UriBuilder
+    	if (StringUtils.isNotBlank(config.getMarmottaContext())) {
+    		serviceUrl += "?" + CONTEXT + "=" + config.getMarmottaContext();
+    	}
+
+        return new HttpPost(serviceUrl);
+	}
+
+
+    private static class MarmottaRedirectStrategy extends DefaultRedirectStrategy {
+        @Override
+        public boolean isRedirected(HttpRequest request, HttpResponse response, HttpContext context) throws ProtocolException {
+            if (response == null) {
+                throw new IllegalArgumentException("HTTP response may not be null");
+            }
+
+            int statusCode = response.getStatusLine().getStatusCode();
+            String method = request.getRequestLine().getMethod();
+            Header locationHeader = response.getFirstHeader("location");
+            switch (statusCode) {
+                case HttpStatus.SC_MOVED_TEMPORARILY:
+                    return (method.equalsIgnoreCase(HttpGet.METHOD_NAME)
+                            || method.equalsIgnoreCase(HttpHead.METHOD_NAME)) && locationHeader != null;
+                case HttpStatus.SC_MOVED_PERMANENTLY:
+                case HttpStatus.SC_TEMPORARY_REDIRECT:
+                    return method.equalsIgnoreCase(HttpGet.METHOD_NAME)
+                            || method.equalsIgnoreCase(HttpHead.METHOD_NAME);
+                case HttpStatus.SC_SEE_OTHER:
+                    return true;
+                case HttpStatus.SC_MULTIPLE_CHOICES:
+                    return true;
+                default:
+                    return false;
+            } //end of switch
+        }
+    }
+
+    private static class MarmottaHttpRequestRetryHandler implements HttpRequestRetryHandler {
+        /**
+         * Determines if a method should be retried after an IOException
+         * occurs during execution.
+         *
+         * @param exception      the exception that occurred
+         * @param executionCount the number of times this method has been
+         *                       unsuccessfully executed
+         * @param context        the context for the request execution
+         * @return <code>true</code> if the method should be retried, <code>false</code>
+         *         otherwise
+         */
+        @Override
+        public boolean retryRequest(IOException exception, int executionCount, HttpContext context) {
+            return false;
+        }
+    }
+
+    
+}

http://git-wip-us.apache.org/repos/asf/incubator-marmotta/blob/ed88a640/client/marmotta-client-java/src/main/java/org/apache/marmotta/client/util/RDFJSONParser.java
----------------------------------------------------------------------
diff --git a/client/marmotta-client-java/src/main/java/org/apache/marmotta/client/util/RDFJSONParser.java b/client/marmotta-client-java/src/main/java/org/apache/marmotta/client/util/RDFJSONParser.java
new file mode 100644
index 0000000..c337c54
--- /dev/null
+++ b/client/marmotta-client-java/src/main/java/org/apache/marmotta/client/util/RDFJSONParser.java
@@ -0,0 +1,153 @@
+/**
+ * Copyright (C) 2013 The Apache Software Foundation.
+ *
+ * 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.
+ */
+package org.apache.marmotta.client.util;
+
+import org.apache.marmotta.client.exception.ParseException;
+import org.apache.marmotta.client.model.meta.Metadata;
+import org.apache.marmotta.client.model.rdf.BNode;
+import org.apache.marmotta.client.model.rdf.Literal;
+import org.apache.marmotta.client.model.rdf.RDFNode;
+import org.apache.marmotta.client.model.rdf.URI;
+import org.codehaus.jackson.map.ObjectMapper;
+import org.codehaus.jackson.type.TypeReference;
+
+import java.io.IOException;
+import java.io.InputStream;
+import java.io.OutputStream;
+import java.util.HashMap;
+import java.util.HashSet;
+import java.util.Map;
+import java.util.Set;
+
+/**
+ * Parse RDF/JSON into a map-based representation.
+ * <p/>
+ * Author: Sebastian Schaffert
+ */
+public class RDFJSONParser {
+
+    @SuppressWarnings("unused")
+	private static final String HTTP = "http://";
+    private static final String VALUE = "value";
+    private static final String TYPE = "type";
+    private static final String TYPE_BNODE = "bnode";
+    private static final String TYPE_URI = "uri";
+    private static final String TYPE_LITERAL = "literal";
+    private static final String LANG = "lang";
+    private static final String DATATYPE = "datatype";
+
+    private RDFJSONParser() {
+		// static only
+	}
+    
+    public static Map<String,Metadata> parseRDFJSON(InputStream data) throws ParseException {
+        ObjectMapper mapper = new ObjectMapper();
+        try {
+            Map<String,Map<String,Set<Map<String,String>>>> subjects = mapper.readValue(data, new TypeReference<Map<String,Map<String,Set<Map<String,String>>>>>(){});
+
+            // convert "raw" map into a map to Metadata objects
+            Map<String,Metadata> result = new HashMap<String, Metadata>();
+            for(Map.Entry<String,Map<String,Set<Map<String,String>>>> subject : subjects.entrySet()) {
+                Metadata m = new Metadata(subject.getKey());
+                result.put(subject.getKey(),m);
+
+                for(Map.Entry<String,Set<Map<String,String>>> property : subject.getValue().entrySet()) {
+                    Set<RDFNode> propValue = new HashSet<RDFNode>();
+                    for(Map<String,String> value : property.getValue()) {
+                        propValue.add(parseRDFJSONNode(value));
+                    }
+                    m.put(property.getKey(),propValue);
+                }
+            }
+            return result;
+
+        } catch (IOException e) {
+            throw new ParseException("could not parse JSON data",e);
+        }
+
+    }
+
+    /**
+     * Parse the representation of a node in RDF/JSON into an RDFNode object
+     * @param nodeDef
+     * @return
+     */
+    public static RDFNode parseRDFJSONNode(Map<String, String> nodeDef) {
+        RDFNode object;
+
+        if( nodeDef.get(TYPE).equals(TYPE_URI) ) {
+            object = new URI(nodeDef.get(VALUE));
+        } else if( nodeDef.get(TYPE).equals(TYPE_BNODE) ) {
+            object = new BNode(nodeDef.get(VALUE));
+        } else {
+            if( nodeDef.get(LANG) != null ) {
+                object = new Literal(nodeDef.get(VALUE),nodeDef.get(LANG));
+            } else if( nodeDef.get(DATATYPE) != null) {
+                object = new Literal(nodeDef.get(VALUE),new URI(nodeDef.get(DATATYPE)));
+            } else {
+                object = new Literal(nodeDef.get(VALUE));
+            }
+        }
+        return object;
+    }
+    
+   
+    public static void serializeRDFJSON(Map<String,Metadata> data, OutputStream out) throws IOException {
+        ObjectMapper mapper = new ObjectMapper();
+
+
+        Map<String,Map<String,Set<Map<String,String>>>> subjects = new HashMap<String, Map<String, Set<Map<String, String>>>>();
+
+        
+        for(Map.Entry<String,Metadata> subject : data.entrySet()) {
+            //add or get predicate map
+            Map<String,Set<Map<String,String>>> predicates = new HashMap<String,Set<Map<String,String>>>();
+            subjects.put(subject.getKey(),predicates);
+            
+ 
+            for(Map.Entry<String,Set<RDFNode>> predicate : subject.getValue().entrySet()) {
+                //add or get object set
+                Set<Map<String,String>> objects = new HashSet<Map<String,String>>();
+                predicates.put(predicate.getKey(),objects);
+
+                //add objects
+                for(RDFNode objectNode : predicate.getValue()) {
+                    Map<String,String> object = new HashMap<String,String>();
+                    if( objectNode instanceof Literal) {
+                        object.put(TYPE,TYPE_LITERAL);
+                        object.put(VALUE,((Literal)objectNode).getContent());
+                        if(((Literal) objectNode).getLanguage() != null )
+                            object.put(LANG,((Literal) objectNode).getLanguage());
+                        if(((Literal) objectNode).getType() != null)
+                            object.put(DATATYPE,((Literal) objectNode).getType().getUri());
+                    } else {
+                        if( objectNode instanceof URI ) {
+                            object.put(TYPE,TYPE_URI);
+                            object.put(VALUE,((URI)objectNode).getUri());
+                        } else {
+                            object.put(TYPE,TYPE_BNODE);
+                            object.put(VALUE,((BNode)objectNode).getAnonId());
+                        }
+                    }
+                    objects.add(object);
+                }
+            }
+                
+        }
+        mapper.writeValue(out,subjects);
+                
+    }
+}

http://git-wip-us.apache.org/repos/asf/incubator-marmotta/blob/ed88a640/client/marmotta-client-java/src/test/java/at/newmedialab/lmf/client/test/config/ConfigurationIT.java
----------------------------------------------------------------------
diff --git a/client/marmotta-client-java/src/test/java/at/newmedialab/lmf/client/test/config/ConfigurationIT.java b/client/marmotta-client-java/src/test/java/at/newmedialab/lmf/client/test/config/ConfigurationIT.java
deleted file mode 100644
index 4d0868c..0000000
--- a/client/marmotta-client-java/src/test/java/at/newmedialab/lmf/client/test/config/ConfigurationIT.java
+++ /dev/null
@@ -1,139 +0,0 @@
-/**
- * Copyright (C) 2013 The Apache Software Foundation.
- *
- * 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.
- */
-package at.newmedialab.lmf.client.test.config;
-
-import at.newmedialab.lmf.client.ClientConfiguration;
-import at.newmedialab.lmf.client.clients.ConfigurationClient;
-import at.newmedialab.lmf.client.exception.LMFClientException;
-import at.newmedialab.lmf.client.model.config.Configuration;
-import com.google.common.collect.Lists;
-import org.apache.marmotta.platform.core.test.base.JettyMarmotta;
-import org.apache.marmotta.platform.core.webservices.config.ConfigurationWebService;
-import org.hamcrest.Matchers;
-import org.junit.AfterClass;
-import org.junit.Assert;
-import org.junit.BeforeClass;
-import org.junit.Test;
-
-import java.io.IOException;
-import java.util.Set;
-
-/**
- * Add file description here!
- * <p/>
- * Author: Sebastian Schaffert
- */
-public class ConfigurationIT {
-
-
-    private static JettyMarmotta lmf;
-
-    private static ClientConfiguration config;
-
-    @BeforeClass
-    public static void init() {
-        lmf = new JettyMarmotta("/LMF",8080, ConfigurationWebService.class);
-
-        config = new ClientConfiguration("http://localhost:8080/LMF");
-
-    }
-
-    @AfterClass
-    public static void tearDown() {
-        lmf.shutdown();
-    }
-
-
-
-    @Test
-    public void testListConfigurationKeys() throws LMFClientException, IOException {
-        ConfigurationClient client = new ConfigurationClient(config);
-        
-        Set<String> keys = client.listConfigurationKeys();
-        Assert.assertNotNull(keys);
-        Assert.assertThat(keys, Matchers.hasItem("kiwi.host"));
-    }
-
-    @Test
-    public void testListConfigurations() throws LMFClientException, IOException {
-        ConfigurationClient client = new ConfigurationClient(config);
-
-        Set<Configuration> cfgs1 = client.listConfigurations(null);
-        Assert.assertNotNull(cfgs1);
-        Assert.assertTrue(cfgs1.size() > 0);
-
-
-        Set<Configuration> cfgs2 = client.listConfigurations("kiwi");
-        Assert.assertNotNull(cfgs2);
-        Assert.assertTrue(cfgs2.size() > 0);
-
-        Set<Configuration> cfgs3 = client.listConfigurations("brzlbrnft");
-        Assert.assertNotNull(cfgs3);
-        Assert.assertTrue(cfgs3.size() == 0);
-    }
-
-    @Test
-    public void testGetConfiguration() throws LMFClientException, IOException {
-        ConfigurationClient client = new ConfigurationClient(config);
-
-        Configuration c_version = client.getConfiguration("kiwi.version");
-        Assert.assertNotNull(c_version);
-
-        Configuration c_path = client.getConfiguration("kiwi.path");
-        Assert.assertNotNull(c_path);
-        Assert.assertEquals("/LMF",c_path.getString());
-
-        Configuration c_allow = client.getConfiguration("kiwi.allow_methods");
-        Assert.assertNotNull(c_allow);
-        Assert.assertThat(c_allow.getList(),Matchers.hasItem("POST"));
-    }
-
-
-    @Test
-    public void testSetConfiguration() throws LMFClientException, IOException {
-        ConfigurationClient client = new ConfigurationClient(config);
-
-        // set a single-value string configuration
-        client.setConfiguration("lmfclient.test.single","abc");
-        Configuration c_single = client.getConfiguration("lmfclient.test.single");
-        Assert.assertNotNull(c_single);
-        Assert.assertEquals("abc",c_single.getString());
-        client.deleteConfiguration("lmfclient.test.single");
-        c_single = client.getConfiguration("lmfclient.test.single");
-        Assert.assertNull(c_single);
-
-        // set a single-value boolean configuration
-        client.setConfiguration("lmfclient.test.bool",true);
-        Configuration c_bool = client.getConfiguration("lmfclient.test.bool");
-        Assert.assertNotNull(c_bool);
-        Assert.assertEquals("true",c_bool.getString());
-        client.deleteConfiguration("lmfclient.test.bool");
-        c_bool = client.getConfiguration("lmfclient.test.bool");
-        Assert.assertNull(c_bool);
-
-
-        // set a list value configuration
-        client.setConfiguration("lmfclient.test.list", Lists.newArrayList("abc","efg","hij"));
-        Configuration c_list = client.getConfiguration("lmfclient.test.list");
-        Assert.assertNotNull(c_list);
-        Assert.assertThat(c_list.getList(), Matchers.hasItem("efg"));
-        client.deleteConfiguration("lmfclient.test.list");
-        c_list = client.getConfiguration("lmfclient.test.list");
-        Assert.assertNull(c_list);
-    }
-
-
-}

http://git-wip-us.apache.org/repos/asf/incubator-marmotta/blob/ed88a640/client/marmotta-client-java/src/test/java/at/newmedialab/lmf/client/test/io/ImportIT.java
----------------------------------------------------------------------
diff --git a/client/marmotta-client-java/src/test/java/at/newmedialab/lmf/client/test/io/ImportIT.java b/client/marmotta-client-java/src/test/java/at/newmedialab/lmf/client/test/io/ImportIT.java
deleted file mode 100644
index 9e813a7..0000000
--- a/client/marmotta-client-java/src/test/java/at/newmedialab/lmf/client/test/io/ImportIT.java
+++ /dev/null
@@ -1,76 +0,0 @@
-/**
- * Copyright (C) 2013 The Apache Software Foundation.
- *
- * 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.
- */
-package at.newmedialab.lmf.client.test.io;
-
-import at.newmedialab.lmf.client.ClientConfiguration;
-import at.newmedialab.lmf.client.clients.ImportClient;
-import at.newmedialab.lmf.client.clients.ResourceClient;
-import at.newmedialab.lmf.client.exception.LMFClientException;
-import at.newmedialab.lmf.client.model.meta.Metadata;
-import org.apache.marmotta.platform.core.test.base.JettyMarmotta;
-import org.apache.marmotta.platform.core.webservices.io.ImportWebService;
-import org.apache.marmotta.platform.core.webservices.resource.MetaWebService;
-import org.apache.marmotta.platform.core.webservices.resource.ResourceWebService;
-import org.junit.AfterClass;
-import org.junit.Assert;
-import org.junit.BeforeClass;
-import org.junit.Test;
-
-import java.io.IOException;
-
-/**
- * Add file description here!
- * <p/>
- * Author: Sebastian Schaffert
- */
-public class ImportIT {
-
-    private static JettyMarmotta lmf;
-
-    private static ClientConfiguration config;
-
-    @BeforeClass
-    public static void init() {
-        lmf = new JettyMarmotta("/LMF", 8080, ImportWebService.class, ResourceWebService.class, MetaWebService.class);
-
-        config = new ClientConfiguration("http://localhost:8080/LMF");
-
-    }
-
-    @AfterClass
-    public static void tearDown() {
-        lmf.shutdown();
-    }
-
-
-
-    @Test
-    public void testUpload() throws IOException, LMFClientException {
-        ImportClient client = new ImportClient(config);
-
-        String data = "<http://example.com/resource/r1> <http://example.com/resource/p1> \"Test Data\".";
-        client.uploadDataset(data,"text/rdf+n3");
-
-        ResourceClient resourceClient = new ResourceClient(config);
-        Metadata m = resourceClient.getResourceMetadata("http://example.com/resource/r1");
-        Assert.assertNotNull(m);
-        Assert.assertEquals(1,m.size());
-        Assert.assertEquals("Test Data", m.getFirst("http://example.com/resource/p1").toString());
-
-        resourceClient.deleteResource("http://example.com/resource/r1");
-    }
-
-}

http://git-wip-us.apache.org/repos/asf/incubator-marmotta/blob/ed88a640/client/marmotta-client-java/src/test/java/at/newmedialab/lmf/client/test/ldpath/LDPathIT.java
----------------------------------------------------------------------
diff --git a/client/marmotta-client-java/src/test/java/at/newmedialab/lmf/client/test/ldpath/LDPathIT.java b/client/marmotta-client-java/src/test/java/at/newmedialab/lmf/client/test/ldpath/LDPathIT.java
deleted file mode 100644
index cbfc063..0000000
--- a/client/marmotta-client-java/src/test/java/at/newmedialab/lmf/client/test/ldpath/LDPathIT.java
+++ /dev/null
@@ -1,90 +0,0 @@
-/**
- * Copyright (C) 2013 The Apache Software Foundation.
- *
- * 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.
- */
-package at.newmedialab.lmf.client.test.ldpath;
-
-import at.newmedialab.lmf.client.ClientConfiguration;
-import at.newmedialab.lmf.client.clients.LDPathClient;
-import at.newmedialab.lmf.client.model.rdf.RDFNode;
-import org.apache.marmotta.platform.core.exception.io.MarmottaImportException;
-import org.apache.marmotta.platform.ldpath.webservices.LDPathWebService;
-import org.apache.marmotta.platform.core.api.importer.ImportService;
-import org.apache.marmotta.platform.core.test.base.JettyMarmotta;
-import org.hamcrest.CoreMatchers;
-import org.junit.AfterClass;
-import org.junit.Assert;
-import org.junit.BeforeClass;
-import org.junit.Test;
-
-import java.io.InputStream;
-import java.util.List;
-import java.util.Map;
-
-import static org.hamcrest.Matchers.*;
-
-/**
- * Add file description here!
- * <p/>
- * Author: Sebastian Schaffert
- */
-public class LDPathIT {
-
-
-    private static JettyMarmotta lmf;
-
-    private static ClientConfiguration config;
-
-    // the tests require the demo-data.foaf to be loaded; we do so by first calling the import service before we start with tests
-    private static ImportService importService;
-
-    @BeforeClass
-    public static void init() throws MarmottaImportException {
-        lmf = new JettyMarmotta("/LMF",8080, LDPathWebService.class);
-
-        config = new ClientConfiguration("http://localhost:8080/LMF");
-
-        importService = lmf.getService(ImportService.class);
-
-        // load initial data
-        InputStream data =  LDPathIT.class.getResourceAsStream("/demo-data.foaf");
-
-        importService.importData(data,"application/rdf+xml",null,null);
-    }
-
-    @AfterClass
-    public static void tearDown() {
-        lmf.shutdown();
-    }
-
-
-    @Test
-    public void testPath() throws Exception {
-        LDPathClient client = new LDPathClient(config);
-
-        List<RDFNode> result = client.evaluatePath("http://localhost:8080/LMF/resource/anna_schmidt", "foaf:knows / foaf:name");
-        Assert.assertThat(result, CoreMatchers.<RDFNode> hasItem(hasProperty("content", equalTo("Sepp Huber"))));
-    }
-
-
-    @Test
-    public void testProgram() throws Exception {
-        LDPathClient client = new LDPathClient(config);
-
-        Map<String, List<RDFNode>> result = client.evaluateProgram("http://localhost:8080/LMF/resource/hans_meier", "friend = foaf:knows / foaf:name :: xsd:string; name = foaf:name :: xsd:string; interest   = foaf:interest / (rdfs:label[@en] | rdfs:label[@none] | <http://rdf.freebase.com/ns/type.object.name>[@en]) :: xsd:string;");
-        Assert.assertThat(result,hasKey("interest"));
-        Assert.assertThat(result.get("interest"), CoreMatchers.<RDFNode> hasItem(hasProperty("content", equalTo("GNU/Linux"))));
-
-    }
-}

http://git-wip-us.apache.org/repos/asf/incubator-marmotta/blob/ed88a640/client/marmotta-client-java/src/test/java/at/newmedialab/lmf/client/test/sparql/SPARQLIT.java
----------------------------------------------------------------------
diff --git a/client/marmotta-client-java/src/test/java/at/newmedialab/lmf/client/test/sparql/SPARQLIT.java b/client/marmotta-client-java/src/test/java/at/newmedialab/lmf/client/test/sparql/SPARQLIT.java
deleted file mode 100644
index a45c4d9..0000000
--- a/client/marmotta-client-java/src/test/java/at/newmedialab/lmf/client/test/sparql/SPARQLIT.java
+++ /dev/null
@@ -1,92 +0,0 @@
-/**
- * Copyright (C) 2013 The Apache Software Foundation.
- *
- * 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.
- */
-package at.newmedialab.lmf.client.test.sparql;
-
-import at.newmedialab.lmf.client.ClientConfiguration;
-import at.newmedialab.lmf.client.clients.SPARQLClient;
-import at.newmedialab.lmf.client.model.sparql.SPARQLResult;
-import at.newmedialab.lmf.client.test.ldpath.LDPathIT;
-import org.apache.marmotta.platform.core.api.importer.ImportService;
-import org.apache.marmotta.platform.core.exception.io.MarmottaImportException;
-import org.apache.marmotta.platform.core.test.base.JettyMarmotta;
-import org.hamcrest.Matcher;
-import org.junit.AfterClass;
-import org.junit.Assert;
-import org.junit.BeforeClass;
-import org.junit.Test;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
-
-import java.io.InputStream;
-
-import static org.hamcrest.Matchers.*;
-
-/**
- * Add file description here!
- * <p/>
- * Author: Sebastian Schaffert
- */
-public class SPARQLIT {
-    private final static Logger log = LoggerFactory.getLogger(SPARQLIT.class);
-
-    private static JettyMarmotta lmf;
-
-    private static ClientConfiguration config;
-
-    // the tests require the demo-data.foaf to be loaded; we do so by first calling the import service before we start with tests
-    private static ImportService importService;
-
-
-    @BeforeClass
-    public static void init() throws MarmottaImportException {
-        lmf = new JettyMarmotta("/LMF",8080);
-        config = new ClientConfiguration("http://localhost:8080/LMF");
-
-        importService = lmf.getService(ImportService.class);
-
-        // load initial data
-        InputStream data =  LDPathIT.class.getResourceAsStream("/demo-data.foaf");
-
-        importService.importData(data,"application/rdf+xml",null,null);
-    }
-
-    @AfterClass
-    public static void tearDown() {
-        lmf.shutdown();
-    }
-
-
-    @Test
-    public void testSparqlSelect() throws Exception {
-        SPARQLClient client = new SPARQLClient(config);
-
-        SPARQLResult result = client.select("SELECT ?r ?n WHERE { ?r <http://xmlns.com/foaf/0.1/name> ?n }");
-        Assert.assertEquals(3, result.size());
-        Assert.assertThat(result, (Matcher) hasItems(hasKey("r"), hasKey("n")));
-        Assert.assertThat(result,(Matcher)hasItem(hasValue(hasProperty("content", equalTo("Sepp Huber")))));
-    }
-
-
-    @Test
-    public void testSparqlAsk() throws Exception {
-        SPARQLClient client = new SPARQLClient(config);
-
-        boolean result = client.ask("ASK { ?r <http://xmlns.com/foaf/0.1/name> ?n }");
-        Assert.assertTrue(result);
-
-    }
-
-}

http://git-wip-us.apache.org/repos/asf/incubator-marmotta/blob/ed88a640/client/marmotta-client-java/src/test/java/org/apache/marmotta/client/test/AbstractClientIT.java
----------------------------------------------------------------------
diff --git a/client/marmotta-client-java/src/test/java/org/apache/marmotta/client/test/AbstractClientIT.java b/client/marmotta-client-java/src/test/java/org/apache/marmotta/client/test/AbstractClientIT.java
new file mode 100644
index 0000000..b75450e
--- /dev/null
+++ b/client/marmotta-client-java/src/test/java/org/apache/marmotta/client/test/AbstractClientIT.java
@@ -0,0 +1,15 @@
+package org.apache.marmotta.client.test;
+
+import java.io.InputStream;
+
+import org.junit.Assume;
+
+public abstract class AbstractClientIT {
+
+	protected static InputStream getTestData(String fName) {
+		InputStream data = AbstractClientIT.class.getResourceAsStream(fName);
+		Assume.assumeNotNull("could not load test-data '" + fName + "'", data);
+		return data;
+	}
+	
+}

http://git-wip-us.apache.org/repos/asf/incubator-marmotta/blob/ed88a640/client/marmotta-client-java/src/test/java/org/apache/marmotta/client/test/config/ConfigurationIT.java
----------------------------------------------------------------------
diff --git a/client/marmotta-client-java/src/test/java/org/apache/marmotta/client/test/config/ConfigurationIT.java b/client/marmotta-client-java/src/test/java/org/apache/marmotta/client/test/config/ConfigurationIT.java
new file mode 100644
index 0000000..1c02b4d
--- /dev/null
+++ b/client/marmotta-client-java/src/test/java/org/apache/marmotta/client/test/config/ConfigurationIT.java
@@ -0,0 +1,140 @@
+/**
+ * Copyright (C) 2013 The Apache Software Foundation.
+ *
+ * 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.
+ */
+package org.apache.marmotta.client.test.config;
+
+import com.google.common.collect.Lists;
+
+import org.apache.marmotta.client.ClientConfiguration;
+import org.apache.marmotta.client.clients.ConfigurationClient;
+import org.apache.marmotta.client.exception.MarmottaClientException;
+import org.apache.marmotta.client.model.config.Configuration;
+import org.apache.marmotta.platform.core.test.base.JettyMarmotta;
+import org.apache.marmotta.platform.core.webservices.config.ConfigurationWebService;
+import org.hamcrest.Matchers;
+import org.junit.AfterClass;
+import org.junit.Assert;
+import org.junit.BeforeClass;
+import org.junit.Test;
+
+import java.io.IOException;
+import java.util.Set;
+
+/**
+ * Add file description here!
+ * <p/>
+ * Author: Sebastian Schaffert
+ */
+public class ConfigurationIT {
+
+
+    private static JettyMarmotta marmotta;
+
+    private static ClientConfiguration config;
+
+    @BeforeClass
+    public static void init() {
+        marmotta = new JettyMarmotta("/Marmotta",8080, ConfigurationWebService.class);
+
+        config = new ClientConfiguration("http://localhost:8080/Marmotta");
+
+    }
+
+    @AfterClass
+    public static void tearDown() {
+        marmotta.shutdown();
+    }
+
+
+
+    @Test
+    public void testListConfigurationKeys() throws MarmottaClientException, IOException {
+        ConfigurationClient client = new ConfigurationClient(config);
+        
+        Set<String> keys = client.listConfigurationKeys();
+        Assert.assertNotNull(keys);
+        Assert.assertThat(keys, Matchers.hasItem("kiwi.host"));
+    }
+
+    @Test
+    public void testListConfigurations() throws MarmottaClientException, IOException {
+        ConfigurationClient client = new ConfigurationClient(config);
+
+        Set<Configuration> cfgs1 = client.listConfigurations(null);
+        Assert.assertNotNull(cfgs1);
+        Assert.assertTrue(cfgs1.size() > 0);
+
+
+        Set<Configuration> cfgs2 = client.listConfigurations("kiwi");
+        Assert.assertNotNull(cfgs2);
+        Assert.assertTrue(cfgs2.size() > 0);
+
+        Set<Configuration> cfgs3 = client.listConfigurations("brzlbrnft");
+        Assert.assertNotNull(cfgs3);
+        Assert.assertTrue(cfgs3.size() == 0);
+    }
+
+    @Test
+    public void testGetConfiguration() throws MarmottaClientException, IOException {
+        ConfigurationClient client = new ConfigurationClient(config);
+
+        Configuration c_version = client.getConfiguration("kiwi.version");
+        Assert.assertNotNull(c_version);
+
+        Configuration c_path = client.getConfiguration("kiwi.path");
+        Assert.assertNotNull(c_path);
+        Assert.assertEquals("/Marmotta",c_path.getString());
+
+        Configuration c_allow = client.getConfiguration("kiwi.allow_methods");
+        Assert.assertNotNull(c_allow);
+        Assert.assertThat(c_allow.getList(),Matchers.hasItem("POST"));
+    }
+
+
+    @Test
+    public void testSetConfiguration() throws MarmottaClientException, IOException {
+        ConfigurationClient client = new ConfigurationClient(config);
+
+        // set a single-value string configuration
+        client.setConfiguration("marmottaclient.test.single","abc");
+        Configuration c_single = client.getConfiguration("marmottaclient.test.single");
+        Assert.assertNotNull(c_single);
+        Assert.assertEquals("abc",c_single.getString());
+        client.deleteConfiguration("marmottaclient.test.single");
+        c_single = client.getConfiguration("marmottaclient.test.single");
+        Assert.assertNull(c_single);
+
+        // set a single-value boolean configuration
+        client.setConfiguration("marmottaclient.test.bool",true);
+        Configuration c_bool = client.getConfiguration("marmottaclient.test.bool");
+        Assert.assertNotNull(c_bool);
+        Assert.assertEquals("true",c_bool.getString());
+        client.deleteConfiguration("marmottaclient.test.bool");
+        c_bool = client.getConfiguration("marmottaclient.test.bool");
+        Assert.assertNull(c_bool);
+
+
+        // set a list value configuration
+        client.setConfiguration("marmottaclient.test.list", Lists.newArrayList("abc","efg","hij"));
+        Configuration c_list = client.getConfiguration("marmottaclient.test.list");
+        Assert.assertNotNull(c_list);
+        Assert.assertThat(c_list.getList(), Matchers.hasItem("efg"));
+        client.deleteConfiguration("marmottaclient.test.list");
+        c_list = client.getConfiguration("marmottaclient.test.list");
+        Assert.assertNull(c_list);
+    }
+
+
+}

http://git-wip-us.apache.org/repos/asf/incubator-marmotta/blob/ed88a640/client/marmotta-client-java/src/test/java/org/apache/marmotta/client/test/io/ImportIT.java
----------------------------------------------------------------------
diff --git a/client/marmotta-client-java/src/test/java/org/apache/marmotta/client/test/io/ImportIT.java b/client/marmotta-client-java/src/test/java/org/apache/marmotta/client/test/io/ImportIT.java
new file mode 100644
index 0000000..27c36a5
--- /dev/null
+++ b/client/marmotta-client-java/src/test/java/org/apache/marmotta/client/test/io/ImportIT.java
@@ -0,0 +1,76 @@
+/**
+ * Copyright (C) 2013 The Apache Software Foundation.
+ *
+ * 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.
+ */
+package org.apache.marmotta.client.test.io;
+
+import org.apache.marmotta.client.ClientConfiguration;
+import org.apache.marmotta.client.clients.ImportClient;
+import org.apache.marmotta.client.clients.ResourceClient;
+import org.apache.marmotta.client.exception.MarmottaClientException;
+import org.apache.marmotta.client.model.meta.Metadata;
+import org.apache.marmotta.platform.core.test.base.JettyMarmotta;
+import org.apache.marmotta.platform.core.webservices.io.ImportWebService;
+import org.apache.marmotta.platform.core.webservices.resource.MetaWebService;
+import org.apache.marmotta.platform.core.webservices.resource.ResourceWebService;
+import org.junit.AfterClass;
+import org.junit.Assert;
+import org.junit.BeforeClass;
+import org.junit.Test;
+
+import java.io.IOException;
+
+/**
+ * Add file description here!
+ * <p/>
+ * Author: Sebastian Schaffert
+ */
+public class ImportIT {
+
+    private static JettyMarmotta marmotta;
+
+    private static ClientConfiguration config;
+
+    @BeforeClass
+    public static void init() {
+        marmotta = new JettyMarmotta("/Marmotta", 8080, ImportWebService.class, ResourceWebService.class, MetaWebService.class);
+
+        config = new ClientConfiguration("http://localhost:8080/Marmotta");
+
+    }
+
+    @AfterClass
+    public static void tearDown() {
+        marmotta.shutdown();
+    }
+
+
+
+    @Test
+    public void testUpload() throws IOException, MarmottaClientException {
+        ImportClient client = new ImportClient(config);
+
+        String data = "<http://example.com/resource/r1> <http://example.com/resource/p1> \"Test Data\".";
+        client.uploadDataset(data,"text/rdf+n3");
+
+        ResourceClient resourceClient = new ResourceClient(config);
+        Metadata m = resourceClient.getResourceMetadata("http://example.com/resource/r1");
+        Assert.assertNotNull(m);
+        Assert.assertEquals(1,m.size());
+        Assert.assertEquals("Test Data", m.getFirst("http://example.com/resource/p1").toString());
+
+        resourceClient.deleteResource("http://example.com/resource/r1");
+    }
+
+}

http://git-wip-us.apache.org/repos/asf/incubator-marmotta/blob/ed88a640/client/marmotta-client-java/src/test/java/org/apache/marmotta/client/test/ldpath/LDPathIT.java
----------------------------------------------------------------------
diff --git a/client/marmotta-client-java/src/test/java/org/apache/marmotta/client/test/ldpath/LDPathIT.java b/client/marmotta-client-java/src/test/java/org/apache/marmotta/client/test/ldpath/LDPathIT.java
new file mode 100644
index 0000000..6e105c6
--- /dev/null
+++ b/client/marmotta-client-java/src/test/java/org/apache/marmotta/client/test/ldpath/LDPathIT.java
@@ -0,0 +1,98 @@
+/**
+ * Copyright (C) 2013 The Apache Software Foundation.
+ *
+ * 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.
+ */
+package org.apache.marmotta.client.test.ldpath;
+
+import org.apache.marmotta.client.ClientConfiguration;
+import org.apache.marmotta.client.clients.LDPathClient;
+import org.apache.marmotta.client.exception.NotFoundException;
+import org.apache.marmotta.client.model.rdf.RDFNode;
+import org.apache.marmotta.client.test.AbstractClientIT;
+import org.apache.marmotta.platform.core.exception.io.MarmottaImportException;
+import org.apache.marmotta.platform.ldpath.webservices.LDPathWebService;
+import org.apache.marmotta.platform.core.api.importer.ImportService;
+import org.apache.marmotta.platform.core.test.base.JettyMarmotta;
+import org.hamcrest.CoreMatchers;
+import org.junit.AfterClass;
+import org.junit.Assert;
+import org.junit.Assume;
+import org.junit.BeforeClass;
+import org.junit.Test;
+
+import java.io.InputStream;
+import java.util.List;
+import java.util.Map;
+
+import static org.hamcrest.Matchers.*;
+
+/**
+ * Add file description here!
+ * <p/>
+ * Author: Sebastian Schaffert
+ */
+public class LDPathIT extends AbstractClientIT {
+
+
+    private static JettyMarmotta marmotta;
+
+    private static ClientConfiguration config;
+
+    // the tests require the demo-data.foaf to be loaded; we do so by first calling the import service before we start with tests
+    private static ImportService importService;
+
+    @BeforeClass
+    public static void init() throws MarmottaImportException {
+        marmotta = new JettyMarmotta("/Marmotta",8080, LDPathWebService.class);
+
+        config = new ClientConfiguration("http://localhost:8080/Marmotta");
+
+        importService = marmotta.getService(ImportService.class);
+
+        // load initial data
+        InputStream data =  getTestData("demo-data.foaf");
+
+        importService.importData(data,"application/rdf+xml",null,null);
+    }
+
+    @AfterClass
+    public static void tearDown() {
+        marmotta.shutdown();
+    }
+
+
+    @Test
+    public void testPath() throws Exception {
+        LDPathClient client = new LDPathClient(config);
+        try {
+	        List<RDFNode> result = client.evaluatePath("http://localhost:8080/Marmotta/resource/anna_schmidt", "foaf:knows / foaf:name");
+	        Assert.assertThat(result, CoreMatchers.<RDFNode> hasItem(hasProperty("content", equalTo("Sepp Huber"))));
+        } catch (NotFoundException e) {
+        	Assert.fail(e.getMessage());
+        }
+    }
+
+
+    @Test
+    public void testProgram() throws Exception {
+        LDPathClient client = new LDPathClient(config);
+    	try {
+	        Map<String, List<RDFNode>> result = client.evaluateProgram("http://localhost:8080/Marmotta/resource/hans_meier", "friend = foaf:knows / foaf:name :: xsd:string; name = foaf:name :: xsd:string; interest   = foaf:interest / (rdfs:label[@en] | rdfs:label[@none] | <http://rdf.freebase.com/ns/type.object.name>[@en]) :: xsd:string;");
+	        Assert.assertThat(result,hasKey("interest"));
+	        Assert.assertThat(result.get("interest"), CoreMatchers.<RDFNode> hasItem(hasProperty("content", equalTo("GNU/Linux"))));
+	    } catch (NotFoundException e) {
+	    	Assert.fail(e.getMessage());
+	    }
+    }
+}