Repository: marmotta
Updated Branches:
  refs/heads/develop ed387b973 -> 0ff22a0c3


http://git-wip-us.apache.org/repos/asf/marmotta/blob/0ff22a0c/libraries/ostrich/model/src/main/java/org/apache/marmotta/ostrich/model/ProtoDatatypeLiteral.java
----------------------------------------------------------------------
diff --git 
a/libraries/ostrich/model/src/main/java/org/apache/marmotta/ostrich/model/ProtoDatatypeLiteral.java
 
b/libraries/ostrich/model/src/main/java/org/apache/marmotta/ostrich/model/ProtoDatatypeLiteral.java
new file mode 100644
index 0000000..efaca0d
--- /dev/null
+++ 
b/libraries/ostrich/model/src/main/java/org/apache/marmotta/ostrich/model/ProtoDatatypeLiteral.java
@@ -0,0 +1,106 @@
+/*
+ * 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.ostrich.model;
+
+import org.apache.marmotta.ostrich.model.proto.Model;
+import org.openrdf.model.BNode;
+import org.openrdf.model.Literal;
+import org.openrdf.model.URI;
+
+/**
+ * Add file description here!
+ *
+ * @author Sebastian Schaffert ([email protected])
+ */
+public class ProtoDatatypeLiteral extends ProtoLiteralBase implements Literal {
+
+    private Model.DatatypeLiteral message;
+
+    public ProtoDatatypeLiteral(Model.DatatypeLiteral message) {
+        this.message = message;
+    }
+
+    public ProtoDatatypeLiteral(String content) {
+        this.message = Model.DatatypeLiteral.newBuilder()
+                .setContent(content)
+                .build();
+    }
+
+    public ProtoDatatypeLiteral(String content, URI datatype) {
+        this.message = Model.DatatypeLiteral.newBuilder()
+                .setContent(content)
+                
.setDatatype(Model.URI.newBuilder().setUri(datatype.stringValue()).build())
+                .build();
+    }
+
+    public ProtoDatatypeLiteral(String content, String datatype) {
+        this.message = Model.DatatypeLiteral.newBuilder()
+                .setContent(content)
+                .setDatatype(Model.URI.newBuilder().setUri(datatype).build())
+                .build();
+    }
+
+    public Model.DatatypeLiteral getMessage() {
+        return message;
+    }
+
+    /**
+     * Gets the label of this literal.
+     *
+     * @return The literal's label.
+     */
+    @Override
+    public String getLabel() {
+        return message.getContent();
+    }
+
+    /**
+     * Gets the language tag for this literal, normalized to lower case.
+     *
+     * @return The language tag for this literal, or <tt>null</tt> if it
+     * doesn't have one.
+     */
+    @Override
+    public String getLanguage() {
+        return null;
+    }
+
+    /**
+     * Gets the datatype for this literal.
+     *
+     * @return The datatype for this literal, or <tt>null</tt> if it doesn't
+     * have one.
+     */
+    @Override
+    public URI getDatatype() {
+        if (!message.hasDatatype()) {
+            return null;
+        }
+        return new ProtoURI(message.getDatatype());
+    }
+
+
+    /**
+     * Returns the String-value of a <tt>Value</tt> object. This returns either
+     * a {@link Literal}'s label, a {@link URI}'s URI or a {@link BNode}'s ID.
+     */
+    @Override
+    public String stringValue() {
+        return message.getContent();
+    }
+}

http://git-wip-us.apache.org/repos/asf/marmotta/blob/0ff22a0c/libraries/ostrich/model/src/main/java/org/apache/marmotta/ostrich/model/ProtoLiteralBase.java
----------------------------------------------------------------------
diff --git 
a/libraries/ostrich/model/src/main/java/org/apache/marmotta/ostrich/model/ProtoLiteralBase.java
 
b/libraries/ostrich/model/src/main/java/org/apache/marmotta/ostrich/model/ProtoLiteralBase.java
new file mode 100644
index 0000000..559258f
--- /dev/null
+++ 
b/libraries/ostrich/model/src/main/java/org/apache/marmotta/ostrich/model/ProtoLiteralBase.java
@@ -0,0 +1,187 @@
+/*
+ * 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.ostrich.model;
+
+import org.apache.marmotta.commons.util.DateUtils;
+import org.openrdf.model.Literal;
+import org.openrdf.model.datatypes.XMLDatatypeUtil;
+
+import javax.xml.datatype.XMLGregorianCalendar;
+import java.math.BigDecimal;
+import java.math.BigInteger;
+import java.util.Date;
+
+/**
+ * Base functionality for both types of literals (type conversions, equals, 
etc).
+ *
+ * @author Sebastian Schaffert ([email protected])
+ */
+public abstract class ProtoLiteralBase implements Literal {
+
+
+    /**
+     * Returns the <tt>boolean</tt> value of this literal.
+     *
+     * @return The <tt>long</tt> value of the literal.
+     * @throws IllegalArgumentException If the literal's label cannot be 
represented by a <tt>boolean</tt>.
+     */
+    @Override
+    public boolean booleanValue() {
+        return Boolean.parseBoolean(getLabel());
+    }
+
+
+    /**
+     * Returns the <tt>byte</tt> value of this literal.
+     *
+     * @return The <tt>byte value of the literal.
+     * @throws NumberFormatException If the literal cannot be represented by a 
<tt>byte</tt>.
+     */
+    @Override
+    public byte byteValue() {
+        return Byte.parseByte(getLabel());
+    }
+
+    /**
+     * Returns the <tt>short</tt> value of this literal.
+     *
+     * @return The <tt>short</tt> value of the literal.
+     * @throws NumberFormatException If the literal's label cannot be 
represented by a <tt>short</tt>.
+     */
+    @Override
+    public short shortValue() {
+        return Short.parseShort(getLabel());
+    }
+
+    /**
+     * Returns the <tt>int</tt> value of this literal.
+     *
+     * @return The <tt>int</tt> value of the literal.
+     * @throws NumberFormatException If the literal's label cannot be 
represented by a <tt>int</tt>.
+     */
+    @Override
+    public int intValue() {
+        return Integer.parseInt(getLabel());
+    }
+
+    /**
+     * Returns the <tt>long</tt> value of this literal.
+     *
+     * @return The <tt>long</tt> value of the literal.
+     * @throws NumberFormatException If the literal's label cannot be 
represented by to a <tt>long</tt>.
+     */
+    @Override
+    public long longValue() {
+        return Long.parseLong(getLabel());
+    }
+
+    /**
+     * Returns the integer value of this literal.
+     *
+     * @return The integer value of the literal.
+     * @throws NumberFormatException If the literal's label is not a valid 
integer.
+     */
+    @Override
+    public BigInteger integerValue() {
+        return new BigInteger(getLabel());
+    }
+
+    /**
+     * Returns the decimal value of this literal.
+     *
+     * @return The decimal value of the literal.
+     * @throws NumberFormatException If the literal's label is not a valid 
decimal.
+     */
+    @Override
+    public BigDecimal decimalValue() {
+        return new BigDecimal(getLabel());
+    }
+
+    /**
+     * Returns the <tt>float</tt> value of this literal.
+     *
+     * @return The <tt>float</tt> value of the literal.
+     * @throws NumberFormatException If the literal's label cannot be 
represented by a <tt>float</tt>.
+     */
+    @Override
+    public float floatValue() {
+        return Float.parseFloat(getLabel());
+    }
+
+    /**
+     * Returns the <tt>double</tt> value of this literal.
+     *
+     * @return The <tt>double</tt> value of the literal.
+     * @throws NumberFormatException If the literal's label cannot be 
represented by a <tt>double</tt>.
+     */
+    @Override
+    public double doubleValue() {
+        return Double.parseDouble(getLabel());
+    }
+
+    /**
+     * Returns the {@link XMLGregorianCalendar} value of this literal. A 
calendar
+     * representation can be given for literals whose label conforms to the
+     * syntax of the following <a href="http://www.w3.org/TR/xmlschema-2/";>XML
+     * Schema datatypes</a>: <tt>dateTime</tt>, <tt>time</tt>,
+     * <tt>date</tt>, <tt>gYearMonth</tt>, <tt>gMonthDay</tt>,
+     * <tt>gYear</tt>, <tt>gMonth</tt> or <tt>gDay</tt>.
+     *
+     * @return The calendar value of the literal.
+     * @throws IllegalArgumentException If the literal cannot be represented 
by a
+     *                                  {@link XMLGregorianCalendar}.
+     */
+    @Override
+    public XMLGregorianCalendar calendarValue() {
+        try {
+            return XMLDatatypeUtil.parseCalendar(getLabel());
+        } catch(IllegalArgumentException ex) {
+            // try harder to parse the label, sometimes they have stupid 
formats ...
+            Date cv = DateUtils.parseDate(getLabel());
+            return DateUtils.getXMLCalendar(cv);
+        }
+    }
+
+
+    @Override
+    public boolean equals(Object o) {
+        if (this == o) return true;
+
+        if(o instanceof Literal) {
+            Literal that = (Literal)o;
+
+            if(!this.getLabel().equals(that.getLabel())) return false;
+
+            if(this.getLanguage() != null && 
!(this.getLanguage().equals(that.getLanguage()))) return false;
+
+            if(this.getDatatype()==null && that.getDatatype()!=null) return 
false;
+
+            if(this.getDatatype() != null && 
!this.getDatatype().equals(that.getDatatype())) return false;
+
+            return true;
+        }
+
+        return false;
+    }
+
+    @Override
+    public int hashCode() {
+        return getLabel().hashCode();
+    }
+
+}

http://git-wip-us.apache.org/repos/asf/marmotta/blob/0ff22a0c/libraries/ostrich/model/src/main/java/org/apache/marmotta/ostrich/model/ProtoNamespace.java
----------------------------------------------------------------------
diff --git 
a/libraries/ostrich/model/src/main/java/org/apache/marmotta/ostrich/model/ProtoNamespace.java
 
b/libraries/ostrich/model/src/main/java/org/apache/marmotta/ostrich/model/ProtoNamespace.java
new file mode 100644
index 0000000..34bf219
--- /dev/null
+++ 
b/libraries/ostrich/model/src/main/java/org/apache/marmotta/ostrich/model/ProtoNamespace.java
@@ -0,0 +1,86 @@
+/*
+ * 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.ostrich.model;
+
+import org.apache.marmotta.ostrich.model.proto.Model;
+import org.openrdf.model.Namespace;
+
+/**
+ * An implementation of a Sesame Namespace backed by a protocol buffer.
+ *
+ * @author Sebastian Schaffert ([email protected])
+ */
+public class ProtoNamespace implements Namespace {
+    private Model.Namespace message;
+
+    public ProtoNamespace(Model.Namespace message) {
+        this.message = message;
+    }
+
+    public ProtoNamespace(String prefix, String uri) {
+        message = Model.Namespace.newBuilder()
+                .setUri(uri)
+                .setPrefix(prefix).build();
+    }
+
+    public Model.Namespace getMessage() {
+        return message;
+    }
+
+    /**
+     * Gets the name of the current namespace (i.e. it's URI).
+     *
+     * @return name of namespace
+     */
+    @Override
+    public String getName() {
+        return message.getUri();
+    }
+
+    /**
+     * Gets the prefix of the current namespace. The default namespace is
+     * represented by an empty prefix string.
+     *
+     * @return prefix of namespace, or an empty string in case of the default
+     * namespace.
+     */
+    @Override
+    public String getPrefix() {
+        return message.getPrefix();
+    }
+
+    @Override
+    public int compareTo(Namespace namespace) {
+        return getPrefix().compareTo(namespace.getPrefix());
+    }
+
+    @Override
+    public boolean equals(Object o) {
+        if (this == o) return true;
+        if (o == null || !(o instanceof Namespace)) return false;
+
+        Namespace that = (Namespace) o;
+
+        return getPrefix().equals(that.getPrefix());
+    }
+
+    @Override
+    public int hashCode() {
+        return getPrefix().hashCode();
+    }
+}

http://git-wip-us.apache.org/repos/asf/marmotta/blob/0ff22a0c/libraries/ostrich/model/src/main/java/org/apache/marmotta/ostrich/model/ProtoStatement.java
----------------------------------------------------------------------
diff --git 
a/libraries/ostrich/model/src/main/java/org/apache/marmotta/ostrich/model/ProtoStatement.java
 
b/libraries/ostrich/model/src/main/java/org/apache/marmotta/ostrich/model/ProtoStatement.java
new file mode 100644
index 0000000..d6ad805
--- /dev/null
+++ 
b/libraries/ostrich/model/src/main/java/org/apache/marmotta/ostrich/model/ProtoStatement.java
@@ -0,0 +1,221 @@
+/*
+ * 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.ostrich.model;
+
+import org.apache.marmotta.ostrich.model.proto.Model;
+import org.openrdf.model.*;
+
+/**
+ * Add file description here!
+ *
+ * @author Sebastian Schaffert ([email protected])
+ */
+public class ProtoStatement implements Statement {
+
+    private Model.Statement message;
+
+    public ProtoStatement(Model.Statement message) {
+        this.message = message;
+    }
+
+    /**
+     * Build a statement backed by a proto message. The constructor can be 
used with any Sesame values, but
+     * using ProtoValues provides slighty better performance.
+     *
+     * @param subject
+     * @param predicate
+     * @param object
+     * @param context
+     */
+    public ProtoStatement(Resource subject, URI predicate, Value object, 
Resource context) {
+        // Build statement, mapping the Java inheritance structure to the 
Proto oneof structure.
+        Model.Statement.Builder builder = Model.Statement.newBuilder();
+        if (subject instanceof ProtoURI) {
+            builder.getSubjectBuilder().setUri(((ProtoURI) 
subject).getMessage()).build();
+        } else if (subject instanceof ProtoBNode) {
+            builder.getSubjectBuilder().setBnode(((ProtoBNode) 
subject).getMessage()).build();
+        } else if (subject instanceof URI) {
+            
builder.getSubjectBuilder().getUriBuilder().setUri(subject.stringValue()).build();
+        } else if (subject instanceof BNode) {
+            
builder.getSubjectBuilder().getBnodeBuilder().setId(subject.stringValue()).build();
+        }
+
+        if (predicate instanceof ProtoURI) {
+            builder.setPredicate(((ProtoURI) predicate).getMessage()).build();
+        } else if (predicate instanceof URI){
+            
builder.getPredicateBuilder().setUri(predicate.stringValue()).build();
+        }
+
+        if (object instanceof ProtoStringLiteral) {
+            builder.getObjectBuilder().getLiteralBuilder().setStringliteral(
+                    ((ProtoStringLiteral) object).getMessage()).build();
+        } else if (object instanceof ProtoDatatypeLiteral) {
+            builder.getObjectBuilder().getLiteralBuilder().setDataliteral(
+                    ((ProtoDatatypeLiteral) object).getMessage()).build();
+        } else if (object instanceof Literal) {
+            Literal l = (Literal)object;
+            if (l.getDatatype() != null) {
+                
builder.getObjectBuilder().getLiteralBuilder().getDataliteralBuilder()
+                        .setContent(l.stringValue())
+                        
.getDatatypeBuilder().setUri(l.getDatatype().stringValue())
+                        .build();
+            } else if(l.getLanguage() != null) {
+                
builder.getObjectBuilder().getLiteralBuilder().getStringliteralBuilder()
+                        .setContent(l.stringValue())
+                        .setLanguage(l.getLanguage())
+                        .build();
+            } else {
+                
builder.getObjectBuilder().getLiteralBuilder().getStringliteralBuilder()
+                        .setContent(l.stringValue())
+                        .build();
+            }
+        } else if (object instanceof ProtoURI) {
+            builder.getObjectBuilder().getResourceBuilder().setUri(
+                    ((ProtoURI) object).getMessage()).build();
+        } else if (object instanceof ProtoBNode) {
+            builder.getObjectBuilder().getResourceBuilder().setBnode(
+                    ((ProtoBNode) object).getMessage()).build();
+        } else if (object instanceof URI) {
+            
builder.getObjectBuilder().getResourceBuilder().getUriBuilder().setUri(
+                    object.stringValue()).build();
+        } else if (object instanceof BNode) {
+            
builder.getObjectBuilder().getResourceBuilder().getBnodeBuilder().setId(
+                    object.stringValue()).build();
+        }
+
+        if (context instanceof ProtoURI) {
+            builder.getContextBuilder().setUri(((ProtoURI) 
context).getMessage()).build();
+        } else if (context instanceof ProtoBNode) {
+            builder.getContextBuilder().setBnode(((ProtoBNode) 
context).getMessage()).build();
+        } else if (context instanceof URI) {
+            
builder.getContextBuilder().getUriBuilder().setUri(context.stringValue()).build();
+        } else if (context instanceof BNode) {
+            
builder.getContextBuilder().getBnodeBuilder().setId(context.stringValue()).build();
+        }
+
+        message = builder.build();
+    }
+
+    public Model.Statement getMessage() {
+        return message;
+    }
+
+    /**
+     * Gets the context of this statement.
+     *
+     * @return The statement's context, or <tt>null</tt> in case of the null
+     * context or if not applicable.
+     */
+    @Override
+    public Resource getContext() {
+        if (!message.hasContext()) {
+            return null;
+        }
+        switch(message.getContext().getResourcesCase()) {
+            case URI:
+                return new ProtoURI(message.getContext().getUri());
+            case BNODE:
+                return new ProtoBNode(message.getContext().getBnode());
+        }
+        return null;
+    }
+
+    /**
+     * Gets the subject of this statement.
+     *
+     * @return The statement's subject.
+     */
+    @Override
+    public Resource getSubject() {
+        if (!message.hasSubject()) {
+            return null;
+        }
+        switch(message.getSubject().getResourcesCase()) {
+            case URI:
+                return new ProtoURI(message.getSubject().getUri());
+            case BNODE:
+                return new ProtoBNode(message.getSubject().getBnode());
+        }
+        return null;
+    }
+
+    /**
+     * Gets the predicate of this statement.
+     *
+     * @return The statement's predicate.
+     */
+    @Override
+    public URI getPredicate() {
+        if (!message.hasPredicate()) {
+            return null;
+        }
+
+        return new ProtoURI(message.getPredicate());
+    }
+
+    /**
+     * Gets the object of this statement.
+     *
+     * @return The statement's object.
+     */
+    @Override
+    public Value getObject() {
+        if (!message.hasObject()) {
+            return null;
+        }
+
+        // Convert back from proto oneof to Java inheritance. It's ugly.
+        switch (message.getObject().getValuesCase()) {
+            case RESOURCE:
+                switch(message.getObject().getResource().getResourcesCase()) {
+                    case URI:
+                        return new 
ProtoURI(message.getObject().getResource().getUri());
+                    case BNODE:
+                        return new 
ProtoBNode(message.getObject().getResource().getBnode());
+                }
+            case LITERAL:
+                switch(message.getObject().getLiteral().getLiteralsCase()) {
+                    case STRINGLITERAL:
+                        return new 
ProtoStringLiteral(message.getObject().getLiteral().getStringliteral());
+                    case DATALITERAL:
+                        return new 
ProtoDatatypeLiteral(message.getObject().getLiteral().getDataliteral());
+                }
+        }
+
+        return null;
+    }
+
+
+    @Override
+    public boolean equals(Object o) {
+        if (this == o) return true;
+
+        Statement triple = (Statement) o;
+//        changed according to https://openrdf.atlassian.net/browse/SES-1924
+//        if (!getContext().equals(triple.getContext())) return false;
+        if (!getObject().equals(triple.getObject())) return false;
+        if (!getPredicate().equals(triple.getPredicate())) return false;
+        return getSubject().equals(triple.getSubject());
+
+    }
+
+    @Override
+    public int hashCode() {
+        return 961 * getSubject().hashCode() + 31 * getPredicate().hashCode() 
+ getObject().hashCode();
+    }
+}

http://git-wip-us.apache.org/repos/asf/marmotta/blob/0ff22a0c/libraries/ostrich/model/src/main/java/org/apache/marmotta/ostrich/model/ProtoStringLiteral.java
----------------------------------------------------------------------
diff --git 
a/libraries/ostrich/model/src/main/java/org/apache/marmotta/ostrich/model/ProtoStringLiteral.java
 
b/libraries/ostrich/model/src/main/java/org/apache/marmotta/ostrich/model/ProtoStringLiteral.java
new file mode 100644
index 0000000..2000a76
--- /dev/null
+++ 
b/libraries/ostrich/model/src/main/java/org/apache/marmotta/ostrich/model/ProtoStringLiteral.java
@@ -0,0 +1,101 @@
+/*
+ * 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.ostrich.model;
+
+import org.apache.marmotta.ostrich.model.proto.Model;
+import org.openrdf.model.BNode;
+import org.openrdf.model.Literal;
+import org.openrdf.model.URI;
+
+/**
+ * An implementation of a Sesame Literal backed by a StringLiteral protocol 
buffer.
+ *
+ * @author Sebastian Schaffert ([email protected])
+ */
+public class ProtoStringLiteral extends ProtoLiteralBase implements Literal {
+
+    private Model.StringLiteral message;
+
+    public ProtoStringLiteral(Model.StringLiteral message) {
+        this.message = message;
+    }
+
+    public ProtoStringLiteral(String content) {
+        this.message = Model.StringLiteral.newBuilder()
+                .setContent(content)
+                .build();
+    }
+
+    public ProtoStringLiteral(String content, String language) {
+        this.message = Model.StringLiteral.newBuilder()
+                .setContent(content)
+                .setLanguage(language)
+                .build();
+    }
+
+    public Model.StringLiteral getMessage() {
+        return message;
+    }
+
+    /**
+     * Gets the language tag for this literal, normalized to lower case.
+     *
+     * @return The language tag for this literal, or <tt>null</tt> if it
+     * doesn't have one.
+     */
+    @Override
+    public String getLanguage() {
+        if ("".equals(message.getLanguage()) || message.getLanguage() == null) 
{
+            return null;
+        }
+        return message.getLanguage();
+    }
+
+    /**
+     * Gets the datatype for this literal.
+     *
+     * @return The datatype for this literal, or <tt>null</tt> if it doesn't
+     * have one.
+     */
+    @Override
+    public URI getDatatype() {
+        return null;
+    }
+
+
+    /**
+     * Gets the label of this literal.
+     *
+     * @return The literal's label.
+     */
+    @Override
+    public String getLabel() {
+        return message.getContent();
+    }
+
+
+    /**
+     * Returns the String-value of a <tt>Value</tt> object. This returns either
+     * a {@link Literal}'s label, a {@link URI}'s URI or a {@link BNode}'s ID.
+     */
+    @Override
+    public String stringValue() {
+        return message.getContent();
+    }
+
+}

http://git-wip-us.apache.org/repos/asf/marmotta/blob/0ff22a0c/libraries/ostrich/model/src/main/java/org/apache/marmotta/ostrich/model/ProtoURI.java
----------------------------------------------------------------------
diff --git 
a/libraries/ostrich/model/src/main/java/org/apache/marmotta/ostrich/model/ProtoURI.java
 
b/libraries/ostrich/model/src/main/java/org/apache/marmotta/ostrich/model/ProtoURI.java
new file mode 100644
index 0000000..af92a75
--- /dev/null
+++ 
b/libraries/ostrich/model/src/main/java/org/apache/marmotta/ostrich/model/ProtoURI.java
@@ -0,0 +1,113 @@
+/*
+ * 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.ostrich.model;
+
+
+import org.apache.marmotta.commons.sesame.model.URICommons;
+import org.apache.marmotta.ostrich.model.proto.Model;
+import org.openrdf.model.BNode;
+import org.openrdf.model.Literal;
+import org.openrdf.model.URI;
+
+/**
+ * An implementation of a Sesame URI backed by a protocol buffer.
+ *
+ * @author Sebastian Schaffert ([email protected])
+ */
+public class ProtoURI implements URI {
+
+    private Model.URI message;
+
+    private String namespace, localName;
+
+
+    public ProtoURI(String uri) {
+        message = Model.URI.newBuilder().setUri(uri).build();
+    }
+
+    public ProtoURI(Model.URI message) {
+        this.message = message;
+    }
+
+    public Model.URI getMessage() {
+        return message;
+    }
+
+    /**
+     * Gets the local name of this URI. The local name is defined as per the
+     * algorithm described in the class documentation.
+     *
+     * @return The URI's local name.
+     */
+    @Override
+    public String getLocalName() {
+        initNamespace();
+
+        return localName;
+    }
+
+    /**
+     * Gets the namespace of this URI. The namespace is defined as per the
+     * algorithm described in the class documentation.
+     *
+     * @return The URI's namespace.
+     */
+    @Override
+    public String getNamespace() {
+        initNamespace();
+
+        return namespace;
+    }
+
+    /**
+     * Returns the String-value of a <tt>Value</tt> object. This returns either
+     * a {@link Literal}'s label, a {@link URI}'s URI or a {@link BNode}'s ID.
+     */
+    @Override
+    public String stringValue() {
+        return message.getUri();
+    }
+
+    @Override
+    public String toString() {
+        return message.getUri();
+    }
+
+    private void initNamespace() {
+        if(namespace == null || localName == null) {
+            String[] components = URICommons.splitNamespace(message.getUri());
+            namespace = components[0];
+            localName = components[1];
+        }
+    }
+
+    @Override
+    public boolean equals(Object o) {
+        if (this == o) return true;
+
+        if(o instanceof URI) {
+            return this.stringValue().equals(((URI)o).stringValue());
+        }
+        return false;
+    }
+
+    @Override
+    public int hashCode() {
+        return stringValue().hashCode();
+    }
+}

http://git-wip-us.apache.org/repos/asf/marmotta/blob/0ff22a0c/libraries/ostrich/model/src/test/java/org/apache/marmotta/ostrich/model/test/StatementTest.java
----------------------------------------------------------------------
diff --git 
a/libraries/ostrich/model/src/test/java/org/apache/marmotta/ostrich/model/test/StatementTest.java
 
b/libraries/ostrich/model/src/test/java/org/apache/marmotta/ostrich/model/test/StatementTest.java
new file mode 100644
index 0000000..c8deede
--- /dev/null
+++ 
b/libraries/ostrich/model/src/test/java/org/apache/marmotta/ostrich/model/test/StatementTest.java
@@ -0,0 +1,68 @@
+/*
+ * 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.ostrich.model.test;
+
+import org.apache.marmotta.ostrich.model.ProtoBNode;
+import org.apache.marmotta.ostrich.model.ProtoStatement;
+import org.apache.marmotta.ostrich.model.ProtoStringLiteral;
+import org.apache.marmotta.ostrich.model.ProtoURI;
+import org.junit.Assert;
+import org.junit.Test;
+import org.openrdf.model.BNode;
+import org.openrdf.model.Literal;
+import org.openrdf.model.URI;
+import org.openrdf.model.impl.BNodeImpl;
+import org.openrdf.model.impl.LiteralImpl;
+import org.openrdf.model.impl.URIImpl;
+
+/**
+ * Add file description here!
+ *
+ * @author Sebastian Schaffert ([email protected])
+ */
+public class StatementTest {
+
+    @Test
+    public void testCreateFromProtoValues() {
+        ProtoBNode s = new ProtoBNode("1234");
+        ProtoURI p = new ProtoURI("http://apache.org/example/P1";);
+        ProtoStringLiteral o = new ProtoStringLiteral("Hello, World", "en");
+        ProtoURI c = new ProtoURI("http://apache.org/example/C1";);
+        ProtoStatement stmt = new ProtoStatement(s, p, o, c);
+
+        Assert.assertEquals(stmt.getSubject(), s);
+        Assert.assertEquals(stmt.getPredicate(), p);
+        Assert.assertEquals(stmt.getObject(), o);
+        Assert.assertEquals(stmt.getContext(), c);
+    }
+
+    @Test
+    public void testCreateFromSesameValues() {
+        BNode s = new BNodeImpl("1234");
+        URI p = new URIImpl("http://apache.org/example/P1";);
+        Literal o = new LiteralImpl("Hello, World", "en");
+        URI c = new URIImpl("http://apache.org/example/C1";);
+        ProtoStatement stmt = new ProtoStatement(s, p, o, c);
+
+        Assert.assertEquals(stmt.getSubject(), s);
+        Assert.assertEquals(stmt.getPredicate(), p);
+        Assert.assertEquals(stmt.getObject(), o);
+        Assert.assertEquals(stmt.getContext(), c);
+    }
+
+}

http://git-wip-us.apache.org/repos/asf/marmotta/blob/0ff22a0c/libraries/ostrich/model/src/test/java/org/apache/marmotta/ostrich/model/test/URITest.java
----------------------------------------------------------------------
diff --git 
a/libraries/ostrich/model/src/test/java/org/apache/marmotta/ostrich/model/test/URITest.java
 
b/libraries/ostrich/model/src/test/java/org/apache/marmotta/ostrich/model/test/URITest.java
new file mode 100644
index 0000000..4635d02
--- /dev/null
+++ 
b/libraries/ostrich/model/src/test/java/org/apache/marmotta/ostrich/model/test/URITest.java
@@ -0,0 +1,57 @@
+/*
+ * 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.ostrich.model.test;
+
+import org.apache.marmotta.ostrich.model.ProtoURI;
+import org.apache.marmotta.ostrich.model.proto.Model;
+import org.junit.Assert;
+import org.junit.Test;
+import org.openrdf.model.URI;
+
+/**
+ * Test constructing URIs.
+ *
+ * @author Sebastian Schaffert ([email protected])
+ */
+public class URITest {
+
+    @Test
+    public void testCreateFromString() {
+        URI uri = new ProtoURI("http://apache.org/example";);
+
+        Assert.assertEquals(uri.stringValue(), "http://apache.org/example";);
+    }
+
+    @Test
+    public void testCreateFromMessage() {
+        Model.URI msg = 
Model.URI.newBuilder().setUri("http://apache.org/example";).build();
+        URI uri = new ProtoURI(msg);
+
+        Assert.assertEquals(uri.stringValue(), "http://apache.org/example";);
+    }
+
+    @Test
+    public void testEquals() {
+        URI uri1 = new ProtoURI("http://apache.org/example";);
+        URI uri2 = new ProtoURI("http://apache.org/example";);
+
+        Assert.assertEquals(uri1, uri2);
+
+    }
+
+}

http://git-wip-us.apache.org/repos/asf/marmotta/blob/0ff22a0c/libraries/ostrich/model/src/test/resources/logback.xml
----------------------------------------------------------------------
diff --git a/libraries/ostrich/model/src/test/resources/logback.xml 
b/libraries/ostrich/model/src/test/resources/logback.xml
new file mode 100644
index 0000000..9152e16
--- /dev/null
+++ b/libraries/ostrich/model/src/test/resources/logback.xml
@@ -0,0 +1,28 @@
+<!--
+  ~ 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.
+  -->
+
+<configuration>
+    <appender name="CONSOLE" class="ch.qos.logback.core.ConsoleAppender">
+        <encoder>
+            <pattern>%d{HH:mm:ss.SSS} %level %logger{15} - %m%n</pattern>
+        </encoder>
+    </appender>
+
+    <root level="${root-level:-INFO}">
+        <appender-ref ref="CONSOLE"/>
+    </root>
+</configuration>

http://git-wip-us.apache.org/repos/asf/marmotta/blob/0ff22a0c/libraries/ostrich/pom.xml
----------------------------------------------------------------------
diff --git a/libraries/ostrich/pom.xml b/libraries/ostrich/pom.xml
new file mode 100644
index 0000000..321a07b
--- /dev/null
+++ b/libraries/ostrich/pom.xml
@@ -0,0 +1,50 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+   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.
+-->
+<project xmlns="http://maven.apache.org/POM/4.0.0"; 
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"; 
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 
http://maven.apache.org/xsd/maven-4.0.0.xsd";>
+    <modelVersion>4.0.0</modelVersion>
+
+    <parent>
+        <groupId>org.apache.marmotta</groupId>
+        <artifactId>marmotta-parent</artifactId>
+        <version>3.4.0-SNAPSHOT</version>
+        <relativePath>../../parent</relativePath>
+    </parent>
+
+    <artifactId>ostrich-parent</artifactId>
+    <packaging>pom</packaging>
+
+    <name>Ostrich Triplestore: Parent</name>
+    <description>A Sesame Triple Store based on a fast C++ LevelDB 
database.</description>
+
+    <inceptionYear>2015</inceptionYear>
+
+    <build>
+        <plugins>
+            <plugin>
+                <groupId>org.apache.maven.plugins</groupId>
+                <artifactId>maven-surefire-plugin</artifactId>
+            </plugin>
+        </plugins>
+    </build>
+
+    <modules>
+        <module>model</module>
+        <module>client</module>
+    </modules>
+
+</project>

http://git-wip-us.apache.org/repos/asf/marmotta/blob/0ff22a0c/libraries/pom.xml
----------------------------------------------------------------------
diff --git a/libraries/pom.xml b/libraries/pom.xml
index 78e560f..b21c862 100644
--- a/libraries/pom.xml
+++ b/libraries/pom.xml
@@ -69,4 +69,13 @@
         <module>ldclient</module>
         <module>ldpath</module>
     </modules>
+
+    <profiles>
+        <profile>
+            <id>ostrich</id>
+            <modules>
+                <module>ostrich</module>
+            </modules>
+        </profile>
+    </profiles>
 </project>

http://git-wip-us.apache.org/repos/asf/marmotta/blob/0ff22a0c/platform/backends/marmotta-backend-ostrich/pom.xml
----------------------------------------------------------------------
diff --git a/platform/backends/marmotta-backend-ostrich/pom.xml 
b/platform/backends/marmotta-backend-ostrich/pom.xml
new file mode 100644
index 0000000..76b52f2
--- /dev/null
+++ b/platform/backends/marmotta-backend-ostrich/pom.xml
@@ -0,0 +1,175 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+  ~ 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.
+  -->
+
+<project xmlns="http://maven.apache.org/POM/4.0.0"; 
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"; 
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 
http://maven.apache.org/xsd/maven-4.0.0.xsd";>
+    <modelVersion>4.0.0</modelVersion>
+
+    <parent>
+        <groupId>org.apache.marmotta</groupId>
+        <artifactId>marmotta-parent</artifactId>
+        <version>3.4.0-SNAPSHOT</version>
+    </parent>
+
+    <groupId>org.apache.marmotta</groupId>
+    <artifactId>marmotta-backend-ostrich</artifactId>
+
+    <name>Apache Marmotta Platform: C++ LevelDB Backend</name>
+    <description>
+        This module provides an Apache Marmotta backend using a LevelDB 
database. This is a suitable backend
+        for high performance environments.
+    </description>
+
+    <build>
+        <pluginManagement>
+            <plugins>
+                <plugin> <!-- generate JRebel Configuration -->
+                    <groupId>org.zeroturnaround</groupId>
+                    <artifactId>jrebel-maven-plugin</artifactId>
+                    <version>1.1.3</version>
+                    <executions>
+                        <execution>
+                            <id>generate-rebel-xml</id>
+                            <phase>process-resources</phase>
+                            <goals>
+                                <goal>generate</goal>
+                            </goals>
+                        </execution>
+                    </executions>
+                    <configuration>
+                        <relativePath>../../../</relativePath>
+                        <rootPath>$${rebel.root}</rootPath>
+                        <classpath>
+                            <resources>
+                                <resource><!-- default resource --></resource>
+                                
<resource><directory>src/main/resources</directory></resource>
+                            </resources>
+                        </classpath>
+                    </configuration>
+                </plugin>
+            </plugins>
+        </pluginManagement>
+        <plugins>
+            <plugin>
+                <groupId>org.apache.marmotta</groupId>
+                <artifactId>buildinfo-maven-plugin</artifactId>
+                <configuration>
+                    <systemProperties>
+                        <systemProperty>user.name</systemProperty>
+                        <systemProperty>user.timezone</systemProperty>
+                        <systemProperty>java.vm.vendor</systemProperty>
+                        <systemProperty>java.vm.version</systemProperty>
+                        <systemProperty>java.vm.name</systemProperty>
+                        <systemProperty>java.runtime.version</systemProperty>
+                        <systemProperty>os.name</systemProperty>
+                        <systemProperty>os.version</systemProperty>
+                        <systemProperty>os.arch</systemProperty>
+                    </systemProperties>
+                </configuration>
+                <executions>
+                    <execution>
+                        <phase>process-resources</phase>
+                        <goals>
+                            <goal>extract</goal>
+                        </goals>
+                    </execution>
+                </executions>
+            </plugin>
+
+            <plugin>
+                <groupId>org.apache.maven.plugins</groupId>
+                <artifactId>maven-javadoc-plugin</artifactId>
+                <executions>
+                    <!--
+                    <execution>
+                        <id>aggregate</id>
+                        <goals>
+                            <goal>aggregate</goal>
+                        </goals>
+                        <phase>site</phase>
+                    </execution>
+                    -->
+                    <execution>
+                        <!-- configure how the REST API documentation will be 
produced -->
+                        <id>restapi</id>
+                        <configuration>
+                            
<doclet>com.lunatech.doclets.jax.jaxrs.JAXRSDoclet</doclet>
+
+                            <name>REST API</name>
+                            <description>REST API for Marmotta 
Webservices</description>
+
+                            
<outputDirectory>${project.build.outputDirectory}/doc</outputDirectory>
+                            
<reportOutputDirectory>${project.build.outputDirectory}/web/doc</reportOutputDirectory>
+                            <destDir>rest</destDir>
+
+                            <docletArtifact>
+                                <groupId>com.lunatech.jax-doclets</groupId>
+                                <artifactId>doclets</artifactId>
+                                <version>${jax.doclets.version}</version>
+                            </docletArtifact>
+                            <additionalparam>
+                                -jaxrscontext {BASE}
+                                -charset UTF-8
+                            </additionalparam>
+
+                            <!--
+                                                        
<stylesheetfile>${project.parent.basedir}/config/doc/doclet.css</stylesheetfile>
+                            -->
+
+                            <header><![CDATA[<!--###BEGIN_CONTENT###--><div 
class="javadoc">]]></header>
+                            
<footer><![CDATA[</div><!--###END_CONTENT###-->]]></footer>
+                            <encoding>UTF-8</encoding>
+                            <detectOfflineLinks>false</detectOfflineLinks>
+
+                            <!-- For the project-reports page -->
+                        </configuration>
+                        <goals>
+                            <goal>javadoc</goal>
+                        </goals>
+                        <phase>generate-resources</phase>
+                    </execution>
+                </executions>
+            </plugin>
+        </plugins>
+    </build>
+
+    <dependencies>
+        <dependency>
+            <groupId>org.apache.marmotta</groupId>
+            <artifactId>marmotta-core</artifactId>
+            <version>${project.version}</version>
+        </dependency>
+        <dependency>
+            <groupId>org.apache.marmotta</groupId>
+            <artifactId>marmotta-sail-transactions</artifactId>
+        </dependency>
+
+        <dependency>
+            <groupId>org.apache.marmotta</groupId>
+            <artifactId>ostrich-model</artifactId>
+            <version>3.4.0-SNAPSHOT</version>
+        </dependency>
+        <dependency>
+            <groupId>org.apache.marmotta</groupId>
+            <artifactId>ostrich-client</artifactId>
+            <version>3.4.0-SNAPSHOT</version>
+        </dependency>
+
+    </dependencies>
+
+
+</project>

http://git-wip-us.apache.org/repos/asf/marmotta/blob/0ff22a0c/platform/backends/marmotta-backend-ostrich/src/main/java/org/apache/marmotta/platform/backend/ostrich/OstrichProvider.java
----------------------------------------------------------------------
diff --git 
a/platform/backends/marmotta-backend-ostrich/src/main/java/org/apache/marmotta/platform/backend/ostrich/OstrichProvider.java
 
b/platform/backends/marmotta-backend-ostrich/src/main/java/org/apache/marmotta/platform/backend/ostrich/OstrichProvider.java
new file mode 100644
index 0000000..e62d639
--- /dev/null
+++ 
b/platform/backends/marmotta-backend-ostrich/src/main/java/org/apache/marmotta/platform/backend/ostrich/OstrichProvider.java
@@ -0,0 +1,94 @@
+/*
+ * 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.platform.backend.ostrich;
+
+import org.apache.marmotta.ostrich.sail.OstrichSail;
+import org.apache.marmotta.platform.core.api.config.ConfigurationService;
+import org.apache.marmotta.platform.core.api.triplestore.StoreProvider;
+import org.openrdf.repository.sail.SailRepository;
+import org.openrdf.sail.NotifyingSail;
+import org.openrdf.sail.Sail;
+import org.slf4j.Logger;
+
+import javax.enterprise.context.ApplicationScoped;
+import javax.inject.Inject;
+
+/**
+ * A store implementation using a Sesame NativeStore as backend for Marmotta. 
The triples are stored in the
+ * Marmotta home directory in the subdirectory "triples".
+ *
+ * @author Sebastian Schaffert ([email protected])
+ */
+@ApplicationScoped
+public class OstrichProvider implements StoreProvider {
+
+    @Inject
+    private Logger log;
+
+    @Inject
+    private ConfigurationService configurationService;
+
+
+
+    /**
+     * Create the store provided by this SailProvider
+     *
+     * @return a new instance of the store
+     */
+    @Override
+    public NotifyingSail createStore() {
+        log.info("Initializing Backend: LevelDB Store");
+
+        return new OstrichSail(
+                configurationService.getStringConfiguration("ostrich.host", 
"localhost"),
+                configurationService.getIntConfiguration("ostrich.port", 
10000));
+    }
+
+    /**
+     * Create the repository using the sail given as argument. This method is 
needed because some backends
+     * use custom implementations of SailRepository.
+     *
+     * @param sail
+     * @return
+     */
+    @Override
+    public SailRepository createRepository(Sail sail) {
+        return new SailRepository(sail);
+    }
+
+
+    /**
+     * Return the name of the provider. Used e.g. for displaying status 
information or logging.
+     *
+     * @return
+     */
+    @Override
+    public String getName() {
+        return "LevelDB Store";
+    }
+
+    /**
+     * Return true if this sail provider is enabled in the configuration.
+     *
+     * @return
+     */
+    @Override
+    public boolean isEnabled() {
+        return true;
+    }
+}

http://git-wip-us.apache.org/repos/asf/marmotta/blob/0ff22a0c/platform/backends/marmotta-backend-ostrich/src/main/resources/META-INF/beans.xml
----------------------------------------------------------------------
diff --git 
a/platform/backends/marmotta-backend-ostrich/src/main/resources/META-INF/beans.xml
 
b/platform/backends/marmotta-backend-ostrich/src/main/resources/META-INF/beans.xml
new file mode 100644
index 0000000..461858e
--- /dev/null
+++ 
b/platform/backends/marmotta-backend-ostrich/src/main/resources/META-INF/beans.xml
@@ -0,0 +1,28 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+
+    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.
+
+-->
+<beans
+   xmlns="http://java.sun.com/xml/ns/javaee";
+   xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance";
+   xsi:schemaLocation="
+      http://java.sun.com/xml/ns/javaee
+      http://java.sun.com/xml/ns/javaee/beans_1_0.xsd";>
+
+</beans>

http://git-wip-us.apache.org/repos/asf/marmotta/blob/0ff22a0c/platform/backends/marmotta-backend-ostrich/src/main/resources/config-defaults.properties
----------------------------------------------------------------------
diff --git 
a/platform/backends/marmotta-backend-ostrich/src/main/resources/config-defaults.properties
 
b/platform/backends/marmotta-backend-ostrich/src/main/resources/config-defaults.properties
new file mode 100644
index 0000000..0bad4d9
--- /dev/null
+++ 
b/platform/backends/marmotta-backend-ostrich/src/main/resources/config-defaults.properties
@@ -0,0 +1,24 @@
+#
+# 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.
+#
+
+
+###############################################################################
+# LevelDB storage configuration
+###############################################################################
+
+ostrich.host = localhost
+ostrich.port = 10000
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/marmotta/blob/0ff22a0c/platform/backends/marmotta-backend-ostrich/src/main/resources/config-descriptions.properties
----------------------------------------------------------------------
diff --git 
a/platform/backends/marmotta-backend-ostrich/src/main/resources/config-descriptions.properties
 
b/platform/backends/marmotta-backend-ostrich/src/main/resources/config-descriptions.properties
new file mode 100644
index 0000000..378d664
--- /dev/null
+++ 
b/platform/backends/marmotta-backend-ostrich/src/main/resources/config-descriptions.properties
@@ -0,0 +1,26 @@
+#
+# 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.
+#
+
+###############################################################################
+# LevelDB storage configuration
+###############################################################################
+
+ostrich.host.description = Host name of the server running the LevelDB/Ostrich 
backend server,
+ostrich.host.type = java.lang.String
+
+ostrich.portt.description = Port of the server running the LevelDB/Ostrich 
backend server.
+ostrich.port.type = java.lang.Integer

http://git-wip-us.apache.org/repos/asf/marmotta/blob/0ff22a0c/platform/backends/marmotta-backend-ostrich/src/main/resources/kiwi-module.properties
----------------------------------------------------------------------
diff --git 
a/platform/backends/marmotta-backend-ostrich/src/main/resources/kiwi-module.properties
 
b/platform/backends/marmotta-backend-ostrich/src/main/resources/kiwi-module.properties
new file mode 100644
index 0000000..3e99ed0
--- /dev/null
+++ 
b/platform/backends/marmotta-backend-ostrich/src/main/resources/kiwi-module.properties
@@ -0,0 +1,38 @@
+#
+# 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.
+#
+
+name=Storage Backend: LevelDB
+
+container=Generic
+container.weight = 10
+
+subtitle = Configure LevelDB Backend
+weight = 10
+
+icon_small = /admin/img/config_small.png
+
+#do not change!!!
+baseurl=/storage-leveldb
+
+adminpage.0.title=About
+adminpage.0.link=/admin/about.html
+
+adminpage.1.title=Configuration
+adminpage.1.link=/admin/configuration.html
+
+webservices=
+  
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/marmotta/blob/0ff22a0c/platform/backends/marmotta-backend-ostrich/src/main/resources/web/admin/about.html
----------------------------------------------------------------------
diff --git 
a/platform/backends/marmotta-backend-ostrich/src/main/resources/web/admin/about.html
 
b/platform/backends/marmotta-backend-ostrich/src/main/resources/web/admin/about.html
new file mode 100644
index 0000000..8a08d74
--- /dev/null
+++ 
b/platform/backends/marmotta-backend-ostrich/src/main/resources/web/admin/about.html
@@ -0,0 +1,36 @@
+<!--
+  ~ 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.
+  -->
+
+<html>
+<head>
+    <!--###BEGIN_HEAD###-->
+    <title>Storage Backend: LevelDB</title>
+    <!--###END_HEAD###-->
+</head>
+<body>
+<!--###BEGIN_CONTENT###-->
+<h1>Storage Backend: LevelDB</h1>
+
+<p>
+    This module provides an Apache Marmotta storage backend based on a C++ 
LevelDB triple store (Ostrich). Ostrich is a highly scalable,
+    highly performant, highly concurrent triple store implementation that you 
can use in cases where your volume of data is very high and/or
+    you do not want/need to store your data in a relational database as with 
the KiWi backend.
+</p>
+<!--###END_CONTENT###-->
+</body>
+</html>
+

http://git-wip-us.apache.org/repos/asf/marmotta/blob/0ff22a0c/platform/backends/marmotta-backend-ostrich/src/main/resources/web/admin/configuration.html
----------------------------------------------------------------------
diff --git 
a/platform/backends/marmotta-backend-ostrich/src/main/resources/web/admin/configuration.html
 
b/platform/backends/marmotta-backend-ostrich/src/main/resources/web/admin/configuration.html
new file mode 100644
index 0000000..e5d690e
--- /dev/null
+++ 
b/platform/backends/marmotta-backend-ostrich/src/main/resources/web/admin/configuration.html
@@ -0,0 +1,52 @@
+<!--
+  ~ 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.
+  -->
+
+<html>
+<head>
+<title>Storage Backend: LevelDB</title>
+<script type="text/javascript">
+       var _SERVER_URL = "http://localhost:8080/LMF/";;
+</script>
+<!--###BEGIN_HEAD###-->
+    <script type="text/javascript" 
src="../../webjars/jquery/1.8.2/jquery.min.js"></script>
+    <script type="text/javascript" 
src="../../core/public/js/widgets/configurator/configurator.js"></script>
+    <link rel="stylesheet" href="style.css" />
+    <link type="text/css" rel="stylesheet" 
href="../../core/public/js/widgets/configurator/style.css">
+    <script type="text/javascript">
+        jQuery(document).ready(function(){
+            var options = {
+                url : _SERVER_URL,
+                container : "ostrich_configurator",
+                prefix : 'ostrich'
+            }
+            var configurator = new Configurator(options);
+        });
+    </script>
+<!--###END_HEAD###-->
+</head>
+<body>
+  <!--###BEGIN_CONTENT###-->
+  <h1>LevelDB Backend Configuration</h1>
+  <p>
+    Here you can configure options offered by the Ostrich triple store. The 
configuration currently contains:
+  </p>
+  <div id="ostrich_configurator">
+    <h4>Loading configurator</h4>
+  </div>
+  <!--###END_CONTENT###-->
+</body>
+</html>
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/marmotta/blob/0ff22a0c/platform/backends/pom.xml
----------------------------------------------------------------------
diff --git a/platform/backends/pom.xml b/platform/backends/pom.xml
index fe41526..766d1b3 100644
--- a/platform/backends/pom.xml
+++ b/platform/backends/pom.xml
@@ -80,6 +80,12 @@
             </modules>
         </profile>
         <profile>
+            <id>ostrich</id>
+            <modules>
+                <module>marmotta-backend-ostrich</module>
+            </modules>
+        </profile>
+        <profile>
             <id>experimental</id>
             <modules>
                 <module>marmotta-backend-http</module>

Reply via email to