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

[10/12] MARMOTTA-108: marmotta-client-php

http://git-wip-us.apache.org/repos/asf/incubator-marmotta/blob/34193131/client/lmf-client-php/src/main/php/model/rdf/RDFNode.php
----------------------------------------------------------------------
diff --git a/client/lmf-client-php/src/main/php/model/rdf/RDFNode.php b/client/lmf-client-php/src/main/php/model/rdf/RDFNode.php
deleted file mode 100644
index 01a30fc..0000000
--- a/client/lmf-client-php/src/main/php/model/rdf/RDFNode.php
+++ /dev/null
@@ -1,29 +0,0 @@
-<?php
-/*
- * Copyright (C) 2013 The Apache Software Foundation.
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- *     http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-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/34193131/client/lmf-client-php/src/main/php/model/rdf/URI.php
----------------------------------------------------------------------
diff --git a/client/lmf-client-php/src/main/php/model/rdf/URI.php b/client/lmf-client-php/src/main/php/model/rdf/URI.php
deleted file mode 100644
index ab9807d..0000000
--- a/client/lmf-client-php/src/main/php/model/rdf/URI.php
+++ /dev/null
@@ -1,53 +0,0 @@
-<?php
-/*
- * Copyright (C) 2013 The Apache Software Foundation.
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- *     http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-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;
-    }
-
-
-}

http://git-wip-us.apache.org/repos/asf/incubator-marmotta/blob/34193131/client/lmf-client-php/src/main/php/test_classifier.php
----------------------------------------------------------------------
diff --git a/client/lmf-client-php/src/main/php/test_classifier.php b/client/lmf-client-php/src/main/php/test_classifier.php
deleted file mode 100644
index 3c669a3..0000000
--- a/client/lmf-client-php/src/main/php/test_classifier.php
+++ /dev/null
@@ -1,65 +0,0 @@
-<?php
-/*
- * Copyright (C) 2013 The Apache Software Foundation.
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- *     http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-/**
- * Created by IntelliJ IDEA.
- * User: sschaffe
- * Date: 27.01.12
- * Time: 17:21
- * To change this template use File | Settings | File Templates.
- */
-require_once 'autoload.php';
-
-use LMFClient\ClientConfiguration;
-use LMFClient\Clients\ClassificationClient;
-use LMFClient\Clients\ResourceClient;
-
-$config = new ClientConfiguration("http://localhost:8080/LMF");
-
-$client = new ClassificationClient($config);
-$rclient = new ResourceClient($config);
-
-// create classifier
-$client->removeClassifier("phptest",true);
-$client->createClassifier("phptest");
-
-// add some training data
-$rclient->createResource("http://www.example.com/Concept1");
-$rclient->createResource("http://www.example.com/Concept2");
-
-$data1 = <<<DATA1
-Major acquisitions that have a lower gross margin than the existing network also
-had a negative impact on the overall gross margin, but it should improve following
-the implementation of its integration strategies .
-DATA1;
-
-$data2 = <<<DATA2
-The upward movement of gross margin resulted from amounts pursuant to adjustments
-to obligations towards dealers .
-DATA2;
-
-
-$client->trainClassifier("phptest","http://www.example.com/Concept1", $data1);
-$client->trainClassifier("phptest","http://www.example.com/Concept2", $data2);
-
-$client->retrainClassifier("phptest");
-
-foreach($client->getAllClassifications("phptest","Major acquisitions that have a lower gross margin than the existing network") as $classification) {
-    echo "Concept: " . $classification["concept"] . ", probability " . $classification["probability"] . "\n";
-}
-$client->removeClassifier("phptest",true);
-
-?>

http://git-wip-us.apache.org/repos/asf/incubator-marmotta/blob/34193131/client/lmf-client-php/src/main/php/test_configuration.php
----------------------------------------------------------------------
diff --git a/client/lmf-client-php/src/main/php/test_configuration.php b/client/lmf-client-php/src/main/php/test_configuration.php
deleted file mode 100644
index 0ff02bc..0000000
--- a/client/lmf-client-php/src/main/php/test_configuration.php
+++ /dev/null
@@ -1,50 +0,0 @@
-<?php
-/*
- * Copyright (C) 2013 The Apache Software Foundation.
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- *     http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-/**
- * Created by IntelliJ IDEA.
- * User: sschaffe
- * Date: 25.01.12
- * Time: 15:49
- * To change this template use File | Settings | File Templates.
- */
-require_once 'autoload.php';
-
-use LMFClient\ClientConfiguration;
-use LMFClient\Clients\ConfigurationClient;
-
-$config = new ClientConfiguration("http://localhost:8080/LMF");
-
-$client = new ConfigurationClient($config);
-
-//var_dump($client->listConfigurationKeys());
-
-//var_dump($client->listConfigurations("solr"));
-
-$client->setConfiguration("lmfclient.php.test1","1234");
-$client->setConfiguration("lmfclient.php.test2",array("1234","abc"));
-
-var_dump($client->getConfiguration("lmfclient.php.test1"));
-var_dump($client->getConfiguration("lmfclient.php.test2"));
-
-$client->deleteConfiguration("lmfclient.php.test1");
-$client->deleteConfiguration("lmfclient.php.test2");
-
-
-var_dump($client->getConfiguration("lmfclient.php.test1"));
-var_dump($client->getConfiguration("lmfclient.php.test2"));
-
-?>
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/incubator-marmotta/blob/34193131/client/lmf-client-php/src/main/php/test_cores.php
----------------------------------------------------------------------
diff --git a/client/lmf-client-php/src/main/php/test_cores.php b/client/lmf-client-php/src/main/php/test_cores.php
deleted file mode 100644
index c651460..0000000
--- a/client/lmf-client-php/src/main/php/test_cores.php
+++ /dev/null
@@ -1,63 +0,0 @@
-<?php
-/*
- * Copyright (C) 2013 The Apache Software Foundation.
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- *     http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-/**
- * Created by IntelliJ IDEA.
- * User: sschaffe
- * Date: 27.01.12
- * Time: 16:06
- * To change this template use File | Settings | File Templates.
- */
-
-require_once 'autoload.php';
-
-use LMFClient\ClientConfiguration;
-use LMFClient\Clients\CoresClient;
-
-$config = new ClientConfiguration("http://localhost:8080/LMF");
-
-$client = new CoresClient($config);
-
-// list all available cores
-foreach($client->listCores() as $core) {
-    echo "Found core: $core\n";
-}
-
-// retrieve a core
-echo "Core $core:\n";
-echo $client->getCoreConfiguration($core);
-
-
-// create a core
-$program = "title = rdfs:label :: xsd:string ;";
-$client->createCoreConfiguration("lmfclient",$program);
-
-// give it some time
-sleep(2);
-
-// retrieve the core
-echo "Core lmfclient:\n";
-echo $client->getCoreConfiguration("lmfclient");
-
-// delete the core
-$client->deleteCore("lmfclient");
-
-
-// try to get it again
-//echo "Core lmfclient:\n";
-//echo $client->getCoreConfiguration("lmfclient");
-
-?>
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/incubator-marmotta/blob/34193131/client/lmf-client-php/src/main/php/test_import.php
----------------------------------------------------------------------
diff --git a/client/lmf-client-php/src/main/php/test_import.php b/client/lmf-client-php/src/main/php/test_import.php
deleted file mode 100644
index c8cd8fe..0000000
--- a/client/lmf-client-php/src/main/php/test_import.php
+++ /dev/null
@@ -1,61 +0,0 @@
-<?php
-/*
- * Copyright (C) 2013 The Apache Software Foundation.
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- *     http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-/**
- * Created by IntelliJ IDEA.
- * User: sschaffe
- * Date: 27.01.12
- * Time: 14:13
- * To change this template use File | Settings | File Templates.
- */
-
-require_once 'autoload.php';
-
-use LMFClient\ClientConfiguration;
-use LMFClient\Clients\ImportClient;
-use LMFClient\Clients\ResourceClient;
-
-$config = new ClientConfiguration("http://localhost:8080/LMF");
-
-$client = new ImportClient($config);
-
-// list supported types
-echo "Supported Types: ";
-foreach($client->getSupportedTypes() as $type) {
-    echo $type . ",";
-}
-echo "\n";
-
-
-// import a simple data set
-$data = "<http://example.com/resource/r1> <http://example.com/resource/p1> \"Test Data\".";
-$client->uploadDataset($data,"text/rdf+n3");
-
-
-// wait a bit for import to finish
-sleep(1);
-
-
-$rclient = new ResourceClient($config);
-
-foreach($rclient->getResourceMetadata("http://example.com/resource/r1") as $property => $value) {
-    echo $property . " = " . $value[0] . "\n";
-}
-
-
-
-
-?>
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/incubator-marmotta/blob/34193131/client/lmf-client-php/src/main/php/test_ldpath.php
----------------------------------------------------------------------
diff --git a/client/lmf-client-php/src/main/php/test_ldpath.php b/client/lmf-client-php/src/main/php/test_ldpath.php
deleted file mode 100644
index ccabb72..0000000
--- a/client/lmf-client-php/src/main/php/test_ldpath.php
+++ /dev/null
@@ -1,48 +0,0 @@
-<?php
-/*
- * Copyright (C) 2013 The Apache Software Foundation.
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- *     http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-/**
- * Created by IntelliJ IDEA.
- * User: sschaffe
- * Date: 27.01.12
- * Time: 17:21
- * To change this template use File | Settings | File Templates.
- */
-require_once 'autoload.php';
-
-use LMFClient\ClientConfiguration;
-use LMFClient\Clients\LDPathClient;
-
-$config = new ClientConfiguration("http://localhost:8080/LMF");
-
-$client = new LDPathClient($config);
-
-// list friends of hans meier
-foreach($client->evaluatePath("http://localhost:8080/LMF/resource/hans_meier", "foaf:knows / foaf:name") as $friend) {
-    echo "Friend: $friend\n";
-}
-
-// list profile of hans meier
-foreach($client->evaluateProgram("http://localhost:8080/LMF/resource/hans_meier", "friend = foaf:knows / foaf:name :: xsd:string; name = foaf:name :: xsd:string; interest   = foaf:interest / (rdfs:label[@en] | rdfs:label[@none] | <http://rdf.freebase.com/ns/type.object.name>[@en]) :: xsd:string;") as $field => $values) {
-    echo "$field: ";
-    foreach($values as $value) {
-        echo $value . ",";
-    }
-    echo "\n";
-}
-
-
-?>

http://git-wip-us.apache.org/repos/asf/incubator-marmotta/blob/34193131/client/lmf-client-php/src/main/php/test_private.php
----------------------------------------------------------------------
diff --git a/client/lmf-client-php/src/main/php/test_private.php b/client/lmf-client-php/src/main/php/test_private.php
deleted file mode 100644
index 74c6f27..0000000
--- a/client/lmf-client-php/src/main/php/test_private.php
+++ /dev/null
@@ -1,38 +0,0 @@
-<?php
-/*
- * Copyright (C) 2013 The Apache Software Foundation.
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- *     http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-/**
- * Created by IntelliJ IDEA.
- * User: sschaffe
- * Date: 30.01.12
- * Time: 17:00
- * To change this template use File | Settings | File Templates.
- */
-require_once 'autoload.php';
-
-use LMFClient\ClientConfiguration;
-use LMFClient\Clients\LDPathClient;
-
-$config = new ClientConfiguration("http://localhost:8080/LMF");
-
-$client = new LDPathClient($config);
-
-// list friends of hans meier
-foreach($client->evaluatePath("https://www.youtube.com/profile?user=wastl76", "(<http://gdata.youtube.com/schemas/2007#playlist> | <http://gdata.youtube.com/schemas/2007#favorite> ) / <http://gdata.youtube.com/schemas/2007#video> / <http://www.holygoat.co.uk/owl/redwood/0.1/tags/taggedWithTag> / <http://www.holygoat.co.uk/owl/redwood/0.1/tags/name>") as $field) {
-    echo "Tag: $field\n";
-}
-
-?>
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/incubator-marmotta/blob/34193131/client/lmf-client-php/src/main/php/test_resource.php
----------------------------------------------------------------------
diff --git a/client/lmf-client-php/src/main/php/test_resource.php b/client/lmf-client-php/src/main/php/test_resource.php
deleted file mode 100644
index 6ffce7e..0000000
--- a/client/lmf-client-php/src/main/php/test_resource.php
+++ /dev/null
@@ -1,63 +0,0 @@
-<?php
-/*
- * Copyright (C) 2013 The Apache Software Foundation.
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- *     http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-/**
- * Created by IntelliJ IDEA.
- * User: sschaffe
- * Date: 25.01.12
- * Time: 10:38
- * To change this template use File | Settings | File Templates.
- */
-
-
-require_once 'autoload.php';
-
-use LMFClient\ClientConfiguration;
-use LMFClient\Clients\ResourceClient;
-
-$config = new ClientConfiguration("http://localhost:8080/LMF");
-
-$client = new ResourceClient($config);
-
-/*
-echo $client->getResourceContent("http://localhost:8080/LMF/resource/Chess","application/xhtml+xml")->getData();
-*/
-
-/*
-echo "should be false: " . $client->existsResource("http://brzlbrnft.com/123") . "\n";
-echo "should be true: " . $client->existsResource("http://localhost:8080/LMF/resource/Chess") . "\n";
-*/
-
-
-$client->createResource("http://localhost:8080/LMF/resource/1234");
-
-$metadata = array(
-    "http://xmlns.com/foaf/0.1/name" => array(new \LMFClient\Model\RDF\Literal("Hans Mustermann"))
-);
-
-$client->updateResourceMetadata("http://localhost:8080/LMF/resource/1234",$metadata);
-
-$client->deleteResource("http://localhost:8080/LMF/resource/1234");
-
-
-/*
-$metadata = $client->getResourceMetadata("http://localhost:8080/LMF/resource/hans_meier");
-
-var_dump($metadata);
-
-echo encode_metadata("http://localhost:8080/LMF/resource/hans_meier",$metadata);
-*/
-?>
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/incubator-marmotta/blob/34193131/client/lmf-client-php/src/main/php/test_search.php
----------------------------------------------------------------------
diff --git a/client/lmf-client-php/src/main/php/test_search.php b/client/lmf-client-php/src/main/php/test_search.php
deleted file mode 100644
index 01a485a..0000000
--- a/client/lmf-client-php/src/main/php/test_search.php
+++ /dev/null
@@ -1,38 +0,0 @@
-<?php
-/*
- * Copyright (C) 2013 The Apache Software Foundation.
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- *     http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-/**
- * Created by IntelliJ IDEA.
- * User: sschaffe
- * Date: 27.01.12
- * Time: 15:55
- * To change this template use File | Settings | File Templates.
- */
-
-require_once 'autoload.php';
-
-use LMFClient\ClientConfiguration;
-use LMFClient\Clients\SearchClient;
-
-$config = new ClientConfiguration("http://localhost:8080/LMF");
-
-$client = new SearchClient($config);
-
-foreach($client->simpleSearch("dc","summary:Sepp") as $result) {
-    echo "Result: " . $result->uri . "\n";
-}
-
-?>
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/incubator-marmotta/blob/34193131/client/lmf-client-php/src/main/php/test_sparql.php
----------------------------------------------------------------------
diff --git a/client/lmf-client-php/src/main/php/test_sparql.php b/client/lmf-client-php/src/main/php/test_sparql.php
deleted file mode 100644
index c4f9520..0000000
--- a/client/lmf-client-php/src/main/php/test_sparql.php
+++ /dev/null
@@ -1,44 +0,0 @@
-<?php
-/*
- * Copyright (C) 2013 The Apache Software Foundation.
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- *     http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-/**
- * Created by IntelliJ IDEA.
- * User: sschaffe
- * Date: 27.01.12
- * Time: 10:48
- * To change this template use File | Settings | File Templates.
- */
-require_once 'autoload.php';
-
-use LMFClient\ClientConfiguration;
-use LMFClient\Clients\SPARQLClient;
-
-$config = new ClientConfiguration("http://localhost:8080/LMF");
-
-$client = new SPARQLClient($config);
-
-echo "TEST SPARQL SELECT:\n";
-foreach($client->select("SELECT ?r ?n WHERE { ?r <http://xmlns.com/foaf/0.1/name> ?n }") as $row) {
-    echo $row["r"] . " has name " . $row["n"] . "\n";
-}
-
-
-echo "TEST SPARQL ASK:\n";
-echo "should be true: " . $client->ask("ASK { ?r <http://xmlns.com/foaf/0.1/name> ?n }") . "\n";
-echo "should be false: " . $client->ask("ASK { ?r <http://xmlns.com/foaf/0.1/brzlbrnft> ?n }")  . "\n";
-
-
-?>
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/incubator-marmotta/blob/34193131/client/lmf-client-php/src/main/php/util/rdfjson.php
----------------------------------------------------------------------
diff --git a/client/lmf-client-php/src/main/php/util/rdfjson.php b/client/lmf-client-php/src/main/php/util/rdfjson.php
deleted file mode 100644
index 65e3a65..0000000
--- a/client/lmf-client-php/src/main/php/util/rdfjson.php
+++ /dev/null
@@ -1,132 +0,0 @@
-<?php
-/*
- * Copyright (C) 2013 The Apache Software Foundation.
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- *     http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-/**
- * Created by IntelliJ IDEA.
- * User: sschaffe
- * Date: 25.01.12
- * Time: 11:08
- * To change this template use File | Settings | File Templates.
- */
-
-require_once 'model/rdf/Literal.php';
-require_once 'model/rdf/URI.php';
-require_once 'model/rdf/BNode.php';
-
-use LMFClient\Model\RDF\Literal;
-use LMFClient\Model\RDF\URI;
-use LMFClient\Model\RDF\BNode;
-
-/**
- * Convert an RDF/JSON string into the LMFClient metadata representation. Returns an array of the form
- *
- * array(
- *    "http://xmlns.com/foaf/0.1/name" => array(new Literal("Sepp Huber"))
- * )
- *
- * @param $rdfjson_string
- */
-function decode_metadata($uri,$rdfjson_string) {
-    $result = array();
-
-    $json_array = json_decode($rdfjson_string,true);
-    foreach($json_array as $subject => $properties) {
-        if($uri == $subject) {
-            foreach($properties as $property => $objects) {
-                $result[$property] = array();
-                foreach($objects as $object) {
-                    $result[$property][] = decode_node($object);
-                }
-            }
-        }
-    }
-    return $result;
-}
-
-
-function decode_node($object) {
-    if($object["type"] == "literal") {
-        return new Literal(
-            $object["value"],
-            isset($object["lang"]) ? $object["lang"] : null,
-            isset($object["datatype"]) ? $object["datatype"] : null
-        );
-    } else if($object["type"] == "uri") {
-        return new URI($object["value"]);
-    } else if($object["type"] == "bnode") {
-        return new BNode($object["value"]);
-    } else {
-        return null;
-    }
-}
-
-/**
- * Transform a metadata array into an RDF/JSON representation suitable for sending to the LMF Server.
- *
- * @param $uri
- * @param $metadata_array
- */
-function encode_metadata($uri, $metadata_array) {
-    $result = array();
-    $result[$uri] = array();
-
-    foreach($metadata_array as $property => $values) {
-        $result[$uri][$property] = array();
-        foreach($values as $value) {
-            if($value instanceof \LMFClient\Model\RDF\Literal) {
-                $object = array (
-                    "type"  => "literal",
-                    "value" => $value->getContent()
-                );
-                if(!is_null($value->getLanguage())) {
-                    $object["lang"] = $value->getLanguage();
-                }
-                if(!is_null($value->getDatatype())) {
-                    $object["datatype"] = $value->getDatatype();
-                }
-                $result[$uri][$property][] = $object;
-            } else if($value instanceof \LMFClient\Model\RDF\URI) {
-                $result[$uri][$property][] = array(
-                    "type"  => "uri",
-                    "value" => $value->getUri()
-                );
-            } else if($value instanceof \LMFClient\Model\RDF\BNode) {
-                $result[$uri][$property][] = array(
-                    "type"  => "bnode",
-                    "value" => $value->getAnonId()
-                );
-            } else {
-                // try figuring out whether it is literal or uri based on the string value
-                if(preg_match('|^http(s)?://[a-z0-9-]+(.[a-z0-9-]+)*(:[0-9]+)?(/.*)?$|i', $value)) {
-                    $result[$uri][$property][] = array(
-                        "type"  => "uri",
-                        "value" => $value
-                    );
-                } else {
-                    $object = array (
-                        "type"  => "literal",
-                        "value" => $value
-                    );
-                }
-            }
-        }
-    }
-    return json_encode($result);
-}
-
-
-
-?>
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/incubator-marmotta/blob/34193131/client/marmotta-client-php/pom.xml
----------------------------------------------------------------------
diff --git a/client/marmotta-client-php/pom.xml b/client/marmotta-client-php/pom.xml
new file mode 100644
index 0000000..a9bacd4
--- /dev/null
+++ b/client/marmotta-client-php/pom.xml
@@ -0,0 +1,116 @@
+<?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>org.apache.marmotta</groupId>
+        <artifactId>marmotta-parent</artifactId>
+        <version>3.0.0-incubating-SNAPSHOT</version>
+        <relativePath>../../parent/pom.xml</relativePath>
+    </parent>
+
+    <artifactId>marmotta-client-php</artifactId>
+    <packaging>php</packaging>
+
+    <name>Marmotta Client Library for PHP</name>
+    <description>
+        A PHP Library for accessing a remote Marmotta 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/34193131/client/marmotta-client-php/src/main/php/ClientConfiguration.php
----------------------------------------------------------------------
diff --git a/client/marmotta-client-php/src/main/php/ClientConfiguration.php b/client/marmotta-client-php/src/main/php/ClientConfiguration.php
new file mode 100644
index 0000000..f798005
--- /dev/null
+++ b/client/marmotta-client-php/src/main/php/ClientConfiguration.php
@@ -0,0 +1,80 @@
+<?php
+/*
+ * Copyright (C) 2013 The Apache Software Foundation.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+namespace MarmottaClient;
+
+/**
+ * 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/34193131/client/marmotta-client-php/src/main/php/autoload.php
----------------------------------------------------------------------
diff --git a/client/marmotta-client-php/src/main/php/autoload.php b/client/marmotta-client-php/src/main/php/autoload.php
new file mode 100644
index 0000000..792822a
--- /dev/null
+++ b/client/marmotta-client-php/src/main/php/autoload.php
@@ -0,0 +1,50 @@
+<?php
+/*
+ * Copyright (C) 2013 The Apache Software Foundation.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+/**
+ * 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/MarmottaClientException.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/34193131/client/marmotta-client-php/src/main/php/clients/ConfigurationClient.php
----------------------------------------------------------------------
diff --git a/client/marmotta-client-php/src/main/php/clients/ConfigurationClient.php b/client/marmotta-client-php/src/main/php/clients/ConfigurationClient.php
new file mode 100644
index 0000000..326b431
--- /dev/null
+++ b/client/marmotta-client-php/src/main/php/clients/ConfigurationClient.php
@@ -0,0 +1,183 @@
+<?php
+/*
+ * Copyright (C) 2013 The Apache Software Foundation.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+namespace MarmottaClient\Clients;
+
+require_once 'vendor/.composer/autoload.php';
+
+use \MarmottaClient\ClientConfiguration;
+use \MarmottaClient\Exceptions\MarmottaClientException;
+
+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 Marmotta configuration.
+     * @return array an array containing all configuration keys
+     */
+    public function listConfigurationKeys()  {
+        $client = new Client();
+        $request = $client->get($this->getServiceUrl("/list"),array(
+            "User-Agent"   => "Marmotta 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 Marmotta 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"   => "Marmotta 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"   => "Marmotta 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 MarmottaClientException("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"   => "Marmotta 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 MarmottaClientException("could not update configuration with key $key; ".$ex->getResponse()->getReasonPhrase());
+        }
+    }
+
+    /**
+     * Remove the configuration with the given key.
+     *
+     * @param key
+     * @throws IOException
+     * @throws MarmottaClientException
+     */
+    public function deleteConfiguration($key) {
+        try {
+            $client = new Client();
+            $request = $client->delete($this->getServiceUrl("/data/" . urlencode($key)),array(
+                "User-Agent"   => "Marmotta 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 MarmottaClientException("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/34193131/client/marmotta-client-php/src/main/php/clients/ImportClient.php
----------------------------------------------------------------------
diff --git a/client/marmotta-client-php/src/main/php/clients/ImportClient.php b/client/marmotta-client-php/src/main/php/clients/ImportClient.php
new file mode 100644
index 0000000..bcd6cff
--- /dev/null
+++ b/client/marmotta-client-php/src/main/php/clients/ImportClient.php
@@ -0,0 +1,119 @@
+<?php
+/*
+ * Copyright (C) 2013 The Apache Software Foundation.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+namespace MarmottaClient\Clients;
+
+require_once 'vendor/.composer/autoload.php';
+require_once 'model/content/Content.php';
+require_once 'exceptions/MarmottaClientException.php';
+require_once 'exceptions/NotFoundException.php';
+require_once 'exceptions/ContentFormatException.php';
+
+use \MarmottaClient\Model\Content\Content;
+use \MarmottaClient\ClientConfiguration;
+
+use \MarmottaClient\Exceptions\MarmottaClientException;
+use \MarmottaClient\Exceptions\NotFoundException;
+use \MarmottaClient\Exceptions\ContentFormatException;
+
+use MarmottaClient\Model\RDF\Literal;
+use MarmottaClient\Model\RDF\URI;
+use MarmottaClient\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 Marmotta server.
+     *
+     * @return
+     * @throws IOException
+     * @throws MarmottaClientException
+     */
+    public function getSupportedTypes() {
+        $serviceUrl = $this->config->getBaseUrl() . ImportClient::$URL_TYPES_SERVICE;
+
+        try {
+            $client = new Client();
+            $request = $client->get($serviceUrl,array(
+                "User-Agent"   => "Marmotta 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 MarmottaClientException("error listing supported types; ".$ex->getResponse()->getReasonPhrase());
+        }
+    }
+
+    /**
+     * Upload/Import a dataset in the Marmotta 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 MarmottaClientException
+     */
+    public function uploadDataset($data, $mimeType) {
+        $serviceUrl = $this->config->getBaseUrl() . ImportClient::$URL_UPLOAD_SERVICE;
+
+        try {
+            $client = new Client();
+            $request = $client->post($serviceUrl,array(
+                "User-Agent"   => "Marmotta 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 MarmottaClientException("error uploading dataset; ".$ex->getResponse()->getReasonPhrase());
+        }
+    }
+
+}

http://git-wip-us.apache.org/repos/asf/incubator-marmotta/blob/34193131/client/marmotta-client-php/src/main/php/clients/LDPathClient.php
----------------------------------------------------------------------
diff --git a/client/marmotta-client-php/src/main/php/clients/LDPathClient.php b/client/marmotta-client-php/src/main/php/clients/LDPathClient.php
new file mode 100644
index 0000000..51c08a2
--- /dev/null
+++ b/client/marmotta-client-php/src/main/php/clients/LDPathClient.php
@@ -0,0 +1,139 @@
+<?php
+/*
+ * Copyright (C) 2013 The Apache Software Foundation.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+namespace MarmottaClient\Clients;
+
+require_once 'vendor/.composer/autoload.php';
+require_once 'model/content/Content.php';
+require_once 'exceptions/MarmottaClientException.php';
+require_once 'exceptions/NotFoundException.php';
+require_once 'exceptions/ContentFormatException.php';
+require_once 'util/rdfjson.php';
+
+use \MarmottaClient\Model\Content\Content;
+use \MarmottaClient\ClientConfiguration;
+
+use \MarmottaClient\Exceptions\MarmottaClientException;
+use \MarmottaClient\Exceptions\NotFoundException;
+use \MarmottaClient\Exceptions\ContentFormatException;
+
+use MarmottaClient\Model\RDF\Literal;
+use MarmottaClient\Model\RDF\URI;
+use MarmottaClient\Model\RDF\BNode;
+
+
+use Guzzle\Http\Client;
+use Guzzle\Http\Message\BadResponseException;
+
+/**
+ * Run LDPath queries agains the Marmotta 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"   => "Marmotta 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 MarmottaClientException("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"   => "Marmotta 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 MarmottaClientException("error evaluating LDPath Query $path; ".$ex->getResponse()->getReasonPhrase());
+        }
+    }
+
+}

http://git-wip-us.apache.org/repos/asf/incubator-marmotta/blob/34193131/client/marmotta-client-php/src/main/php/clients/ReasonerClient.php
----------------------------------------------------------------------
diff --git a/client/marmotta-client-php/src/main/php/clients/ReasonerClient.php b/client/marmotta-client-php/src/main/php/clients/ReasonerClient.php
new file mode 100644
index 0000000..adc87fb
--- /dev/null
+++ b/client/marmotta-client-php/src/main/php/clients/ReasonerClient.php
@@ -0,0 +1,127 @@
+<?php
+/*
+ * Copyright (C) 2013 The Apache Software Foundation.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+namespace MarmottaClient\Clients;
+
+require_once 'vendor/.composer/autoload.php';
+require_once 'model/content/Content.php';
+require_once 'exceptions/MarmottaClientException.php';
+require_once 'exceptions/NotFoundException.php';
+require_once 'exceptions/ContentFormatException.php';
+
+use \MarmottaClient\Model\Content\Content;
+use \MarmottaClient\ClientConfiguration;
+
+use \MarmottaClient\Exceptions\MarmottaClientException;
+use \MarmottaClient\Exceptions\NotFoundException;
+use \MarmottaClient\Exceptions\ContentFormatException;
+
+use MarmottaClient\Model\RDF\Literal;
+use MarmottaClient\Model\RDF\URI;
+use MarmottaClient\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 Marmotta 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"   => "Marmotta 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 Marmotta knowledge base and register it with the name given as argument.
+     * The Marmotta 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"   => "Marmotta 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 Marmotta knowledge base.
+     * @param $name
+     */
+    public function deleteProgram($name) {
+        $client = new Client();
+        $request = $client->delete($this->getServiceUrl($name),array(
+            "User-Agent"   => "Marmotta 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/34193131/client/marmotta-client-php/src/main/php/clients/ResourceClient.php
----------------------------------------------------------------------
diff --git a/client/marmotta-client-php/src/main/php/clients/ResourceClient.php b/client/marmotta-client-php/src/main/php/clients/ResourceClient.php
new file mode 100644
index 0000000..24abb5d
--- /dev/null
+++ b/client/marmotta-client-php/src/main/php/clients/ResourceClient.php
@@ -0,0 +1,258 @@
+<?php
+/*
+ * Copyright (C) 2013 The Apache Software Foundation.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+namespace MarmottaClient\Clients;
+
+require_once 'vendor/.composer/autoload.php';
+require_once 'util/rdfjson.php';
+require_once 'model/content/Content.php';
+require_once 'exceptions/MarmottaClientException.php';
+require_once 'exceptions/NotFoundException.php';
+require_once 'exceptions/ContentFormatException.php';
+
+use \MarmottaClient\Model\Content\Content;
+use \MarmottaClient\ClientConfiguration;
+
+use \MarmottaClient\Exceptions\MarmottaClientException;
+use \MarmottaClient\Exceptions\NotFoundException;
+use \MarmottaClient\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 Marmotta installation
+     * @param $uri
+     * @throws Exception
+     */
+    public /* boolean */ function createResource($uri) {
+        $client = new Client();
+        $request = $client->post($this->getServiceUrl($uri),array(
+            "User-Agent"   => "Marmotta 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"   => "Marmotta 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"   => "Marmotta 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 MarmottaClientException("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 MarmottaClient 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"   => "Marmotta 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"   => "Marmotta 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 \MarmottaClient\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 MarmottaClientException("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"   => "Marmotta 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"   => "Marmotta 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/34193131/client/marmotta-client-php/src/main/php/clients/SPARQLClient.php
----------------------------------------------------------------------
diff --git a/client/marmotta-client-php/src/main/php/clients/SPARQLClient.php b/client/marmotta-client-php/src/main/php/clients/SPARQLClient.php
new file mode 100644
index 0000000..6019d00
--- /dev/null
+++ b/client/marmotta-client-php/src/main/php/clients/SPARQLClient.php
@@ -0,0 +1,194 @@
+<?php
+/*
+ * Copyright (C) 2013 The Apache Software Foundation.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+namespace MarmottaClient\Clients;
+
+require_once 'vendor/.composer/autoload.php';
+require_once 'model/content/Content.php';
+require_once 'exceptions/MarmottaClientException.php';
+require_once 'exceptions/NotFoundException.php';
+require_once 'exceptions/ContentFormatException.php';
+
+use \MarmottaClient\Model\Content\Content;
+use \MarmottaClient\ClientConfiguration;
+
+use \MarmottaClient\Exceptions\MarmottaClientException;
+use \MarmottaClient\Exceptions\NotFoundException;
+use \MarmottaClient\Exceptions\ContentFormatException;
+
+use MarmottaClient\Model\RDF\Literal;
+use MarmottaClient\Model\RDF\URI;
+use MarmottaClient\Model\RDF\BNode;
+
+
+use Guzzle\Http\Client;
+use Guzzle\Http\Message\BadResponseException;
+
+/**
+ * A client for running SPARQL 1.1 Queries and Updates on the Marmotta 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 Marmotta 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 MarmottaClientException
+     */
+    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"   => "Marmotta 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 MarmottaClientException("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 MarmottaClientException
+     */
+    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"   => "Marmotta 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 MarmottaClientException("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 MarmottaClientException).
+     *
+     * @param updateQuery         the SPARQL Update 1.1 query string
+     * @throws IOException        in case a connection problem occurs
+     * @throws MarmottaClientException 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"   => "Marmotta 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 MarmottaClientException("error evaluating SPARQL Update Query $updateQuery; ".$ex->getResponse()->getReasonPhrase());
+        }
+    }
+}

http://git-wip-us.apache.org/repos/asf/incubator-marmotta/blob/34193131/client/marmotta-client-php/src/main/php/exceptions/ContentFormatException.php
----------------------------------------------------------------------
diff --git a/client/marmotta-client-php/src/main/php/exceptions/ContentFormatException.php b/client/marmotta-client-php/src/main/php/exceptions/ContentFormatException.php
new file mode 100644
index 0000000..64aca0c
--- /dev/null
+++ b/client/marmotta-client-php/src/main/php/exceptions/ContentFormatException.php
@@ -0,0 +1,33 @@
+<?php
+/*
+ * Copyright (C) 2013 The Apache Software Foundation.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+namespace MarmottaClient\Exceptions;
+
+require_once 'MarmottaClientException.php';
+
+use \MarmottaClient\Exceptions\MarmottaClientException;
+
+/**
+ * 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 MarmottaClientException
+{
+
+}

http://git-wip-us.apache.org/repos/asf/incubator-marmotta/blob/34193131/client/marmotta-client-php/src/main/php/exceptions/LMFClientException.php
----------------------------------------------------------------------
diff --git a/client/marmotta-client-php/src/main/php/exceptions/LMFClientException.php b/client/marmotta-client-php/src/main/php/exceptions/LMFClientException.php
new file mode 100644
index 0000000..a295e0a
--- /dev/null
+++ b/client/marmotta-client-php/src/main/php/exceptions/LMFClientException.php
@@ -0,0 +1,29 @@
+<?php
+/*
+ * Copyright (C) 2013 The Apache Software Foundation.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+namespace MarmottaClient\Exceptions;
+
+/**
+ * Created by IntelliJ IDEA.
+ * User: sschaffe
+ * Date: 27.01.12
+ * Time: 10:04
+ * To change this template use File | Settings | File Templates.
+ */
+class MarmottaClientException extends \Exception
+{
+
+}

http://git-wip-us.apache.org/repos/asf/incubator-marmotta/blob/34193131/client/marmotta-client-php/src/main/php/exceptions/NotFoundException.php
----------------------------------------------------------------------
diff --git a/client/marmotta-client-php/src/main/php/exceptions/NotFoundException.php b/client/marmotta-client-php/src/main/php/exceptions/NotFoundException.php
new file mode 100644
index 0000000..29a5ef2
--- /dev/null
+++ b/client/marmotta-client-php/src/main/php/exceptions/NotFoundException.php
@@ -0,0 +1,33 @@
+<?php
+/*
+ * Copyright (C) 2013 The Apache Software Foundation.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+namespace MarmottaClient\Exceptions;
+
+require_once 'MarmottaClientException.php';
+
+use MarmottaClient\Exceptions\MarmottaClientException;
+
+/**
+ * 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 MarmottaClientException
+{
+
+}

http://git-wip-us.apache.org/repos/asf/incubator-marmotta/blob/34193131/client/marmotta-client-php/src/main/php/model/content/Content.php
----------------------------------------------------------------------
diff --git a/client/marmotta-client-php/src/main/php/model/content/Content.php b/client/marmotta-client-php/src/main/php/model/content/Content.php
new file mode 100644
index 0000000..7a10855
--- /dev/null
+++ b/client/marmotta-client-php/src/main/php/model/content/Content.php
@@ -0,0 +1,70 @@
+<?php
+/*
+ * Copyright (C) 2013 The Apache Software Foundation.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+namespace MarmottaClient\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/34193131/client/marmotta-client-php/src/main/php/model/rdf/BNode.php
----------------------------------------------------------------------
diff --git a/client/marmotta-client-php/src/main/php/model/rdf/BNode.php b/client/marmotta-client-php/src/main/php/model/rdf/BNode.php
new file mode 100644
index 0000000..42836f5
--- /dev/null
+++ b/client/marmotta-client-php/src/main/php/model/rdf/BNode.php
@@ -0,0 +1,56 @@
+<?php
+/*
+ * Copyright (C) 2013 The Apache Software Foundation.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+namespace MarmottaClient\Model\RDF;
+
+require_once 'RDFNode.php';
+use MarmottaClient\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/34193131/client/marmotta-client-php/src/main/php/model/rdf/Literal.php
----------------------------------------------------------------------
diff --git a/client/marmotta-client-php/src/main/php/model/rdf/Literal.php b/client/marmotta-client-php/src/main/php/model/rdf/Literal.php
new file mode 100644
index 0000000..cebec5d
--- /dev/null
+++ b/client/marmotta-client-php/src/main/php/model/rdf/Literal.php
@@ -0,0 +1,69 @@
+<?php
+/*
+ * Copyright (C) 2013 The Apache Software Foundation.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+namespace MarmottaClient\Model\RDF;
+
+require_once 'RDFNode.php';
+use MarmottaClient\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/34193131/client/marmotta-client-php/src/main/php/model/rdf/RDFNode.php
----------------------------------------------------------------------
diff --git a/client/marmotta-client-php/src/main/php/model/rdf/RDFNode.php b/client/marmotta-client-php/src/main/php/model/rdf/RDFNode.php
new file mode 100644
index 0000000..06f6679
--- /dev/null
+++ b/client/marmotta-client-php/src/main/php/model/rdf/RDFNode.php
@@ -0,0 +1,29 @@
+<?php
+/*
+ * Copyright (C) 2013 The Apache Software Foundation.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+namespace MarmottaClient\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
+{
+
+}