marmotta-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From wik...@apache.org
Subject [18/52] [partial] code contribution, initial import of relevant modules of LMF-3.0.0-SNAPSHOT based on revision 4bf944319368 of the default branch at https://code.google.com/p/lmf/
Date Tue, 19 Feb 2013 12:52:00 GMT
http://git-wip-us.apache.org/repos/asf/incubator-marmotta/blob/c32963d5/lmf-client/lmf-client-js/src/test/resources/lmf.properties
----------------------------------------------------------------------
diff --git a/lmf-client/lmf-client-js/src/test/resources/lmf.properties b/lmf-client/lmf-client-js/src/test/resources/lmf.properties
new file mode 100644
index 0000000..e69de29

http://git-wip-us.apache.org/repos/asf/incubator-marmotta/blob/c32963d5/lmf-client/lmf-client-php/.project
----------------------------------------------------------------------
diff --git a/lmf-client/lmf-client-php/.project b/lmf-client/lmf-client-php/.project
new file mode 100644
index 0000000..92bb572
--- /dev/null
+++ b/lmf-client/lmf-client-php/.project
@@ -0,0 +1,17 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<projectDescription>
+	<name>lmf-client-php</name>
+	<comment></comment>
+	<projects>
+	</projects>
+	<buildSpec>
+		<buildCommand>
+			<name>org.eclipse.m2e.core.maven2Builder</name>
+			<arguments>
+			</arguments>
+		</buildCommand>
+	</buildSpec>
+	<natures>
+		<nature>org.eclipse.m2e.core.maven2Nature</nature>
+	</natures>
+</projectDescription>

http://git-wip-us.apache.org/repos/asf/incubator-marmotta/blob/c32963d5/lmf-client/lmf-client-php/.settings/org.eclipse.m2e.core.prefs
----------------------------------------------------------------------
diff --git a/lmf-client/lmf-client-php/.settings/org.eclipse.m2e.core.prefs b/lmf-client/lmf-client-php/.settings/org.eclipse.m2e.core.prefs
new file mode 100644
index 0000000..f897a7f
--- /dev/null
+++ b/lmf-client/lmf-client-php/.settings/org.eclipse.m2e.core.prefs
@@ -0,0 +1,4 @@
+activeProfiles=
+eclipse.preferences.version=1
+resolveWorkspaceProjects=true
+version=1

http://git-wip-us.apache.org/repos/asf/incubator-marmotta/blob/c32963d5/lmf-client/lmf-client-php/pom.xml
----------------------------------------------------------------------
diff --git a/lmf-client/lmf-client-php/pom.xml b/lmf-client/lmf-client-php/pom.xml
new file mode 100644
index 0000000..8da1f57
--- /dev/null
+++ b/lmf-client/lmf-client-php/pom.xml
@@ -0,0 +1,115 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+  ~ Copyright (c) 2013 Salzburg Research.
+  ~
+  ~  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.
+  -->
+
+<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>at.newmedialab.lmf</groupId>
+        <artifactId>lmf-client</artifactId>
+        <version>2.6.0-SNAPSHOT</version>
+    </parent>
+
+    <artifactId>lmf-client-php</artifactId>
+    <packaging>php</packaging>
+
+    <name>LMF Client Library for PHP</name>
+    <description>
+        A PHP Library for accessing a remote LMF installation using REST webservice calls.
+    </description>
+
+    <build>
+        <plugins>
+            <plugin>
+                <groupId>org.phpmaven</groupId>
+                <artifactId>maven-php-plugin</artifactId>
+                <version>2.0.2</version>
+                <extensions>true</extensions>
+            </plugin>
+            <plugin>
+                <groupId>org.phpmaven</groupId>
+                <artifactId>maven-php-phpdoc</artifactId>
+                <version>2.0.2</version>
+            </plugin>
+            <plugin>
+                <groupId>org.phpmaven</groupId>
+                <artifactId>maven-php-phar</artifactId>
+                <version>2.0.2</version>
+            </plugin>
+        </plugins>
+    </build>
+
+    <dependencies>
+
+        <!-- Test Support -->
+        <dependency>
+            <groupId>de.phpunit</groupId>
+            <artifactId>PHPUnit</artifactId>
+            <version>3.6.10</version>
+            <type>phar</type>
+        </dependency>
+
+    </dependencies>
+
+    <pluginRepositories>
+        <pluginRepository>
+            <id>release-repo1.php-maven.org</id>
+            <name>PHP Maven Release Repository</name>
+            <url>http://repos.php-maven.org/releases</url>
+            <releases>
+                <enabled>true</enabled>
+            </releases>
+        </pluginRepository>
+        <pluginRepository>
+            <id>snapshot-repo1.php-maven.org</id>
+            <name>PHP Maven Snapshot Repository</name>
+            <url>http://repos.php-maven.org/snapshots</url>
+            <releases>
+                <enabled>false</enabled>
+            </releases>
+            <snapshots>
+                <enabled>true</enabled>
+            </snapshots>
+        </pluginRepository>
+    </pluginRepositories>
+    <repositories>
+        <repository>
+            <id>release-repo1.php-maven.org</id>
+            <name>PHP Maven Release Repository</name>
+            <url>http://repos.php-maven.org/releases</url>
+            <releases>
+                <enabled>true</enabled>
+            </releases>
+        </repository>
+        <repository>
+            <id>snapshot-repo1.php-maven.org</id>
+            <name>PHP Maven Snapshot Repository</name>
+            <url>http://repos.php-maven.org/snapshots</url>
+            <releases>
+                <enabled>false</enabled>
+            </releases>
+            <snapshots>
+                <enabled>true</enabled>
+            </snapshots>
+        </repository>
+    </repositories>
+
+</project>
+

http://git-wip-us.apache.org/repos/asf/incubator-marmotta/blob/c32963d5/lmf-client/lmf-client-php/src/main/php/ClientConfiguration.php
----------------------------------------------------------------------
diff --git a/lmf-client/lmf-client-php/src/main/php/ClientConfiguration.php b/lmf-client/lmf-client-php/src/main/php/ClientConfiguration.php
new file mode 100644
index 0000000..be2be60
--- /dev/null
+++ b/lmf-client/lmf-client-php/src/main/php/ClientConfiguration.php
@@ -0,0 +1,80 @@
+<?php
+/*
+ * Copyright (C) 2013 Salzburg Research.
+ *
+ * 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.
+ */
+namespace LMFClient;
+
+/**
+ * Created by IntelliJ IDEA.
+ * User: sschaffe
+ * Date: 24.01.12
+ * Time: 22:04
+ * To change this template use File | Settings | File Templates.
+ */
+class ClientConfiguration
+{
+
+    protected $baseUrl;
+
+    protected $username;
+
+    protected $password;
+
+    function __construct($baseUrl, $username = null, $password = null)
+    {
+        $this->baseUrl  = $baseUrl;
+        $this->username = $username;
+        $this->password = $password;
+    }
+
+    public function setBaseUrl($baseUrl)
+    {
+        $this->baseUrl = $baseUrl;
+    }
+
+    public function getBaseUrl()
+    {
+        return $this->baseUrl;
+    }
+
+    public function setPassword($password)
+    {
+        $this->password = $password;
+    }
+
+    public function getPassword()
+    {
+        return $this->password;
+    }
+
+    public function setUsername($username)
+    {
+        $this->username = $username;
+    }
+
+    public function getUsername()
+    {
+        return $this->username;
+    }
+
+    public function getBaseUrlComponents($path = "") {
+        $components = parse_url($this->getBaseUrl() . $path);
+        if (!in_array("path", $components)) {
+            $components["path"] = "";
+        }
+        return $components;
+    }
+
+}

http://git-wip-us.apache.org/repos/asf/incubator-marmotta/blob/c32963d5/lmf-client/lmf-client-php/src/main/php/autoload.php
----------------------------------------------------------------------
diff --git a/lmf-client/lmf-client-php/src/main/php/autoload.php b/lmf-client/lmf-client-php/src/main/php/autoload.php
new file mode 100644
index 0000000..3ae376b
--- /dev/null
+++ b/lmf-client/lmf-client-php/src/main/php/autoload.php
@@ -0,0 +1,50 @@
+<?php
+/*
+ * Copyright (C) 2013 Salzburg Research.
+ *
+ * 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.
+ */
+/**
+ * Created by IntelliJ IDEA.
+ * User: sschaffe
+ * Date: 25.01.12
+ * Time: 15:37
+ * To change this template use File | Settings | File Templates.
+ */
+require_once 'vendor/.composer/autoload.php';
+
+require_once 'ClientConfiguration.php';
+require_once 'clients/ResourceClient.php';
+require_once 'clients/ConfigurationClient.php';
+require_once 'clients/ClassificationClient.php';
+require_once 'clients/SPARQLClient.php';
+require_once 'clients/LDPathClient.php';
+require_once 'clients/ImportClient.php';
+require_once 'clients/SearchClient.php';
+require_once 'clients/CoresClient.php';
+require_once 'clients/ReasonerClient.php';
+
+
+require_once 'exceptions/LMFClientException.php';
+require_once 'exceptions/NotFoundException.php';
+require_once 'exceptions/ContentFormatException.php';
+
+
+require_once 'model/content/Content.php';
+require_once 'model/rdf/RDFNode.php';
+require_once 'model/rdf/BNode.php';
+require_once 'model/rdf/Literal.php';
+require_once 'model/rdf/URI.php';
+
+
+?>
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/incubator-marmotta/blob/c32963d5/lmf-client/lmf-client-php/src/main/php/clients/ClassificationClient.php
----------------------------------------------------------------------
diff --git a/lmf-client/lmf-client-php/src/main/php/clients/ClassificationClient.php b/lmf-client/lmf-client-php/src/main/php/clients/ClassificationClient.php
new file mode 100644
index 0000000..74de46e
--- /dev/null
+++ b/lmf-client/lmf-client-php/src/main/php/clients/ClassificationClient.php
@@ -0,0 +1,220 @@
+<?php
+/*
+ * Copyright (C) 2013 Salzburg Research.
+ *
+ * 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.
+ */
+namespace LMFClient\Clients;
+
+require_once 'vendor/.composer/autoload.php';
+
+use \LMFClient\ClientConfiguration;
+use \LMFClient\Exceptions\LMFClientException;
+
+use Guzzle\Http\Client;
+use Guzzle\Http\Message\BadResponseException;
+
+
+/**
+ * Created by IntelliJ IDEA.
+ * User: sschaffe
+ * Date: 25.01.12
+ * Time: 15:40
+ * To change this template use File | Settings | File Templates.
+ */
+class ClassificationClient
+{
+    protected $config;
+
+    private static $URL_CLASSIFICATION_SERVICE = "/classifier";
+
+    function __construct(ClientConfiguration $config)
+    {
+        $this->config = $config;
+    }
+
+
+
+    /**
+     * Create a new classifier with the given name. The service will take care of creating the appropriate
+     * configuration entries and work files in the LMF work directory.
+     *
+     * @param name string a string identifying the classifier; should only consist of alphanumeric characters (no white spaces)
+     */
+    public function createClassifier($name) {
+        try {
+            $client = new Client();
+            $request = $client->post($this->getServiceUrl("/" . urlencode($name)),array(
+                "User-Agent"   => "LMF Client Library (PHP)",
+                "Content-Length" => "0",
+                "Content-Type" => "application/json"
+            ));
+            // set authentication if given in configuration
+            if(!is_null($this->config->getUsername())) {
+                $request->setAuth($this->config->getUsername(),$this->config->getPassword());
+            }
+            $request->send();
+
+        } catch(BadResponseException $ex) {
+            throw new LMFClientException("could not create classifier with name $name; ".$ex->getResponse()->getReasonPhrase());
+        }
+    }
+
+
+    /**
+     * Remove the classifier with the given name from the system configuration.
+     *
+     * @param name       string a string identifying the classifier; should only consist of alphanumeric characters (no white spaces)
+     * @param removeData bool also remove all training and model data of this classifier from the file system
+     */
+    public function removeClassifier($name, $removeData = false)  {
+        try {
+            $client = new Client();
+            $request = $client->delete($this->getServiceUrl("/" . urlencode($name)),array(
+                "User-Agent"   => "LMF Client Library (PHP)",
+            ));
+            // set authentication if given in configuration
+            if(!is_null($this->config->getUsername())) {
+                $request->setAuth($this->config->getUsername(),$this->config->getPassword());
+            }
+            $response = $request->send();
+
+        } catch(BadResponseException $ex) {
+            throw new LMFClientException("could not delete classifier $name; ".$ex->getResponse()->getReasonPhrase());
+        }
+    }
+
+
+    /**
+     * List all classifiers registered in the classification service.
+     *
+     * @return a collection of Classifier instances representing all registered classifiers
+     */
+    public function listClassifiers() {
+        try {
+            $client = new Client();
+            $request = $client->get($this->getServiceUrl("/list") ,array(
+                "User-Agent"   => "LMF Client Library (PHP)",
+                "Accept"       => "application/json"
+            ));
+            // set authentication if given in configuration
+            if(!is_null($this->config->getUsername())) {
+                $request->setAuth($this->config->getUsername(),$this->config->getPassword());
+            }
+            $response = $request->send();
+
+            $result = json_decode($response->getBody(true),true);
+
+            return $result;
+        } catch(BadResponseException $ex) {
+            throw new LMFClientException("could not list classifiers; ".$ex->getResponse()->getReasonPhrase());
+        }
+    }
+
+
+    /**
+     * Add training data to the classifier identified by the given name and for the concept passed as argument. Note
+     * that training data is not immediately taken into account by the classifier. Retraining of the classifier will
+     * take place when a certain threshold of training datasets has been added or when a certain (configurable) time has
+     * passed.
+     *
+     * @param name        string a string identifying the classifier; should only consist of alphanumeric characters (no white spaces)
+     * @param concept_uri string the URI of the concept which to train with the sample text
+     * @param sampleText  string the sample text for the concept
+     */
+    public function trainClassifier($name, $concept_uri, $sampleText) {
+        try {
+            $client = new Client();
+            $request = $client->post($this->getServiceUrl("/" . urlencode($name) . "/train?concept=" . urlencode($concept_uri)),array(
+                "User-Agent"   => "LMF Client Library (PHP)",
+                "Content-Type" => "text/plain"
+            ), $sampleText);
+            // set authentication if given in configuration
+            if(!is_null($this->config->getUsername())) {
+                $request->setAuth($this->config->getUsername(),$this->config->getPassword());
+            }
+            $response = $request->send();
+
+        } catch(BadResponseException $ex) {
+            throw new LMFClientException("could not train classifier $name; ".$ex->getResponse()->getReasonPhrase());
+        }
+
+    }
+
+
+
+    /**
+     * Retrain the classifier with the given name immediately. Will read in the training data and create a new
+     * classification model.
+     *
+     * @param name
+     *
+     * @throws LMFClientException
+     */
+    public function retrainClassifier($name) {
+        try {
+            $client = new Client();
+            $request = $client->post($this->getServiceUrl("/" . urlencode($name) . "/retrain"),array(
+                "User-Agent"   => "LMF Client Library (PHP)",
+                "Content-Length" => "0",
+                "Content-Type" => "application/json"
+            ));
+            // set authentication if given in configuration
+            if(!is_null($this->config->getUsername())) {
+                $request->setAuth($this->config->getUsername(),$this->config->getPassword());
+            }
+            $response = $request->send();
+
+        } catch(BadResponseException $ex) {
+            throw new LMFClientException("could not retrain classifier $name; ".$ex->getResponse()->getReasonPhrase());
+        }
+    }
+
+
+    /**
+     * Get classifications from the given classifier for the given text. The classifications will be ordered by
+     * descending probability, so that classifications with higher probability will be first. A classification object
+     * consists of a KiWiUriResource identifying the classified concept and a probability indicating how likely it is
+     * that the text matches the given concept.
+     *
+     * @param classifier string a string identifying the classifier; should only consist of alphanumeric characters (no white spaces)
+     * @param text       string the text to classify
+     * @return a list of classifications ordered by descending probability
+     */
+    public function getAllClassifications($classifier, $text, $threshold = 0.0) {
+        try {
+            $client = new Client();
+            $request = $client->post($this->getServiceUrl("/" . urlencode($classifier) . "/classify?threshold=" . $threshold),array(
+                "User-Agent"   => "LMF Client Library (PHP)",
+                "Content-Type" => "text/plain"
+            ), $text);
+            // set authentication if given in configuration
+            if(!is_null($this->config->getUsername())) {
+                $request->setAuth($this->config->getUsername(),$this->config->getPassword());
+            }
+            $response = $request->send();
+
+            return json_decode($response->getBody(true),true);
+
+        } catch(BadResponseException $ex) {
+            throw new LMFClientException("could not execute classifier $classifier; ".$ex->getResponse()->getReasonPhrase());
+        }
+    }
+
+
+    private function getServiceUrl($suffix) {
+        $serviceUrl = $this->config->getBaseUrl() . ClassificationClient::$URL_CLASSIFICATION_SERVICE . $suffix;
+        return $serviceUrl;
+    }
+
+}

http://git-wip-us.apache.org/repos/asf/incubator-marmotta/blob/c32963d5/lmf-client/lmf-client-php/src/main/php/clients/ConfigurationClient.php
----------------------------------------------------------------------
diff --git a/lmf-client/lmf-client-php/src/main/php/clients/ConfigurationClient.php b/lmf-client/lmf-client-php/src/main/php/clients/ConfigurationClient.php
new file mode 100644
index 0000000..ca27987
--- /dev/null
+++ b/lmf-client/lmf-client-php/src/main/php/clients/ConfigurationClient.php
@@ -0,0 +1,183 @@
+<?php
+/*
+ * Copyright (C) 2013 Salzburg Research.
+ *
+ * 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.
+ */
+namespace LMFClient\Clients;
+
+require_once 'vendor/.composer/autoload.php';
+
+use \LMFClient\ClientConfiguration;
+use \LMFClient\Exceptions\LMFClientException;
+
+use Guzzle\Http\Client;
+use Guzzle\Http\Message\BadResponseException;
+
+
+/**
+ * Created by IntelliJ IDEA.
+ * User: sschaffe
+ * Date: 25.01.12
+ * Time: 15:40
+ * To change this template use File | Settings | File Templates.
+ */
+class ConfigurationClient
+{
+    protected $config;
+
+    private static $URL_CONFIG_SERVICE = "/config";
+
+    function __construct(ClientConfiguration $config)
+    {
+        $this->config = $config;
+    }
+
+
+    /**
+     * Return a list of all configuration keys that are currently set in the LMF configuration.
+     * @return array an array containing all configuration keys
+     */
+    public function listConfigurationKeys()  {
+        $client = new Client();
+        $request = $client->get($this->getServiceUrl("/list"),array(
+            "User-Agent"   => "LMF Client Library (PHP)",
+            "Accept" => "application/json"
+        ));
+        // set authentication if given in configuration
+        if(!is_null($this->config->getUsername())) {
+            $request->setAuth($this->config->getUsername(),$this->config->getPassword());
+        }
+        $response = $request->send();
+
+        $result = array();
+        // parse JSON response
+        foreach(json_decode($response->getBody(true)) as $key => $value) {
+            $result[] = $key;
+        }
+        return $result;
+    }
+
+    /**
+     * Return a list of all configurations (keys and values) that are currently set in the LMF configuration.
+     * @return array a map mapping all configuration keys to their values (string or array of strings)
+     */
+    public function listConfigurations($prefix = 0) {
+        $client = new Client();
+        $request = $client->get($this->getServiceUrl("/list" . ($prefix?"?prefix=".urlencode($prefix):"")),array(
+            "User-Agent"   => "LMF Client Library (PHP)",
+            "Accept" => "application/json"
+        ));
+        // set authentication if given in configuration
+        if(!is_null($this->config->getUsername())) {
+            $request->setAuth($this->config->getUsername(),$this->config->getPassword());
+        }
+        $response = $request->send();
+
+        $result = array();
+        // parse JSON response
+        foreach(json_decode($response->getBody(true),true) as $key => $value) {
+            $result[$key] = $value["value"];
+        }
+        return $result;
+    }
+
+    /**
+     * Return the configuration with the given key, or null if it does not exist
+     * @param key
+     * @return
+     */
+    public function getConfiguration($key) {
+        try {
+            $client = new Client();
+            $request = $client->get($this->getServiceUrl("/data/" . urlencode($key)),array(
+                "User-Agent"   => "LMF Client Library (PHP)",
+                "Accept" => "application/json"
+            ));
+            // set authentication if given in configuration
+            if(!is_null($this->config->getUsername())) {
+                $request->setAuth($this->config->getUsername(),$this->config->getPassword());
+            }
+
+            $response = $request->send();
+
+            $result = json_decode($response->getBody(true),true);
+
+            return $result[$key];
+        } catch(BadResponseException $ex) {
+            if($ex->getResponse()->getStatusCode() == 404) {
+                return null;
+            } else {
+                throw new LMFClientException("could not retrieve configuration with key $key; ".$ex->getResponse()->getReasonPhrase());
+            }
+        }
+    }
+
+
+    /**
+     * Update the configuration "key" with the given value. Value can be either a list of values or one of the
+     * primitive types String, Boolean, Integer, Double
+     * @param key
+     * @param value
+     */
+    public function setConfiguration($key, $value) {
+        // send values always as a JSON list
+        $json_data = json_encode(is_array($value)?$value:array($value));
+
+        try {
+            $client = new Client();
+            $request = $client->post($this->getServiceUrl("/data/" . urlencode($key)),array(
+                "User-Agent"   => "LMF Client Library (PHP)",
+                "Content-Type" => "application/json"
+            ),$json_data);
+            // set authentication if given in configuration
+            if(!is_null($this->config->getUsername())) {
+                $request->setAuth($this->config->getUsername(),$this->config->getPassword());
+            }
+            $request->send();
+
+        } catch(BadResponseException $ex) {
+            throw new LMFClientException("could not update configuration with key $key; ".$ex->getResponse()->getReasonPhrase());
+        }
+    }
+
+    /**
+     * Remove the configuration with the given key.
+     *
+     * @param key
+     * @throws IOException
+     * @throws LMFClientException
+     */
+    public function deleteConfiguration($key) {
+        try {
+            $client = new Client();
+            $request = $client->delete($this->getServiceUrl("/data/" . urlencode($key)),array(
+                "User-Agent"   => "LMF Client Library (PHP)"
+            ));
+            // set authentication if given in configuration
+            if(!is_null($this->config->getUsername())) {
+                $request->setAuth($this->config->getUsername(),$this->config->getPassword());
+            }
+            $response = $request->send();
+        } catch(BadResponseException $ex) {
+            throw new LMFClientException("could not delete configuration with key $key; ".$ex->getResponse()->getReasonPhrase());
+        }
+    }
+
+
+    private function getServiceUrl($suffix) {
+        $serviceUrl = $this->config->getBaseUrl() . ConfigurationClient::$URL_CONFIG_SERVICE . $suffix;
+        return $serviceUrl;
+    }
+
+}

http://git-wip-us.apache.org/repos/asf/incubator-marmotta/blob/c32963d5/lmf-client/lmf-client-php/src/main/php/clients/CoresClient.php
----------------------------------------------------------------------
diff --git a/lmf-client/lmf-client-php/src/main/php/clients/CoresClient.php b/lmf-client/lmf-client-php/src/main/php/clients/CoresClient.php
new file mode 100644
index 0000000..0c86b3f
--- /dev/null
+++ b/lmf-client/lmf-client-php/src/main/php/clients/CoresClient.php
@@ -0,0 +1,185 @@
+<?php
+/*
+ * Copyright (C) 2013 Salzburg Research.
+ *
+ * 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.
+ */
+
+namespace LMFClient\Clients;
+
+require_once 'vendor/.composer/autoload.php';
+require_once 'model/content/Content.php';
+require_once 'exceptions/LMFClientException.php';
+require_once 'exceptions/NotFoundException.php';
+require_once 'exceptions/ContentFormatException.php';
+
+use \LMFClient\Model\Content\Content;
+use \LMFClient\ClientConfiguration;
+
+use \LMFClient\Exceptions\LMFClientException;
+use \LMFClient\Exceptions\NotFoundException;
+use \LMFClient\Exceptions\ContentFormatException;
+
+use LMFClient\Model\RDF\Literal;
+use LMFClient\Model\RDF\URI;
+use LMFClient\Model\RDF\BNode;
+
+
+use Guzzle\Http\Client;
+use Guzzle\Http\Message\BadResponseException;
+
+
+/**
+ * A client allowing to retrieve and configure the SOLR cores that are registered in the LMF server.
+ * User: sschaffe
+ * Date: 27.01.12
+ * Time: 16:01
+ * To change this template use File | Settings | File Templates.
+ */
+class CoresClient
+{
+    private static $URL_CORES_SERVICE  = "/solr/cores";
+
+    protected $config;
+
+    function __construct(ClientConfiguration $config)
+    {
+        $this->config = $config;
+    }
+
+
+    /**
+     * Retrieve a list of all core names registered and activated in the LMF server.
+     *
+     * @return array of core names
+     * @throws IOException
+     * @throws LMFClientException
+     */
+    public function listCores() {
+        $client = new Client();
+        $request = $client->get($this->getServiceUrl(),array(
+            "User-Agent"   => "LMF Client Library (PHP)",
+            "Accept" => "application/json"
+        ));
+        // set authentication if given in configuration
+        if(!is_null($this->config->getUsername())) {
+            $request->setAuth($this->config->getUsername(),$this->config->getPassword());
+        }
+        $response = $request->send();
+
+        return json_decode($response->getBody(true),true);
+    }
+
+    /**
+     * Return the LDPath program configured for the core with the name passed as argument.
+     *
+     * Note that this library provides no further functionality for evaluating LDPath programs. You may use the
+     * separate LDPath libraries at http://code.google.com/p/ldpath/.
+     *
+     * @param coreName name of the core for which to retrieve the LDPath program
+     * @return
+     * @throws IOException
+     * @throws LMFClientException
+     */
+    public function getCoreConfiguration($coreName) {
+        $client = new Client();
+        $request = $client->get($this->getServiceUrl($coreName),array(
+            "User-Agent"   => "LMF Client Library (PHP)",
+            "Accept" => "text/plain"
+        ));
+        // set authentication if given in configuration
+        if(!is_null($this->config->getUsername())) {
+            $request->setAuth($this->config->getUsername(),$this->config->getPassword());
+        }
+        $response = $request->send();
+
+        return $response->getBody(true);
+    }
+
+    /**
+     * Create the core configuration for the given core using the LDPath program passed  as argument.
+     *
+     * Note that this library provides no further functionality for evaluating LDPath programs. You may use the
+     * separate LDPath libraries at http://code.google.com/p/ldpath/.
+     *
+     * @param coreName     the name of the core to update
+     * @param coreProgram  the LDPath program to use as core configuration
+     * @throws IOException
+     * @throws LMFClientException
+     */
+    public function createCoreConfiguration($coreName, $coreProgram) {
+        $client = new Client();
+        $request = $client->post($this->getServiceUrl($coreName),array(
+            "User-Agent"   => "LMF Client Library (PHP)",
+            "Content-Type" => "text/plain"
+        ),$coreProgram);
+        // set authentication if given in configuration
+        if(!is_null($this->config->getUsername())) {
+            $request->setAuth($this->config->getUsername(),$this->config->getPassword());
+        }
+        $response = $request->send();
+    }
+
+
+    /**
+     * Update the core configuration for the given core using the LDPath program passed  as argument.
+     *
+     * Note that this library provides no further functionality for evaluating LDPath programs. You may use the
+     * separate LDPath libraries at http://code.google.com/p/ldpath/.
+     *
+     * @param coreName     the name of the core to update
+     * @param coreProgram  the LDPath program to use as core configuration
+     * @throws IOException
+     * @throws LMFClientException
+     */
+    public function updateCoreConfiguration($coreName, $coreProgram) {
+        $client = new Client();
+        $request = $client->put($this->getServiceUrl($coreName),array(
+            "User-Agent"   => "LMF Client Library (PHP)",
+            "Content-Type" => "text/plain"
+        ),$coreProgram);
+        // set authentication if given in configuration
+        if(!is_null($this->config->getUsername())) {
+            $request->setAuth($this->config->getUsername(),$this->config->getPassword());
+        }
+        $response = $request->send();
+    }
+
+    /**
+     * Remove the core with the name passed as argument.
+     *
+     * @param coreName   name of the core to delete
+     * @throws IOException
+     * @throws NotFoundException  in case the core with this name does not exist
+     * @throws LMFClientException
+     */
+    public function deleteCore($coreName) {
+        $client = new Client();
+        $request = $client->delete($this->getServiceUrl($coreName),array(
+            "User-Agent"   => "LMF Client Library (PHP)"
+        ));
+        // set authentication if given in configuration
+        if(!is_null($this->config->getUsername())) {
+            $request->setAuth($this->config->getUsername(),$this->config->getPassword());
+        }
+        $response = $request->send();
+    }
+
+
+    private function getServiceUrl($suffix = 0) {
+        $serviceUrl = $this->config->getBaseUrl() . CoresClient::$URL_CORES_SERVICE .
+            ($suffix ? "/" . urlencode($suffix) : "");
+        return $serviceUrl;
+    }
+
+}

http://git-wip-us.apache.org/repos/asf/incubator-marmotta/blob/c32963d5/lmf-client/lmf-client-php/src/main/php/clients/ImportClient.php
----------------------------------------------------------------------
diff --git a/lmf-client/lmf-client-php/src/main/php/clients/ImportClient.php b/lmf-client/lmf-client-php/src/main/php/clients/ImportClient.php
new file mode 100644
index 0000000..670276d
--- /dev/null
+++ b/lmf-client/lmf-client-php/src/main/php/clients/ImportClient.php
@@ -0,0 +1,120 @@
+<?php
+/*
+ * Copyright (C) 2013 Salzburg Research.
+ *
+ * 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.
+ */
+
+namespace LMFClient\Clients;
+
+require_once 'vendor/.composer/autoload.php';
+require_once 'model/content/Content.php';
+require_once 'exceptions/LMFClientException.php';
+require_once 'exceptions/NotFoundException.php';
+require_once 'exceptions/ContentFormatException.php';
+
+use \LMFClient\Model\Content\Content;
+use \LMFClient\ClientConfiguration;
+
+use \LMFClient\Exceptions\LMFClientException;
+use \LMFClient\Exceptions\NotFoundException;
+use \LMFClient\Exceptions\ContentFormatException;
+
+use LMFClient\Model\RDF\Literal;
+use LMFClient\Model\RDF\URI;
+use LMFClient\Model\RDF\BNode;
+
+
+use Guzzle\Http\Client;
+use Guzzle\Http\Message\BadResponseException;
+
+
+/**
+ * Created by IntelliJ IDEA.
+ * User: sschaffe
+ * Date: 27.01.12
+ * Time: 14:01
+ * To change this template use File | Settings | File Templates.
+ */
+class ImportClient
+{
+
+    private static $URL_TYPES_SERVICE  = "/import/types";
+    private static $URL_UPLOAD_SERVICE = "/import/upload";
+
+    function __construct(ClientConfiguration $config)
+    {
+        $this->config = $config;
+    }
+
+
+    /**
+     * Return a set of mime types representing the types that are accepted by the LMF server.
+     *
+     * @return
+     * @throws IOException
+     * @throws LMFClientException
+     */
+    public function getSupportedTypes() {
+        $serviceUrl = $this->config->getBaseUrl() . ImportClient::$URL_TYPES_SERVICE;
+
+        try {
+            $client = new Client();
+            $request = $client->get($serviceUrl,array(
+                "User-Agent"   => "LMF Client Library (PHP)",
+                "Accept" => "application/json"
+            ));
+            // set authentication if given in configuration
+            if(!is_null($this->config->getUsername())) {
+                $request->setAuth($this->config->getUsername(),$this->config->getPassword());
+            }
+            $response = $request->send();
+
+            return json_decode($response->getBody(true),true);
+
+
+        } catch(BadResponseException $ex) {
+            throw new LMFClientException("error listing supported types; ".$ex->getResponse()->getReasonPhrase());
+        }
+    }
+
+    /**
+     * Upload/Import a dataset in the LMF Server. The dataset is given as a string that contains data of the
+     * mime type passed as argument. The mime type must be one of the acceptable types of the server.
+     *
+     * @param data        string to read the dataset from; will be consumed by this method
+     * @param mimeType  mime type of the input data
+     * @throws IOException
+     * @throws LMFClientException
+     */
+    public function uploadDataset($data, $mimeType) {
+        $serviceUrl = $this->config->getBaseUrl() . ImportClient::$URL_UPLOAD_SERVICE;
+
+        try {
+            $client = new Client();
+            $request = $client->post($serviceUrl,array(
+                "User-Agent"   => "LMF Client Library (PHP)",
+                "Content-Type" => $mimeType
+            ),$data);
+            // set authentication if given in configuration
+            if(!is_null($this->config->getUsername())) {
+                $request->setAuth($this->config->getUsername(),$this->config->getPassword());
+            }
+            $response = $request->send();
+
+        } catch(BadResponseException $ex) {
+            throw new LMFClientException("error uploading dataset; ".$ex->getResponse()->getReasonPhrase());
+        }
+    }
+
+}

http://git-wip-us.apache.org/repos/asf/incubator-marmotta/blob/c32963d5/lmf-client/lmf-client-php/src/main/php/clients/LDPathClient.php
----------------------------------------------------------------------
diff --git a/lmf-client/lmf-client-php/src/main/php/clients/LDPathClient.php b/lmf-client/lmf-client-php/src/main/php/clients/LDPathClient.php
new file mode 100644
index 0000000..76befee
--- /dev/null
+++ b/lmf-client/lmf-client-php/src/main/php/clients/LDPathClient.php
@@ -0,0 +1,139 @@
+<?php
+/*
+ * Copyright (C) 2013 Salzburg Research.
+ *
+ * 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.
+ */
+namespace LMFClient\Clients;
+
+require_once 'vendor/.composer/autoload.php';
+require_once 'model/content/Content.php';
+require_once 'exceptions/LMFClientException.php';
+require_once 'exceptions/NotFoundException.php';
+require_once 'exceptions/ContentFormatException.php';
+require_once 'util/rdfjson.php';
+
+use \LMFClient\Model\Content\Content;
+use \LMFClient\ClientConfiguration;
+
+use \LMFClient\Exceptions\LMFClientException;
+use \LMFClient\Exceptions\NotFoundException;
+use \LMFClient\Exceptions\ContentFormatException;
+
+use LMFClient\Model\RDF\Literal;
+use LMFClient\Model\RDF\URI;
+use LMFClient\Model\RDF\BNode;
+
+
+use Guzzle\Http\Client;
+use Guzzle\Http\Message\BadResponseException;
+
+/**
+ * Run LDPath queries agains the LMF LDPath Webservice. Allows evaluation of simple path queries as well as of
+ * complex path programs.
+ *
+ * User: sschaffe
+ * Date: 27.01.12
+ * Time: 17:13
+ * To change this template use File | Settings | File Templates.
+ */
+class LDPathClient
+{
+    protected $config;
+
+    private static $URL_PATH_SERVICE  = "/ldpath/path?path=";
+    private static $URL_PROGRAM_SERVICE = "/ldpath/program?program=";
+
+    function __construct(ClientConfiguration $config)
+    {
+        $this->config = $config;
+    }
+
+
+    /**
+     * Evaluate the path query passed as second argument, starting at the resource with the uri given as first argument.
+     * Returns an array of RDFNode objects.
+     *
+     * @param $uri
+     * @param $path
+     */
+    public function evaluatePath($uri, $path) {
+        $serviceUrl = $this->config->getBaseUrl() . LDPathClient::$URL_PATH_SERVICE . urlencode($path) . "&uri=" . urlencode($uri);
+
+
+        try {
+            $client = new Client();
+            $request = $client->get($serviceUrl,array(
+                "User-Agent"   => "LMF Client Library (PHP)",
+                "Accept" => "application/json"
+            ));
+            // set authentication if given in configuration
+            if(!is_null($this->config->getUsername())) {
+                $request->setAuth($this->config->getUsername(),$this->config->getPassword());
+            }
+            $response = $request->send();
+
+            $query_result = json_decode($response->getBody(true),true);
+
+            $result = array();
+
+            foreach($query_result as $node) {
+                $result[] = decode_node($node);
+            }
+            return $result;
+        } catch(BadResponseException $ex) {
+            throw new LMFClientException("error evaluating LDPath Query $path; ".$ex->getResponse()->getReasonPhrase());
+        }
+    }
+
+
+    /**
+     * Evaluate the LDPath program passed as second argument starting at the resource identified by the uri given as first argument.
+     * Returns a map from field names to lists of RDFNode objects, representing the results of the evaluation.
+     *
+     * @param $uri
+     * @param $program
+     */
+    public function evaluateProgram($uri, $program) {
+        $serviceUrl = $this->config->getBaseUrl() . LDPathClient::$URL_PROGRAM_SERVICE . urlencode($program) . "&uri=" . urlencode($uri);
+
+
+        try {
+            $client = new Client();
+            $request = $client->get($serviceUrl,array(
+                "User-Agent"   => "LMF Client Library (PHP)",
+                "Accept" => "application/json"
+            ));
+            // set authentication if given in configuration
+            if(!is_null($this->config->getUsername())) {
+                $request->setAuth($this->config->getUsername(),$this->config->getPassword());
+            }
+            $response = $request->send();
+
+            $query_result = json_decode($response->getBody(true),true);
+
+            $result = array();
+
+            foreach($query_result as $field => $value) {
+                $result[$field] = array();
+                foreach($value as $node) {
+                    $result[$field][] = decode_node($node);
+                }
+            }
+            return $result;
+        } catch(BadResponseException $ex) {
+            throw new LMFClientException("error evaluating LDPath Query $path; ".$ex->getResponse()->getReasonPhrase());
+        }
+    }
+
+}

http://git-wip-us.apache.org/repos/asf/incubator-marmotta/blob/c32963d5/lmf-client/lmf-client-php/src/main/php/clients/ReasonerClient.php
----------------------------------------------------------------------
diff --git a/lmf-client/lmf-client-php/src/main/php/clients/ReasonerClient.php b/lmf-client/lmf-client-php/src/main/php/clients/ReasonerClient.php
new file mode 100644
index 0000000..c6a01fb
--- /dev/null
+++ b/lmf-client/lmf-client-php/src/main/php/clients/ReasonerClient.php
@@ -0,0 +1,127 @@
+<?php
+/*
+ * Copyright (C) 2013 Salzburg Research.
+ *
+ * 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.
+ */
+namespace LMFClient\Clients;
+
+require_once 'vendor/.composer/autoload.php';
+require_once 'model/content/Content.php';
+require_once 'exceptions/LMFClientException.php';
+require_once 'exceptions/NotFoundException.php';
+require_once 'exceptions/ContentFormatException.php';
+
+use \LMFClient\Model\Content\Content;
+use \LMFClient\ClientConfiguration;
+
+use \LMFClient\Exceptions\LMFClientException;
+use \LMFClient\Exceptions\NotFoundException;
+use \LMFClient\Exceptions\ContentFormatException;
+
+use LMFClient\Model\RDF\Literal;
+use LMFClient\Model\RDF\URI;
+use LMFClient\Model\RDF\BNode;
+
+
+use Guzzle\Http\Client;
+use Guzzle\Http\Message\BadResponseException;
+
+/**
+ * Created by IntelliJ IDEA.
+ * User: sschaffe
+ * Date: 01.02.12
+ * Time: 17:52
+ * To change this template use File | Settings | File Templates.
+ */
+class ReasonerClient
+{
+
+    private static $URL_PROGRAM_SERVICE = "/reasoner/program";
+
+
+    protected $config;
+
+    function __construct(ClientConfiguration $config)
+    {
+        $this->config = $config;
+    }
+
+
+    /**
+     * List all reasoner programs installed in the LMF knowledge base. Returns an array of maps of the form
+     * array("name" => program name, "rules" => program string in KWRL syntax)
+     *
+     */
+    public function listPrograms() {
+        $client = new Client();
+        $request = $client->get($this->getServiceUrl("list"),array(
+            "User-Agent"   => "LMF Client Library (PHP)",
+            "Accept" => "application/json"
+        ));
+        // set authentication if given in configuration
+        if(!is_null($this->config->getUsername())) {
+            $request->setAuth($this->config->getUsername(),$this->config->getPassword());
+        }
+        $response = $request->send();
+
+        return json_decode($response->getBody(true),true);
+    }
+
+
+    /**
+     * Upload a reasoner program to the LMF knowledge base and register it with the name given as argument.
+     * The LMF will automatically trigger a full reasoning when the program has been uploaded successfully.
+     * The reasoner program is a string in the KWRL Syntax described at http://code.google.com/p/kiwi/wiki/Reasoning
+     *
+     * @param $name
+     * @param $program
+     */
+    public function uploadProgram($name, $program) {
+        $client = new Client();
+        $request = $client->post($this->getServiceUrl($name),array(
+            "User-Agent"   => "LMF Client Library (PHP)",
+            "Content-Type" => "text/plain"
+        ),$program);
+        // set authentication if given in configuration
+        if(!is_null($this->config->getUsername())) {
+            $request->setAuth($this->config->getUsername(),$this->config->getPassword());
+        }
+        $response = $request->send();
+    }
+
+    /**
+     * Remove the reasoner program with the given name from the LMF knowledge base.
+     * @param $name
+     */
+    public function deleteProgram($name) {
+        $client = new Client();
+        $request = $client->delete($this->getServiceUrl($name),array(
+            "User-Agent"   => "LMF Client Library (PHP)"
+        ));
+        // set authentication if given in configuration
+        if(!is_null($this->config->getUsername())) {
+            $request->setAuth($this->config->getUsername(),$this->config->getPassword());
+        }
+        $response = $request->send();
+    }
+
+
+    private function getServiceUrl($suffix = 0) {
+        $serviceUrl = $this->config->getBaseUrl() . ReasonerClient::$URL_PROGRAM_SERVICE .
+            ($suffix ? "/" . urlencode($suffix) : "");
+        return $serviceUrl;
+    }
+
+}
+?>

http://git-wip-us.apache.org/repos/asf/incubator-marmotta/blob/c32963d5/lmf-client/lmf-client-php/src/main/php/clients/ResourceClient.php
----------------------------------------------------------------------
diff --git a/lmf-client/lmf-client-php/src/main/php/clients/ResourceClient.php b/lmf-client/lmf-client-php/src/main/php/clients/ResourceClient.php
new file mode 100644
index 0000000..bb9918f
--- /dev/null
+++ b/lmf-client/lmf-client-php/src/main/php/clients/ResourceClient.php
@@ -0,0 +1,258 @@
+<?php
+/*
+ * Copyright (C) 2013 Salzburg Research.
+ *
+ * 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.
+ */
+namespace LMFClient\Clients;
+
+require_once 'vendor/.composer/autoload.php';
+require_once 'util/rdfjson.php';
+require_once 'model/content/Content.php';
+require_once 'exceptions/LMFClientException.php';
+require_once 'exceptions/NotFoundException.php';
+require_once 'exceptions/ContentFormatException.php';
+
+use \LMFClient\Model\Content\Content;
+use \LMFClient\ClientConfiguration;
+
+use \LMFClient\Exceptions\LMFClientException;
+use \LMFClient\Exceptions\NotFoundException;
+use \LMFClient\Exceptions\ContentFormatException;
+
+use Guzzle\Http\Client;
+use Guzzle\Http\Message\BadResponseException;
+
+/**
+ * Created by IntelliJ IDEA.
+ * User: sschaffe
+ * Date: 23.01.12
+ * Time: 23:13
+ * To change this template use File | Settings | File Templates.
+ */
+class ResourceClient
+{
+    protected $config;
+
+    private static $URL_RESOURCE_SERVICE = "/resource?uri=";
+
+    function __construct(ClientConfiguration $config)
+    {
+        $this->config = $config;
+    }
+
+    /**
+     * Create a resource in the remote LMF installation
+     * @param $uri
+     * @throws Exception
+     */
+    public /* boolean */ function createResource($uri) {
+        $client = new Client();
+        $request = $client->post($this->getServiceUrl($uri),array(
+            "User-Agent"   => "LMF Client Library (PHP)",
+            "Content-Length" => "0",
+            "Content-Type" => "application/json"
+        ));
+        // set authentication if given in configuration
+        if(!_isset($this->config->getUsername())) {
+            $request->setAuth($this->config->getUsername(),$this->config->getPassword());
+        }
+        //$request->getCurlOptions()->set(CURLOPT_PROXY, "localhost:8888");
+        $request->send();
+    }
+
+
+    public /* boolean */ function existsResource($uri) {
+        $client = new Client();
+        $request = $client->options($this->getServiceUrl($uri),array(
+            "User-Agent"   => "LMF Client Library (PHP)"
+        ));
+        // set authentication if given in configuration
+        if(!_isset($this->config->getUsername())) {
+            $request->setAuth($this->config->getUsername(),$this->config->getPassword());
+        }
+        $response = $request->send();
+
+        if($response->hasHeader("Access-Control-Allow-Methods")) {
+            if($response->getHeader("Access-Control-Allow-Methods") == "POST") {
+                return False;
+            } else if(strpos($response->getHeader("Access-Control-Allow-Methods"),"GET")) {
+                return True;
+            } else {
+                return False;
+            }
+        } else {
+            return False;
+        }
+    }
+
+    /**
+     * Return the metadata of the resource identified by the URI passed as argument. In PHP, the returned
+     * object is an array mapping from property URIs to arrays of RDFNodes, representing the values of this
+     * property.
+     * <p/>
+     * Example:
+     *
+     * array(
+     *    "http://xmlns.com/foaf/0.1/name" => array(new Literal("Sepp Huber"))
+     * )
+     *
+     * @param $uri
+     * @return array
+     */
+    public /* Metadata */ function getResourceMetadata($uri) {
+        try {
+            $client = new Client();
+            $request = $client->get($this->getServiceUrl($uri),array(
+                "User-Agent"   => "LMF Client Library (PHP)",
+                "Accept" => "application/json; rel=meta"
+            ));
+            // set authentication if given in configuration
+            if(!_isset($this->config->getUsername())) {
+                $request->setAuth($this->config->getUsername(),$this->config->getPassword());
+            }
+            $response = $request->send();
+
+            return decode_metadata($uri,$response->getBody(true));
+        } catch(BadResponseException $ex) {
+            if($ex->getResponse()->getStatusCode() == 404) {
+                throw new NotFoundException("could not retrieve resource metadata for resource $uri; it does not exist");
+            } else if($ex->getResponse()->getStatusCode() == 406) {
+                throw new ContentFormatException("server does not offer metadata type application/json for resource $uri");
+            } else {
+                throw new LMFClientException("could not retrieve resource metadata for resource $uri; ".$ex->getResponse()->getReasonPhrase());
+            }
+        }
+    }
+
+    /**
+     * Update the metadata of the resource identified by the URI passed as argument. The resource must exist before
+     * this method can be called (e.g. using createResource()).
+     *
+     * The metadata must be an array corresponding to the LMFClient metadata format.
+     *
+     * <p/>
+     * Example:
+     *
+     * array(
+     *    "http://xmlns.com/foaf/0.1/name" => array(new Literal("Sepp Huber"))
+     * )
+     *
+     * @param $uri
+     * @param $metadata
+     */
+    public /* void */ function updateResourceMetadata($uri, /* Metadata */ $metadata) {
+        $metadata_json = encode_metadata($uri, $metadata);
+
+        $client = new Client();
+        $request = $client->put($this->getServiceUrl($uri),array(
+            "User-Agent"   => "LMF Client Library (PHP)",
+            "Content-Type" => "application/json; rel=meta"
+        ), $metadata_json);
+        // set authentication if given in configuration
+        if(!_isset($this->config->getUsername())) {
+            $request->setAuth($this->config->getUsername(),$this->config->getPassword());
+        }
+        $response = $request->send();
+
+        if($response->getStatusCode() >= 400) {
+            throw new Exception("could not update resource $uri; ".$response->getReasonPhrase());
+        }
+    }
+
+    /**
+     * Retrieve the (human-readable) content of the given mimeType of the given resource. Will return a content
+     * object that allows reading the input stream. In case no content of the given mime type exists for the resource,
+     * will throw a Exception.
+     *
+     * @param $uri
+     * @param $mimeType
+     * @return Model\Content\Content
+     * @throws Exception
+     */
+    public /* Content */ function getResourceContent($uri, $mimeType)  {
+        try {
+            $client = new Client();
+            $request = $client->get($this->getServiceUrl($uri),array(
+                "User-Agent"   => "LMF Client Library (PHP)",
+                "Accept" => $mimeType . "; rel=content"
+            ));
+            // set authentication if given in configuration
+            if(!_isset($this->config->getUsername())) {
+                $request->setAuth($this->config->getUsername(),$this->config->getPassword());
+            }
+            $response = $request->send();
+
+            if($response->getStatusCode() >= 400) {
+                throw new Exception("could not retrieve resource metadata for resource $uri; ".$response->getReasonPhrase());
+            }
+
+            return new \LMFClient\Model\Content\Content($response->getBody(true),$response->getBody()->getSize(),$response->getHeader("Content-Type"));
+        } catch(BadResponseException $ex) {
+            if($ex->getResponse()->getStatusCode() == 404) {
+                throw new NotFoundException("could not retrieve resource content for resource $uri; it does not exist");
+            } else if($ex->getResponse()->getStatusCode() == 406) {
+                throw new ContentFormatException("server does not offer content type $mimeType for resource $uri");
+            } else {
+                throw new LMFClientException("could not retrieve resource content for resource $uri; ".$ex->getResponse()->getReasonPhrase());
+            }
+        }
+    }
+
+    /**
+     * Update the content of the resource identified by the URI given as argument. The resource has to exist before
+     * content can be uploaded to it. Any existing content will be overridden. Throws Exception if the content type is
+     * not supported or if the resource does not exist.
+     *
+     * @param $uri
+     * @param Model\Content\Content $content
+     * @throws Exception
+     */
+    public /* void */ function updateResourceContent($uri, Content $content) {
+        $client = new Client();
+        $request = $client->put($this->getServiceUrl($uri),array(
+            "User-Agent"   => "LMF Client Library (PHP)",
+            "Content-Type" => $content->getMimetype() . "; rel=content"
+        ), $content->getData());
+        // set authentication if given in configuration
+        if(!_isset($this->config->getUsername())) {
+            $request->setAuth($this->config->getUsername(),$this->config->getPassword());
+        }
+        $response = $request->send();
+
+        if($response->getStatusCode() >= 400) {
+            throw new Exception("could not update resource $uri; ".$response->getReasonPhrase());
+        }
+    }
+
+    public /* void */ function deleteResource($uri) {
+        $client = new Client();
+        $request = $client->delete($this->getServiceUrl($uri),array(
+            "User-Agent"   => "LMF Client Library (PHP)",
+        ));
+        // set authentication if given in configuration
+        if(!_isset($this->config->getUsername())) {
+            $request->setAuth($this->config->getUsername(),$this->config->getPassword());
+        }
+        $response = $request->send();
+
+        if($response->getStatusCode() >= 400) {
+            throw new Exception("could not delete resource $uri; ".$response->getReasonPhrase());
+        }
+    }
+
+    public function getServiceUrl($uri) {
+        return $this->config->getBaseUrl() . ResourceClient::$URL_RESOURCE_SERVICE . encodeURIComponent($uri);
+    }
+
+}

http://git-wip-us.apache.org/repos/asf/incubator-marmotta/blob/c32963d5/lmf-client/lmf-client-php/src/main/php/clients/SPARQLClient.php
----------------------------------------------------------------------
diff --git a/lmf-client/lmf-client-php/src/main/php/clients/SPARQLClient.php b/lmf-client/lmf-client-php/src/main/php/clients/SPARQLClient.php
new file mode 100644
index 0000000..29cdb43
--- /dev/null
+++ b/lmf-client/lmf-client-php/src/main/php/clients/SPARQLClient.php
@@ -0,0 +1,194 @@
+<?php
+/*
+ * Copyright (C) 2013 Salzburg Research.
+ *
+ * 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.
+ */
+namespace LMFClient\Clients;
+
+require_once 'vendor/.composer/autoload.php';
+require_once 'model/content/Content.php';
+require_once 'exceptions/LMFClientException.php';
+require_once 'exceptions/NotFoundException.php';
+require_once 'exceptions/ContentFormatException.php';
+
+use \LMFClient\Model\Content\Content;
+use \LMFClient\ClientConfiguration;
+
+use \LMFClient\Exceptions\LMFClientException;
+use \LMFClient\Exceptions\NotFoundException;
+use \LMFClient\Exceptions\ContentFormatException;
+
+use LMFClient\Model\RDF\Literal;
+use LMFClient\Model\RDF\URI;
+use LMFClient\Model\RDF\BNode;
+
+
+use Guzzle\Http\Client;
+use Guzzle\Http\Message\BadResponseException;
+
+/**
+ * A client for running SPARQL 1.1 Queries and Updates on the LMF Server.
+ * User: sschaffe
+ * Date: 27.01.12
+ * Time: 10:18
+ * To change this template use File | Settings | File Templates.
+ */
+class SPARQLClient
+{
+    protected $config;
+
+    private static $URL_QUERY_SERVICE  = "/sparql/select?query=";
+    private static $URL_UPDATE_SERVICE = "/sparql/update?query=";
+
+    function __construct(ClientConfiguration $config)
+    {
+        $this->config = $config;
+    }
+
+
+    /**
+     * Run a SPARQL Select query against the LMF Server and return the results as an array of rows, each consisting of a
+     * map mapping query variable names to result values (instances of RDFNode). Results will be transfered and parsed
+     * using the SPARQL JSON format.
+     * @param query a SPARQL Select query to run on the database
+     * @return
+     * @throws IOException
+     * @throws LMFClientException
+     */
+    public function select($query) {
+        $serviceUrl = $this->config->getBaseUrl() . SPARQLClient::$URL_QUERY_SERVICE . urlencode($query);
+
+
+        try {
+            $client = new Client();
+            $request = $client->get($serviceUrl,array(
+                "User-Agent"   => "LMF Client Library (PHP)",
+                "Accept" => "application/sparql-results+json"
+            ));
+            // set authentication if given in configuration
+            if(!is_null($this->config->getUsername())) {
+                $request->setAuth($this->config->getUsername(),$this->config->getPassword());
+            }
+            $response = $request->send();
+
+            $sparql_result = json_decode($response->getBody(true),true);
+
+            $variables = $sparql_result["head"]["vars"];
+            $bindings  = $sparql_result["results"]["bindings"];
+
+            $result = array();
+            foreach($bindings as $binding) {
+                $row = array();
+                foreach($binding as $var => $value) {
+
+                    if($value["type"] == "uri") {
+                        $object = new URI($value["value"]);
+                    } else if($value["type"] == "literal" || $value["type"] == "typed-literal") {
+                        $object = new Literal(
+                            $value["value"],
+                            isset($value["language"])?$value["language"]:null,
+                            isset($value["datatype"])?$value["datatype"]:null);
+
+                    } else if($value["type"] == "bnode") {
+                        $object = new BNode($value["value"]);
+                    }
+                    $row[$var] = $object;
+                }
+                $result[] = $row;
+            }
+            return $result;
+
+        } catch(BadResponseException $ex) {
+            throw new LMFClientException("error evaluating SPARQL Select Query $query; ".$ex->getResponse()->getReasonPhrase());
+        }
+
+    }
+
+
+    /**
+     * Carry out a SPARQL ASK Query and return either true or false, depending on the query result.
+     *
+     * @param askQuery
+     * @return boolean
+     * @throws IOException
+     * @throws LMFClientException
+     */
+    public function ask($askQuery) {
+        $serviceUrl = $this->config->getBaseUrl() . SPARQLClient::$URL_QUERY_SERVICE . urlencode($askQuery);
+
+
+        try {
+            $client = new Client();
+            $request = $client->get($serviceUrl,array(
+                "User-Agent"   => "LMF Client Library (PHP)",
+                "Accept" => "application/sparql-results+json"
+            ));
+            // set authentication if given in configuration
+            if(!is_null($this->config->getUsername())) {
+                $request->setAuth($this->config->getUsername(),$this->config->getPassword());
+            }
+            $response = $request->send();
+
+            $body = str_replace("boolean:","\"boolean\":",str_replace("head:","\"head\":",(string)$response->getBody(true)));
+            $sparql_result = json_decode($body,true);
+
+            if(count($sparql_result) == 0) {
+                return False;
+            } else {
+                $result  = $sparql_result["boolean"];
+                if($result == "true") {
+                    return True;
+                } else {
+                    return False;
+                }
+            }
+
+
+
+        } catch(BadResponseException $ex) {
+            throw new LMFClientException("error evaluating SPARQL Ask Query $askQuery; ".$ex->getResponse()->getReasonPhrase());
+        }
+    }
+
+
+    /**
+     * Execute a SPARQL Update query according to the SPARQL 1.1 standard. The query will only be passed to the server,
+     * which will react either with ok (in this the method simply returns) or with error (in this case, the method
+     * throws an LMFClientException).
+     *
+     * @param updateQuery         the SPARQL Update 1.1 query string
+     * @throws IOException        in case a connection problem occurs
+     * @throws LMFClientException in case the server returned and error and did not execute the update
+     */
+    public function update($updateQuery) {
+        $serviceUrl = $this->config->getBaseUrl() . SPARQLClient::$URL_UPDATE_SERVICE . urlencode($updateQuery);
+
+
+        try {
+            $client = new Client();
+            $request = $client->get($serviceUrl,array(
+                "User-Agent"   => "LMF Client Library (PHP)"
+            ));
+            // set authentication if given in configuration
+            if(!is_null($this->config->getUsername())) {
+                $request->setAuth($this->config->getUsername(),$this->config->getPassword());
+            }
+            $response = $request->send();
+
+
+        } catch(BadResponseException $ex) {
+            throw new LMFClientException("error evaluating SPARQL Update Query $updateQuery; ".$ex->getResponse()->getReasonPhrase());
+        }
+    }
+}

http://git-wip-us.apache.org/repos/asf/incubator-marmotta/blob/c32963d5/lmf-client/lmf-client-php/src/main/php/clients/SearchClient.php
----------------------------------------------------------------------
diff --git a/lmf-client/lmf-client-php/src/main/php/clients/SearchClient.php b/lmf-client/lmf-client-php/src/main/php/clients/SearchClient.php
new file mode 100644
index 0000000..53711bd
--- /dev/null
+++ b/lmf-client/lmf-client-php/src/main/php/clients/SearchClient.php
@@ -0,0 +1,214 @@
+<?php
+/*
+ * Copyright (C) 2013 Salzburg Research.
+ *
+ * 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.
+ */
+
+namespace LMFClient\Clients;
+
+require_once 'vendor/.composer/autoload.php';
+require_once 'model/content/Content.php';
+require_once 'exceptions/LMFClientException.php';
+require_once 'exceptions/NotFoundException.php';
+require_once 'exceptions/ContentFormatException.php';
+
+use \LMFClient\Model\Content\Content;
+use \LMFClient\ClientConfiguration;
+
+use \LMFClient\Exceptions\LMFClientException;
+use \LMFClient\Exceptions\NotFoundException;
+use \LMFClient\Exceptions\ContentFormatException;
+
+use \Solarium_Query_Select;
+
+use LMFClient\Model\RDF\Literal;
+use LMFClient\Model\RDF\URI;
+use LMFClient\Model\RDF\BNode;
+
+
+use Guzzle\Http\Client;
+use Guzzle\Http\Message\BadResponseException;
+
+use Solarium_Client;
+
+/**
+ * Evaluate SOLR searches over the LMF search cores. The PHP client library of the LMF makes use of Solarium;
+ * you can find the documentation at http://wiki.solarium-project.org/index.php/V2:Manual_for_version_2.x
+ *
+ * User: sschaffe
+ * Date: 27.01.12
+ * Time: 14:37
+ * To change this template use File | Settings | File Templates.
+ */
+class SearchClient
+{
+
+    private static $URL_SOLR_SERVICE  = "/solr";
+
+    private $config;
+
+    private $adapter;
+
+    private $clients = array();
+
+
+    function __construct(ClientConfiguration $config)
+    {
+        $this->config = $config;
+
+        $this->adapter = $this->config->getBaseUrlComponents();
+        if($this->config->getUsername() || $this->config->getPassword()) {
+            throw new LMFClientException("HTTP Authentication is not yet supported by the Solarium client");
+        }
+    }
+
+
+    /**
+     * Create and return a Solarium query object querying against the LMF core passed as argument. The query object
+     * can then be used with the full Solarium functionality for further querying. When configured, it needs to
+     * be passed to the search() method for evaluation.
+     *
+     * @param $core
+     * @return \Solarium_Query_Select
+     */
+    public function createQuery($core) {
+
+        if(!isset($clients[$core])) {
+            $solarium_config = array(
+                "adapteroptions" => array(
+                    "host" => $this->adapter["host"],
+                    "port" => $this->adapter["port"],
+                    "path" => $this->adapter["path"] . SearchClient::$URL_SOLR_SERVICE,
+                    "core" => $core
+                )
+            );
+            $clients[$core] = new Solarium_Client($solarium_config);
+        }
+        return $clients[$core]->createSelect();
+    }
+
+    /**
+     * Evaluate a SOLR query against the LMF core passed as argument. Returns an array of documents.
+     *
+     * @param $query
+     */
+    public function search($core,$query) {
+        if(!isset($clients[$core])) {
+            $solarium_config = array(
+                "adapteroptions" => array(
+                    "host" => $this->adapter["host"],
+                    "port" => $this->adapter["port"],
+                    "path" => $this->adapter["path"] . SearchClient::$URL_SOLR_SERVICE,
+                    "core" => $core
+                )
+            );
+            $clients[$core] = new Solarium_Client($solarium_config);
+        }
+        return $clients[$core]->select($query);
+    }
+
+
+    /**
+     * Run a SOLR search against the selected core and return the result as array of documents. This is a convenience
+     * wrapper around createQuery and Solarium for simpler cases.
+     *
+     * @param coreName name of the core to query
+     * @param query    the SolrQuery to run on the core
+     * @param options  array of configuration options
+     *                 (fields: array of field names, facets: array of fields to facet over, sort: array of sort fields,
+     *                  offset: integer position to start with, limit: maximum number of documents to return)
+     * @return
+     * @throws IOException
+     * @throws LMFClientException
+     */
+    public function simpleSearch($core, $query, $options = array()) {
+
+        $solr_query = $this->createQuery($core);
+        $solr_query->setQuery($query);
+
+        if(isset($options["fields"])) {
+            foreach($options["fields"] as $field) {
+                $solr_query->addField($field);
+            }
+        }
+
+        if(isset($options["sort"])) {
+            foreach($options["sort"] as $field) {
+                $solr_query->addSort($field, Solarium_Query_Select::SORT_DESC);
+            }
+        } else {
+            $solr_query->addSort("score", Solarium_Query_Select::SORT_DESC);
+        }
+
+        if(isset($options["facets"])) {
+            $facets = $solr_query->getFacetSet();
+            foreach($options["facets"] as $field) {
+                $facets->createFacetField($field)->setField($field);
+            }
+        }
+
+        if(isset($options["offset"])) {
+            $solr_query->setStart($options["offset"]);
+        }
+        if(isset($options["limit"])) {
+            $solr_query->setRows($options["limit"]);
+        }
+
+        return $this->search($core,$solr_query);
+    }
+
+
+    /**
+     * Run a SOLR MoreLikeThis query to get recommendations for the resource whose URI is passed as the first argument.
+     * The field options are a map from field names to floats representing the weight of the field for the recommendation.
+     *
+     * @param $uri
+     * @param array $field_options
+     */
+    public function recommendations($core, $uri, array $field_options) {
+        if(!isset($clients[$core])) {
+            $solarium_config = array(
+                "adapteroptions" => array(
+                    "host" => $this->adapter["host"],
+                    "port" => $this->adapter["port"],
+                    "path" => $this->adapter["path"] . SearchClient::$URL_SOLR_SERVICE,
+                    "core" => $core
+                )
+            );
+            $clients[$core] = new Solarium_Client($solarium_config);
+        }
+        $query = $clients[$core]->createMoreLikeThis();
+        $query->setQuery('lmf.uri:"'.$uri.'"');
+        $query->setInterestingTerms("details");
+        $query->setMinimumDocumentFrequency(1);
+        $query->setMinimumTermFrequency(1);
+        $query->setMatchInclude(true);
+
+        $fields = "";
+        $weights = "";
+        foreach($field_options as $field => $weight) {
+            $fields = $fields . $field . ",";
+            $weights = $weights . $field . "^" . $weight . " ";
+        }
+        if(count($field_options) > 0) {
+            $fields = substr($fields,0,-1);
+            $weights = substr($weights,0,-1);
+        }
+        $query->setMltFields($fields);
+        $query->setQueryFields($weights);
+
+        return $clients[$core]->select($query);
+    }
+
+}

http://git-wip-us.apache.org/repos/asf/incubator-marmotta/blob/c32963d5/lmf-client/lmf-client-php/src/main/php/exceptions/ContentFormatException.php
----------------------------------------------------------------------
diff --git a/lmf-client/lmf-client-php/src/main/php/exceptions/ContentFormatException.php b/lmf-client/lmf-client-php/src/main/php/exceptions/ContentFormatException.php
new file mode 100644
index 0000000..cc7d5e2
--- /dev/null
+++ b/lmf-client/lmf-client-php/src/main/php/exceptions/ContentFormatException.php
@@ -0,0 +1,33 @@
+<?php
+/*
+ * Copyright (C) 2013 Salzburg Research.
+ *
+ * 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.
+ */
+namespace LMFClient\Exceptions;
+
+require_once 'LMFClientException.php';
+
+use \LMFClient\Exceptions\LMFClientException;
+
+/**
+ * Created by IntelliJ IDEA.
+ * User: sschaffe
+ * Date: 27.01.12
+ * Time: 10:10
+ * To change this template use File | Settings | File Templates.
+ */
+class ContentFormatException extends LMFClientException
+{
+
+}

http://git-wip-us.apache.org/repos/asf/incubator-marmotta/blob/c32963d5/lmf-client/lmf-client-php/src/main/php/exceptions/LMFClientException.php
----------------------------------------------------------------------
diff --git a/lmf-client/lmf-client-php/src/main/php/exceptions/LMFClientException.php b/lmf-client/lmf-client-php/src/main/php/exceptions/LMFClientException.php
new file mode 100644
index 0000000..2d2af32
--- /dev/null
+++ b/lmf-client/lmf-client-php/src/main/php/exceptions/LMFClientException.php
@@ -0,0 +1,29 @@
+<?php
+/*
+ * Copyright (C) 2013 Salzburg Research.
+ *
+ * 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.
+ */
+namespace LMFClient\Exceptions;
+
+/**
+ * Created by IntelliJ IDEA.
+ * User: sschaffe
+ * Date: 27.01.12
+ * Time: 10:04
+ * To change this template use File | Settings | File Templates.
+ */
+class LMFClientException extends \Exception
+{
+
+}

http://git-wip-us.apache.org/repos/asf/incubator-marmotta/blob/c32963d5/lmf-client/lmf-client-php/src/main/php/exceptions/NotFoundException.php
----------------------------------------------------------------------
diff --git a/lmf-client/lmf-client-php/src/main/php/exceptions/NotFoundException.php b/lmf-client/lmf-client-php/src/main/php/exceptions/NotFoundException.php
new file mode 100644
index 0000000..0df7b4b
--- /dev/null
+++ b/lmf-client/lmf-client-php/src/main/php/exceptions/NotFoundException.php
@@ -0,0 +1,33 @@
+<?php
+/*
+ * Copyright (C) 2013 Salzburg Research.
+ *
+ * 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.
+ */
+namespace LMFClient\Exceptions;
+
+require_once 'LMFClientException.php';
+
+use LMFClient\Exceptions\LMFClientException;
+
+/**
+ * Created by IntelliJ IDEA.
+ * User: sschaffe
+ * Date: 27.01.12
+ * Time: 10:04
+ * To change this template use File | Settings | File Templates.
+ */
+class NotFoundException extends LMFClientException
+{
+
+}

http://git-wip-us.apache.org/repos/asf/incubator-marmotta/blob/c32963d5/lmf-client/lmf-client-php/src/main/php/model/content/Content.php
----------------------------------------------------------------------
diff --git a/lmf-client/lmf-client-php/src/main/php/model/content/Content.php b/lmf-client/lmf-client-php/src/main/php/model/content/Content.php
new file mode 100644
index 0000000..b41a71c
--- /dev/null
+++ b/lmf-client/lmf-client-php/src/main/php/model/content/Content.php
@@ -0,0 +1,70 @@
+<?php
+/*
+ * Copyright (C) 2013 Salzburg Research.
+ *
+ * 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.
+ */
+namespace LMFClient\Model\Content;
+
+
+/**
+ * Created by IntelliJ IDEA.
+ * User: sschaffe
+ * Date: 25.01.12
+ * Time: 14:51
+ * To change this template use File | Settings | File Templates.
+ */
+class Content
+{
+    /** @var string the buffer containing the data */
+    private $data;
+
+    /** @var integer the size of the content */
+    private $size;
+
+    /** @var string the mime type of the content */
+    private $mimetype;
+
+    function __construct($stream,$size,$mimetype)
+    {
+        $this->data     = $stream;
+        $this->size     = $size;
+        $this->mimetype = $mimetype;
+    }
+
+    /**
+     * @return string
+     */
+    public function getMimetype()
+    {
+        return $this->mimetype;
+    }
+
+    /**
+     * @return int
+     */
+    public function getSize()
+    {
+        return $this->size;
+    }
+
+    /**
+     * @return string
+     */
+    public function getData()
+    {
+        return $this->data;
+    }
+
+
+}

http://git-wip-us.apache.org/repos/asf/incubator-marmotta/blob/c32963d5/lmf-client/lmf-client-php/src/main/php/model/rdf/BNode.php
----------------------------------------------------------------------
diff --git a/lmf-client/lmf-client-php/src/main/php/model/rdf/BNode.php b/lmf-client/lmf-client-php/src/main/php/model/rdf/BNode.php
new file mode 100644
index 0000000..11e850f
--- /dev/null
+++ b/lmf-client/lmf-client-php/src/main/php/model/rdf/BNode.php
@@ -0,0 +1,56 @@
+<?php
+/*
+ * Copyright (C) 2013 Salzburg Research.
+ *
+ * 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.
+ */
+namespace LMFClient\Model\RDF;
+
+require_once 'RDFNode.php';
+use LMFClient\Model\RDF\RDFNode;
+
+/**
+ * Representation of an RDF blank node / anonymous node in PHP
+ *
+ * User: sschaffe
+ * Date: 25.01.12
+ * Time: 10:20
+ * To change this template use File | Settings | File Templates.
+ */
+class BNode extends RDFNode
+{
+    /** @var the ID of the anonymous node (depending on server implementation) */
+    private $anonId;
+
+    function __construct($anonId)
+    {
+        $this->anonId = $anonId;
+    }
+
+
+
+    function __toString()
+    {
+        return "_:"+$this->anonId;
+    }
+
+    /**
+     * @return \the
+     */
+    public function getAnonId()
+    {
+        return $this->anonId;
+    }
+
+
+}

http://git-wip-us.apache.org/repos/asf/incubator-marmotta/blob/c32963d5/lmf-client/lmf-client-php/src/main/php/model/rdf/Literal.php
----------------------------------------------------------------------
diff --git a/lmf-client/lmf-client-php/src/main/php/model/rdf/Literal.php b/lmf-client/lmf-client-php/src/main/php/model/rdf/Literal.php
new file mode 100644
index 0000000..f66b0fa
--- /dev/null
+++ b/lmf-client/lmf-client-php/src/main/php/model/rdf/Literal.php
@@ -0,0 +1,69 @@
+<?php
+/*
+ * Copyright (C) 2013 Salzburg Research.
+ *
+ * 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.
+ */
+namespace LMFClient\Model\RDF;
+
+require_once 'RDFNode.php';
+use LMFClient\Model\RDF\RDFNode;
+
+/**
+ * Represents an RDF Literal in PHP, optionally with language specification and datatype.
+ *
+ * User: sschaffe
+ * Date: 25.01.12
+ * Time: 10:14
+ * To change this template use File | Settings | File Templates.
+ */
+class Literal extends RDFNode
+{
+    /** @var content of the literal */
+    private $content;
+
+    /** @var language of the literal (2-letter ISO code, optional) */
+    private $language;
+
+    /** @var datatype of the literal (URI, optional) */
+    private $datatype;
+
+    function __construct($content, $language = null, $datatype = null)
+    {
+        $this->content = $content;
+        $this->language = $language;
+        $this->datatype = $datatype;
+    }
+
+    public function getContent()
+    {
+        return $this->content;
+    }
+
+    public function getDatatype()
+    {
+        return $this->datatype;
+    }
+
+    public function getLanguage()
+    {
+        return $this->language;
+    }
+
+    function __toString()
+    {
+        return $this->content;
+    }
+
+
+}

http://git-wip-us.apache.org/repos/asf/incubator-marmotta/blob/c32963d5/lmf-client/lmf-client-php/src/main/php/model/rdf/RDFNode.php
----------------------------------------------------------------------
diff --git a/lmf-client/lmf-client-php/src/main/php/model/rdf/RDFNode.php b/lmf-client/lmf-client-php/src/main/php/model/rdf/RDFNode.php
new file mode 100644
index 0000000..c0d5b85
--- /dev/null
+++ b/lmf-client/lmf-client-php/src/main/php/model/rdf/RDFNode.php
@@ -0,0 +1,29 @@
+<?php
+/*
+ * Copyright (C) 2013 Salzburg Research.
+ *
+ * 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.
+ */
+namespace LMFClient\Model\RDF;
+
+/**
+ * Created by IntelliJ IDEA.
+ * User: sschaffe
+ * Date: 25.01.12
+ * Time: 10:12
+ * To change this template use File | Settings | File Templates.
+ */
+class RDFNode
+{
+
+}

http://git-wip-us.apache.org/repos/asf/incubator-marmotta/blob/c32963d5/lmf-client/lmf-client-php/src/main/php/model/rdf/URI.php
----------------------------------------------------------------------
diff --git a/lmf-client/lmf-client-php/src/main/php/model/rdf/URI.php b/lmf-client/lmf-client-php/src/main/php/model/rdf/URI.php
new file mode 100644
index 0000000..286cc55
--- /dev/null
+++ b/lmf-client/lmf-client-php/src/main/php/model/rdf/URI.php
@@ -0,0 +1,53 @@
+<?php
+/*
+ * Copyright (C) 2013 Salzburg Research.
+ *
+ * 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.
+ */
+namespace LMFClient\Model\RDF;
+
+require_once 'RDFNode.php';
+use LMFClient\Model\RDF\RDFNode;
+
+/**
+ * Represents a RDF URI Resource in PHP.
+ *
+ * User: sschaffe
+ * Date: 25.01.12
+ * Time: 10:13
+ * To change this template use File | Settings | File Templates.
+ */
+class URI extends RDFNode
+{
+    /** @var URI of the URI Resource (string) */
+    private $uri;
+
+    function __construct($uri)
+    {
+        $this->uri = $uri;
+    }
+
+
+
+    function __toString()
+    {
+        return $this->uri;
+    }
+
+    public function getUri()
+    {
+        return $this->uri;
+    }
+
+
+}


Mime
View raw message