You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@marmotta.apache.org by wi...@apache.org on 2013/02/19 13:52:00 UTC

[28/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/

http://git-wip-us.apache.org/repos/asf/incubator-marmotta/blob/c32963d5/ldclient/ldclient-provider-xml/src/main/java/org/apache/marmotta/ldclient/provider/xml/mapping/CommaSeparatedMapper.java
----------------------------------------------------------------------
diff --git a/ldclient/ldclient-provider-xml/src/main/java/org/apache/marmotta/ldclient/provider/xml/mapping/CommaSeparatedMapper.java b/ldclient/ldclient-provider-xml/src/main/java/org/apache/marmotta/ldclient/provider/xml/mapping/CommaSeparatedMapper.java
new file mode 100644
index 0000000..eb66110
--- /dev/null
+++ b/ldclient/ldclient-provider-xml/src/main/java/org/apache/marmotta/ldclient/provider/xml/mapping/CommaSeparatedMapper.java
@@ -0,0 +1,73 @@
+/**
+ * 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.
+ */
+package org.apache.marmotta.ldclient.provider.xml.mapping;
+
+import at.newmedialab.sesame.commons.model.Namespaces;
+import org.openrdf.model.Value;
+import org.openrdf.model.ValueFactory;
+
+import java.util.ArrayList;
+import java.util.List;
+import java.util.Map;
+
+/**
+ * Takes a comma separated list and converts it into a list of literals
+ * <p/>
+ * Author: Sebastian Schaffert
+ */
+public class CommaSeparatedMapper extends XPathLiteralMapper {
+
+    public CommaSeparatedMapper(String xpath) {
+        super(xpath);
+    }
+
+    public CommaSeparatedMapper(String xpath, Map<String, String> namespaces) {
+        super(xpath, namespaces);
+    }
+
+    public CommaSeparatedMapper(String xpath, String datatype) {
+        super(xpath, datatype);
+    }
+
+    public CommaSeparatedMapper(String xpath, Map<String, String> namespaces, String datatype) {
+        super(xpath, namespaces, datatype);
+    }
+
+    /**
+     * Take the selected value, process it according to the mapping definition, and create Sesame Values using the
+     * factory passed as argument.
+     *
+     *
+     * @param resourceUri
+     * @param selectedValue
+     * @param factory
+     * @return
+     */
+    @Override
+    public List<Value> map(String resourceUri, String selectedValue, ValueFactory factory) {
+        String[] values = selectedValue.split(",");
+        List<Value> result = new ArrayList<Value>(values.length);
+        for(String value : values) {
+            if(datatype != null) {
+                result.add(factory.createLiteral(value.trim(), factory.createURI(Namespaces.NS_XSD + datatype)));
+            } else {
+                result.add(factory.createLiteral(value.trim()));
+            }
+        }
+
+        return result;
+    }
+}

http://git-wip-us.apache.org/repos/asf/incubator-marmotta/blob/c32963d5/ldclient/ldclient-provider-xml/src/main/java/org/apache/marmotta/ldclient/provider/xml/mapping/XPathLiteralMapper.java
----------------------------------------------------------------------
diff --git a/ldclient/ldclient-provider-xml/src/main/java/org/apache/marmotta/ldclient/provider/xml/mapping/XPathLiteralMapper.java b/ldclient/ldclient-provider-xml/src/main/java/org/apache/marmotta/ldclient/provider/xml/mapping/XPathLiteralMapper.java
new file mode 100644
index 0000000..3cd5d07
--- /dev/null
+++ b/ldclient/ldclient-provider-xml/src/main/java/org/apache/marmotta/ldclient/provider/xml/mapping/XPathLiteralMapper.java
@@ -0,0 +1,71 @@
+/**
+ * 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.
+ */
+package org.apache.marmotta.ldclient.provider.xml.mapping;
+
+import at.newmedialab.sesame.commons.model.Namespaces;
+import org.openrdf.model.Value;
+import org.openrdf.model.ValueFactory;
+
+import java.util.Collections;
+import java.util.List;
+import java.util.Map;
+
+/**
+ * Add file description here!
+ * <p/>
+ * Author: Sebastian Schaffert
+ */
+public class XPathLiteralMapper extends XPathValueMapper {
+    
+    protected String datatype; // optional datatype to use for literal (string, float, dateTime, ...)
+
+    public XPathLiteralMapper(String xpath) {
+        super(xpath);
+    }
+
+    public XPathLiteralMapper(String xpath, Map<String, String> namespaces) {
+        super(xpath, namespaces);
+    }
+
+    public XPathLiteralMapper(String xpath, String datatype) {
+        super(xpath);
+        this.datatype = datatype;
+    }
+
+    public XPathLiteralMapper(String xpath, Map<String, String> namespaces, String datatype) {
+        super(xpath, namespaces);
+        this.datatype = datatype;
+    }
+
+    /**
+     * Take the selected value, process it according to the mapping definition, and create Sesame Values using the
+     * factory passed as argument.
+     *
+     *
+     * @param resourceUri
+     * @param selectedValue
+     * @param factory
+     * @return
+     */
+    @Override
+    public List<Value> map(String resourceUri, String selectedValue, ValueFactory factory) {
+        if(datatype != null) {
+            return Collections.singletonList((Value)factory.createLiteral(selectedValue.trim(), factory.createURI(Namespaces.NS_XSD + datatype)));
+        } else {
+            return Collections.singletonList((Value)factory.createLiteral(selectedValue.trim()));
+        }
+    }
+}

http://git-wip-us.apache.org/repos/asf/incubator-marmotta/blob/c32963d5/ldclient/ldclient-provider-xml/src/main/java/org/apache/marmotta/ldclient/provider/xml/mapping/XPathURIMapper.java
----------------------------------------------------------------------
diff --git a/ldclient/ldclient-provider-xml/src/main/java/org/apache/marmotta/ldclient/provider/xml/mapping/XPathURIMapper.java b/ldclient/ldclient-provider-xml/src/main/java/org/apache/marmotta/ldclient/provider/xml/mapping/XPathURIMapper.java
new file mode 100644
index 0000000..7f731f3
--- /dev/null
+++ b/ldclient/ldclient-provider-xml/src/main/java/org/apache/marmotta/ldclient/provider/xml/mapping/XPathURIMapper.java
@@ -0,0 +1,54 @@
+/**
+ * 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.
+ */
+package org.apache.marmotta.ldclient.provider.xml.mapping;
+
+import org.openrdf.model.Value;
+import org.openrdf.model.ValueFactory;
+
+import java.util.Collections;
+import java.util.List;
+import java.util.Map;
+
+/**
+ * Add file description here!
+ * <p/>
+ * Author: Sebastian Schaffert
+ */
+public class XPathURIMapper extends XPathValueMapper {
+
+    public XPathURIMapper(String xpath) {
+        super(xpath);
+    }
+
+    public XPathURIMapper(String xpath, Map<String, String> namespaces) {
+        super(xpath, namespaces);
+    }
+
+    /**
+     * Take the selected value, process it according to the mapping definition, and create Sesame Values using the
+     * factory passed as argument.
+     *
+     *
+     * @param resourceUri
+     * @param selectedValue
+     * @param factory
+     * @return
+     */
+    @Override
+    public List<Value> map(String resourceUri, String selectedValue, ValueFactory factory) {
+        return Collections.singletonList((Value)factory.createURI(selectedValue));
+    }
+}

http://git-wip-us.apache.org/repos/asf/incubator-marmotta/blob/c32963d5/ldclient/ldclient-provider-xml/src/main/java/org/apache/marmotta/ldclient/provider/xml/mapping/XPathValueMapper.java
----------------------------------------------------------------------
diff --git a/ldclient/ldclient-provider-xml/src/main/java/org/apache/marmotta/ldclient/provider/xml/mapping/XPathValueMapper.java b/ldclient/ldclient-provider-xml/src/main/java/org/apache/marmotta/ldclient/provider/xml/mapping/XPathValueMapper.java
new file mode 100644
index 0000000..a5c2304
--- /dev/null
+++ b/ldclient/ldclient-provider-xml/src/main/java/org/apache/marmotta/ldclient/provider/xml/mapping/XPathValueMapper.java
@@ -0,0 +1,73 @@
+/**
+ * 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.
+ */
+package org.apache.marmotta.ldclient.provider.xml.mapping;
+
+import org.apache.marmotta.ldclient.api.provider.ValueMapper;
+import org.jdom2.Namespace;
+import org.jdom2.filter.Filters;
+import org.jdom2.xpath.XPathExpression;
+import org.jdom2.xpath.XPathFactory;
+
+import java.util.Collection;
+import java.util.HashSet;
+import java.util.Map;
+import java.util.Set;
+
+/**
+ * Abstract class that manages an XPath expression for mapping.
+ * <p/>
+ * Author: Sebastian Schaffert
+ */
+public abstract class XPathValueMapper implements ValueMapper {
+
+    private String xpath;
+
+    private XPathExpression<Object> compiled;
+
+    protected XPathValueMapper(String xpath) {
+        this(xpath, (Map<String, String>) null);
+    }
+
+    protected XPathValueMapper(String xpath, Map<String,String> namespaces) {
+        this.xpath = xpath;
+
+        Set<Namespace> xnamespaces = new HashSet<Namespace>();
+        if(namespaces != null) {
+            for(Map.Entry<String,String> ns : namespaces.entrySet()) {
+                xnamespaces.add(Namespace.getNamespace(ns.getKey(), ns.getValue()));
+            }
+        }
+        this.compiled = XPathFactory.instance().compile(xpath, Filters.fpassthrough(),null,xnamespaces);
+    }
+
+
+    protected XPathValueMapper(String xpath, Collection<Namespace> namespaces) {
+        this.xpath = xpath;
+        this.compiled = XPathFactory.instance().compile(xpath, Filters.fpassthrough(),null,namespaces);
+    }
+
+    public String getXpath() {
+        return xpath;
+    }
+
+    /**
+     * Return the precompiled XPath expression represented in this value mapper
+     * @return
+     */
+    public XPathExpression<Object> getCompiled() {
+        return compiled;
+    }
+}

http://git-wip-us.apache.org/repos/asf/incubator-marmotta/blob/c32963d5/ldclient/ldclient-provider-youtube/.classpath
----------------------------------------------------------------------
diff --git a/ldclient/ldclient-provider-youtube/.classpath b/ldclient/ldclient-provider-youtube/.classpath
new file mode 100644
index 0000000..bf96ac0
--- /dev/null
+++ b/ldclient/ldclient-provider-youtube/.classpath
@@ -0,0 +1,14 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<classpath>
+	<classpathentry kind="src" output="target/classes" path="src/main/java"/>
+	<classpathentry excluding="**" kind="src" output="target/classes" path="src/main/resources"/>
+	<classpathentry kind="src" output="target/test-classes" path="src/test/java"/>
+	<classpathentry excluding="**" kind="src" output="target/test-classes" path="src/test/resources"/>
+	<classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/JavaSE-1.6"/>
+	<classpathentry kind="con" path="org.eclipse.m2e.MAVEN2_CLASSPATH_CONTAINER">
+		<attributes>
+			<attribute name="org.eclipse.jst.component.nondependency" value=""/>
+		</attributes>
+	</classpathentry>
+	<classpathentry kind="output" path="target/classes"/>
+</classpath>

http://git-wip-us.apache.org/repos/asf/incubator-marmotta/blob/c32963d5/ldclient/ldclient-provider-youtube/.project
----------------------------------------------------------------------
diff --git a/ldclient/ldclient-provider-youtube/.project b/ldclient/ldclient-provider-youtube/.project
new file mode 100644
index 0000000..ef043ee
--- /dev/null
+++ b/ldclient/ldclient-provider-youtube/.project
@@ -0,0 +1,36 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<projectDescription>
+	<name>ldclient-provider-youtube</name>
+	<comment></comment>
+	<projects>
+	</projects>
+	<buildSpec>
+		<buildCommand>
+			<name>org.eclipse.wst.common.project.facet.core.builder</name>
+			<arguments>
+			</arguments>
+		</buildCommand>
+		<buildCommand>
+			<name>org.eclipse.jdt.core.javabuilder</name>
+			<arguments>
+			</arguments>
+		</buildCommand>
+		<buildCommand>
+			<name>org.eclipse.m2e.core.maven2Builder</name>
+			<arguments>
+			</arguments>
+		</buildCommand>
+		<buildCommand>
+			<name>org.eclipse.wst.validation.validationbuilder</name>
+			<arguments>
+			</arguments>
+		</buildCommand>
+	</buildSpec>
+	<natures>
+		<nature>org.eclipse.jem.workbench.JavaEMFNature</nature>
+		<nature>org.eclipse.wst.common.modulecore.ModuleCoreNature</nature>
+		<nature>org.eclipse.jdt.core.javanature</nature>
+		<nature>org.eclipse.m2e.core.maven2Nature</nature>
+		<nature>org.eclipse.wst.common.project.facet.core.nature</nature>
+	</natures>
+</projectDescription>

http://git-wip-us.apache.org/repos/asf/incubator-marmotta/blob/c32963d5/ldclient/ldclient-provider-youtube/.settings/org.eclipse.core.resources.prefs
----------------------------------------------------------------------
diff --git a/ldclient/ldclient-provider-youtube/.settings/org.eclipse.core.resources.prefs b/ldclient/ldclient-provider-youtube/.settings/org.eclipse.core.resources.prefs
new file mode 100644
index 0000000..dc1b414
--- /dev/null
+++ b/ldclient/ldclient-provider-youtube/.settings/org.eclipse.core.resources.prefs
@@ -0,0 +1,5 @@
+eclipse.preferences.version=1
+encoding//src/main/java=UTF-8
+encoding//src/main/resources=UTF-8
+encoding//src/test/java=UTF-8
+encoding//src/test/resources=UTF-8

http://git-wip-us.apache.org/repos/asf/incubator-marmotta/blob/c32963d5/ldclient/ldclient-provider-youtube/.settings/org.eclipse.jdt.core.prefs
----------------------------------------------------------------------
diff --git a/ldclient/ldclient-provider-youtube/.settings/org.eclipse.jdt.core.prefs b/ldclient/ldclient-provider-youtube/.settings/org.eclipse.jdt.core.prefs
new file mode 100644
index 0000000..69c31cd
--- /dev/null
+++ b/ldclient/ldclient-provider-youtube/.settings/org.eclipse.jdt.core.prefs
@@ -0,0 +1,8 @@
+eclipse.preferences.version=1
+org.eclipse.jdt.core.compiler.codegen.inlineJsrBytecode=enabled
+org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.6
+org.eclipse.jdt.core.compiler.compliance=1.6
+org.eclipse.jdt.core.compiler.problem.assertIdentifier=error
+org.eclipse.jdt.core.compiler.problem.enumIdentifier=error
+org.eclipse.jdt.core.compiler.problem.forbiddenReference=warning
+org.eclipse.jdt.core.compiler.source=1.6

http://git-wip-us.apache.org/repos/asf/incubator-marmotta/blob/c32963d5/ldclient/ldclient-provider-youtube/.settings/org.eclipse.m2e.core.prefs
----------------------------------------------------------------------
diff --git a/ldclient/ldclient-provider-youtube/.settings/org.eclipse.m2e.core.prefs b/ldclient/ldclient-provider-youtube/.settings/org.eclipse.m2e.core.prefs
new file mode 100644
index 0000000..f897a7f
--- /dev/null
+++ b/ldclient/ldclient-provider-youtube/.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/ldclient/ldclient-provider-youtube/.settings/org.eclipse.wst.common.component
----------------------------------------------------------------------
diff --git a/ldclient/ldclient-provider-youtube/.settings/org.eclipse.wst.common.component b/ldclient/ldclient-provider-youtube/.settings/org.eclipse.wst.common.component
new file mode 100644
index 0000000..78a4000
--- /dev/null
+++ b/ldclient/ldclient-provider-youtube/.settings/org.eclipse.wst.common.component
@@ -0,0 +1,7 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<project-modules id="moduleCoreId" project-version="1.5.0">
+    <wb-module deploy-name="ldclient-provider-youtube">
+        <wb-resource deploy-path="/" source-path="/src/main/java"/>
+        <wb-resource deploy-path="/" source-path="/src/main/resources"/>
+    </wb-module>
+</project-modules>

http://git-wip-us.apache.org/repos/asf/incubator-marmotta/blob/c32963d5/ldclient/ldclient-provider-youtube/.settings/org.eclipse.wst.common.project.facet.core.xml
----------------------------------------------------------------------
diff --git a/ldclient/ldclient-provider-youtube/.settings/org.eclipse.wst.common.project.facet.core.xml b/ldclient/ldclient-provider-youtube/.settings/org.eclipse.wst.common.project.facet.core.xml
new file mode 100644
index 0000000..c78d932
--- /dev/null
+++ b/ldclient/ldclient-provider-youtube/.settings/org.eclipse.wst.common.project.facet.core.xml
@@ -0,0 +1,5 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<faceted-project>
+  <installed facet="java" version="1.6"/>
+  <installed facet="jst.utility" version="1.0"/>
+</faceted-project>

http://git-wip-us.apache.org/repos/asf/incubator-marmotta/blob/c32963d5/ldclient/ldclient-provider-youtube/pom.xml
----------------------------------------------------------------------
diff --git a/ldclient/ldclient-provider-youtube/pom.xml b/ldclient/ldclient-provider-youtube/pom.xml
new file mode 100644
index 0000000..b95ad90
--- /dev/null
+++ b/ldclient/ldclient-provider-youtube/pom.xml
@@ -0,0 +1,88 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+  ~ 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.
+  -->
+
+<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>ldclient-parent</artifactId>
+        <version>3.0.0-SNAPSHOT</version>
+    </parent>
+
+    <artifactId>ldclient-provider-youtube</artifactId>
+    <name>LDClient Provider: YouTube Resources</name>
+
+    <description>
+        This package enables the Linked Data Client to access the metadata of YouTube Videos as if they were published
+        as Linked Data (RDF) by mapping the YouTube API to the Ontology for Media Resources.
+    </description>
+
+    <dependencies>
+        <dependency>
+            <groupId>at.newmedialab.lmf</groupId>
+            <artifactId>ldclient-api</artifactId>
+        </dependency>
+        <dependency>
+            <groupId>at.newmedialab.lmf</groupId>
+            <artifactId>ldclient-core</artifactId>
+        </dependency>
+        <dependency>
+            <groupId>at.newmedialab.lmf</groupId>
+            <artifactId>ldclient-provider-xml</artifactId>
+        </dependency>
+
+        <dependency>
+            <groupId>jaxen</groupId>
+            <artifactId>jaxen</artifactId>
+        </dependency>
+        <dependency>
+            <groupId>at.newmedialab.sesame</groupId>
+            <artifactId>sesame-commons</artifactId>
+        </dependency>
+
+
+        <dependency>
+            <groupId>junit</groupId>
+            <artifactId>junit</artifactId>
+            <scope>test</scope>
+        </dependency>
+        <dependency>
+        	<groupId>at.newmedialab.lmf</groupId>
+        	<artifactId>ldclient-core</artifactId>
+        	<type>test-jar</type>
+        	<scope>test</scope>
+        </dependency>
+        <dependency>
+            <groupId>commons-io</groupId>
+            <artifactId>commons-io</artifactId>
+            <scope>test</scope>
+        </dependency>
+        <dependency>
+            <groupId>org.openrdf.sesame</groupId>
+            <artifactId>sesame-queryparser-sparql</artifactId>
+            <scope>test</scope>
+        </dependency>
+        <dependency>
+            <groupId>org.openrdf.sesame</groupId>
+            <artifactId>sesame-rio-turtle</artifactId>
+            <scope>test</scope>
+        </dependency>
+
+    </dependencies>
+
+</project>
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/incubator-marmotta/blob/c32963d5/ldclient/ldclient-provider-youtube/src/main/java/org/apache/marmotta/ldclient/endpoint/youtube/YoutubeChannelEndpointGData.java
----------------------------------------------------------------------
diff --git a/ldclient/ldclient-provider-youtube/src/main/java/org/apache/marmotta/ldclient/endpoint/youtube/YoutubeChannelEndpointGData.java b/ldclient/ldclient-provider-youtube/src/main/java/org/apache/marmotta/ldclient/endpoint/youtube/YoutubeChannelEndpointGData.java
new file mode 100644
index 0000000..4bccfcb
--- /dev/null
+++ b/ldclient/ldclient-provider-youtube/src/main/java/org/apache/marmotta/ldclient/endpoint/youtube/YoutubeChannelEndpointGData.java
@@ -0,0 +1,33 @@
+/**
+ * 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.
+ */
+package org.apache.marmotta.ldclient.endpoint.youtube;
+
+import org.apache.marmotta.commons.http.ContentType;
+import org.apache.marmotta.ldclient.api.endpoint.Endpoint;
+
+/**
+ * Register the Youtube Channel Provider for all links to all user GData channels in YouTube
+ * <p/>
+ * Author: Sebastian Schaffert
+ */
+public class YoutubeChannelEndpointGData extends Endpoint {
+
+    public YoutubeChannelEndpointGData() {
+        super("YouTube Channel (GData)", "YouTube Channel", "^http://gdata\\.youtube\\.com/feeds/api/users/.*/uploads", null, 86400L);
+        setPriority(PRIORITY_HIGH);
+        addContentType(new ContentType("application","atom+xml"));
+    }
+}

http://git-wip-us.apache.org/repos/asf/incubator-marmotta/blob/c32963d5/ldclient/ldclient-provider-youtube/src/main/java/org/apache/marmotta/ldclient/endpoint/youtube/YoutubeChannelEndpointWeb.java
----------------------------------------------------------------------
diff --git a/ldclient/ldclient-provider-youtube/src/main/java/org/apache/marmotta/ldclient/endpoint/youtube/YoutubeChannelEndpointWeb.java b/ldclient/ldclient-provider-youtube/src/main/java/org/apache/marmotta/ldclient/endpoint/youtube/YoutubeChannelEndpointWeb.java
new file mode 100644
index 0000000..cbe119d
--- /dev/null
+++ b/ldclient/ldclient-provider-youtube/src/main/java/org/apache/marmotta/ldclient/endpoint/youtube/YoutubeChannelEndpointWeb.java
@@ -0,0 +1,34 @@
+/**
+ * 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.
+ */
+package org.apache.marmotta.ldclient.endpoint.youtube;
+
+import org.apache.marmotta.commons.http.ContentType;
+import org.apache.marmotta.ldclient.api.endpoint.Endpoint;
+
+/**
+ * Register the Youtube Channel Provider for all links to all user web pages in YouTube; requests will be
+ * rewritten to the GData endpoint
+ * <p/>
+ * Author: Sebastian Schaffert
+ */
+public class YoutubeChannelEndpointWeb extends Endpoint {
+
+    public YoutubeChannelEndpointWeb() {
+        super("YouTube Channel (Web)", "YouTube Channel", "^http://www.youtube.com/user/\\.*", null, 86400L);
+        setPriority(PRIORITY_HIGH);
+        addContentType(new ContentType("application","atom+xml"));
+    }
+}

http://git-wip-us.apache.org/repos/asf/incubator-marmotta/blob/c32963d5/ldclient/ldclient-provider-youtube/src/main/java/org/apache/marmotta/ldclient/endpoint/youtube/YoutubePlaylistEndpointGData.java
----------------------------------------------------------------------
diff --git a/ldclient/ldclient-provider-youtube/src/main/java/org/apache/marmotta/ldclient/endpoint/youtube/YoutubePlaylistEndpointGData.java b/ldclient/ldclient-provider-youtube/src/main/java/org/apache/marmotta/ldclient/endpoint/youtube/YoutubePlaylistEndpointGData.java
new file mode 100644
index 0000000..62a1435
--- /dev/null
+++ b/ldclient/ldclient-provider-youtube/src/main/java/org/apache/marmotta/ldclient/endpoint/youtube/YoutubePlaylistEndpointGData.java
@@ -0,0 +1,33 @@
+/**
+ * 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.
+ */
+package org.apache.marmotta.ldclient.endpoint.youtube;
+
+import org.apache.marmotta.commons.http.ContentType;
+import org.apache.marmotta.ldclient.api.endpoint.Endpoint;
+
+/**
+ * Register the Youtube Channel Provider for all links to all user GData channels in YouTube
+ * <p/>
+ * Author: Sebastian Schaffert
+ */
+public class YoutubePlaylistEndpointGData extends Endpoint {
+
+    public YoutubePlaylistEndpointGData() {
+        super("YouTube Playlist (GData)", "YouTube Playlist", "^http://gdata\\.youtube\\.com/feeds/api/playlists/.*", null, 86400L);
+        setPriority(PRIORITY_HIGH);
+        addContentType(new ContentType("application","atom+xml"));
+    }
+}

http://git-wip-us.apache.org/repos/asf/incubator-marmotta/blob/c32963d5/ldclient/ldclient-provider-youtube/src/main/java/org/apache/marmotta/ldclient/endpoint/youtube/YoutubePlaylistEndpointWeb.java
----------------------------------------------------------------------
diff --git a/ldclient/ldclient-provider-youtube/src/main/java/org/apache/marmotta/ldclient/endpoint/youtube/YoutubePlaylistEndpointWeb.java b/ldclient/ldclient-provider-youtube/src/main/java/org/apache/marmotta/ldclient/endpoint/youtube/YoutubePlaylistEndpointWeb.java
new file mode 100644
index 0000000..7f73b84
--- /dev/null
+++ b/ldclient/ldclient-provider-youtube/src/main/java/org/apache/marmotta/ldclient/endpoint/youtube/YoutubePlaylistEndpointWeb.java
@@ -0,0 +1,33 @@
+/**
+ * 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.
+ */
+package org.apache.marmotta.ldclient.endpoint.youtube;
+
+import org.apache.marmotta.commons.http.ContentType;
+import org.apache.marmotta.ldclient.api.endpoint.Endpoint;
+
+/**
+ * Register the Youtube Channel Provider for all links to all user GData channels in YouTube
+ * <p/>
+ * Author: Sebastian Schaffert
+ */
+public class YoutubePlaylistEndpointWeb extends Endpoint {
+
+    public YoutubePlaylistEndpointWeb() {
+        super("YouTube Playlist (Web)", "YouTube Playlist", "^http://www\\.youtube\\.com/p/.*", null, 86400L);
+        setPriority(PRIORITY_HIGH);
+        addContentType(new ContentType("application","atom+xml"));
+    }
+}

http://git-wip-us.apache.org/repos/asf/incubator-marmotta/blob/c32963d5/ldclient/ldclient-provider-youtube/src/main/java/org/apache/marmotta/ldclient/endpoint/youtube/YoutubePlaylistEndpointWebLong.java
----------------------------------------------------------------------
diff --git a/ldclient/ldclient-provider-youtube/src/main/java/org/apache/marmotta/ldclient/endpoint/youtube/YoutubePlaylistEndpointWebLong.java b/ldclient/ldclient-provider-youtube/src/main/java/org/apache/marmotta/ldclient/endpoint/youtube/YoutubePlaylistEndpointWebLong.java
new file mode 100644
index 0000000..5ed0eb6
--- /dev/null
+++ b/ldclient/ldclient-provider-youtube/src/main/java/org/apache/marmotta/ldclient/endpoint/youtube/YoutubePlaylistEndpointWebLong.java
@@ -0,0 +1,33 @@
+/**
+ * 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.
+ */
+package org.apache.marmotta.ldclient.endpoint.youtube;
+
+import org.apache.marmotta.commons.http.ContentType;
+import org.apache.marmotta.ldclient.api.endpoint.Endpoint;
+
+/**
+ * Register the Youtube Channel Provider for all links to all user GData channels in YouTube
+ * <p/>
+ * Author: Sebastian Schaffert
+ */
+public class YoutubePlaylistEndpointWebLong extends Endpoint {
+
+    public YoutubePlaylistEndpointWebLong() {
+        super("YouTube Playlist (Web, long URI)", "YouTube Playlist", "^http://www\\.youtube\\.com/playlist.*", null, 86400L);
+        setPriority(PRIORITY_HIGH);
+        addContentType(new ContentType("application","atom+xml"));
+    }
+}

http://git-wip-us.apache.org/repos/asf/incubator-marmotta/blob/c32963d5/ldclient/ldclient-provider-youtube/src/main/java/org/apache/marmotta/ldclient/endpoint/youtube/YoutubeVideoEndpoint.java
----------------------------------------------------------------------
diff --git a/ldclient/ldclient-provider-youtube/src/main/java/org/apache/marmotta/ldclient/endpoint/youtube/YoutubeVideoEndpoint.java b/ldclient/ldclient-provider-youtube/src/main/java/org/apache/marmotta/ldclient/endpoint/youtube/YoutubeVideoEndpoint.java
new file mode 100644
index 0000000..6e0474c
--- /dev/null
+++ b/ldclient/ldclient-provider-youtube/src/main/java/org/apache/marmotta/ldclient/endpoint/youtube/YoutubeVideoEndpoint.java
@@ -0,0 +1,33 @@
+/**
+ * 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.
+ */
+package org.apache.marmotta.ldclient.endpoint.youtube;
+
+import org.apache.marmotta.commons.http.ContentType;
+import org.apache.marmotta.ldclient.api.endpoint.Endpoint;
+
+/**
+ * Register the Youtube Channel Provider for all links to all user GData channels in YouTube
+ * <p/>
+ * Author: Sebastian Schaffert
+ */
+public class YoutubeVideoEndpoint extends Endpoint {
+
+    public YoutubeVideoEndpoint() {
+        super("YouTube Video", "YouTube Video", "^http://youtu\\.be/.*", null, 86400L);
+        setPriority(PRIORITY_HIGH);
+        addContentType(new ContentType("application","atom+xml"));
+    }
+}

http://git-wip-us.apache.org/repos/asf/incubator-marmotta/blob/c32963d5/ldclient/ldclient-provider-youtube/src/main/java/org/apache/marmotta/ldclient/endpoint/youtube/YoutubeVideoPageEndpointGData.java
----------------------------------------------------------------------
diff --git a/ldclient/ldclient-provider-youtube/src/main/java/org/apache/marmotta/ldclient/endpoint/youtube/YoutubeVideoPageEndpointGData.java b/ldclient/ldclient-provider-youtube/src/main/java/org/apache/marmotta/ldclient/endpoint/youtube/YoutubeVideoPageEndpointGData.java
new file mode 100644
index 0000000..67da2ef
--- /dev/null
+++ b/ldclient/ldclient-provider-youtube/src/main/java/org/apache/marmotta/ldclient/endpoint/youtube/YoutubeVideoPageEndpointGData.java
@@ -0,0 +1,33 @@
+/**
+ * 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.
+ */
+package org.apache.marmotta.ldclient.endpoint.youtube;
+
+import org.apache.marmotta.commons.http.ContentType;
+import org.apache.marmotta.ldclient.api.endpoint.Endpoint;
+
+/**
+ * Register the Youtube Channel Provider for all links to all user GData channels in YouTube
+ * <p/>
+ * Author: Sebastian Schaffert
+ */
+public class YoutubeVideoPageEndpointGData extends Endpoint {
+
+    public YoutubeVideoPageEndpointGData() {
+        super("YouTube Page (GData)", "YouTube Page", "^http://gdata\\.youtube\\.com/feeds/api/videos/.*", null, 86400L);
+        setPriority(PRIORITY_HIGH);
+        addContentType(new ContentType("text","html"));
+    }
+}

http://git-wip-us.apache.org/repos/asf/incubator-marmotta/blob/c32963d5/ldclient/ldclient-provider-youtube/src/main/java/org/apache/marmotta/ldclient/endpoint/youtube/YoutubeVideoPageEndpointWatch.java
----------------------------------------------------------------------
diff --git a/ldclient/ldclient-provider-youtube/src/main/java/org/apache/marmotta/ldclient/endpoint/youtube/YoutubeVideoPageEndpointWatch.java b/ldclient/ldclient-provider-youtube/src/main/java/org/apache/marmotta/ldclient/endpoint/youtube/YoutubeVideoPageEndpointWatch.java
new file mode 100644
index 0000000..1f6a707
--- /dev/null
+++ b/ldclient/ldclient-provider-youtube/src/main/java/org/apache/marmotta/ldclient/endpoint/youtube/YoutubeVideoPageEndpointWatch.java
@@ -0,0 +1,33 @@
+/**
+ * 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.
+ */
+package org.apache.marmotta.ldclient.endpoint.youtube;
+
+import org.apache.marmotta.commons.http.ContentType;
+import org.apache.marmotta.ldclient.api.endpoint.Endpoint;
+
+/**
+ * Register the Youtube Channel Provider for all links to all user GData channels in YouTube
+ * <p/>
+ * Author: Sebastian Schaffert
+ */
+public class YoutubeVideoPageEndpointWatch extends Endpoint {
+
+    public YoutubeVideoPageEndpointWatch() {
+        super("YouTube Page (Watch)", "YouTube Page", "^http://www\\.youtube\\.com/watch.*", null, 86400L);
+        setPriority(PRIORITY_HIGH);
+        addContentType(new ContentType("text","html"));
+    }
+}

http://git-wip-us.apache.org/repos/asf/incubator-marmotta/blob/c32963d5/ldclient/ldclient-provider-youtube/src/main/java/org/apache/marmotta/ldclient/endpoint/youtube/YoutubeVideoPageEndpointWeb.java
----------------------------------------------------------------------
diff --git a/ldclient/ldclient-provider-youtube/src/main/java/org/apache/marmotta/ldclient/endpoint/youtube/YoutubeVideoPageEndpointWeb.java b/ldclient/ldclient-provider-youtube/src/main/java/org/apache/marmotta/ldclient/endpoint/youtube/YoutubeVideoPageEndpointWeb.java
new file mode 100644
index 0000000..a02af60
--- /dev/null
+++ b/ldclient/ldclient-provider-youtube/src/main/java/org/apache/marmotta/ldclient/endpoint/youtube/YoutubeVideoPageEndpointWeb.java
@@ -0,0 +1,33 @@
+/**
+ * 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.
+ */
+package org.apache.marmotta.ldclient.endpoint.youtube;
+
+import org.apache.marmotta.commons.http.ContentType;
+import org.apache.marmotta.ldclient.api.endpoint.Endpoint;
+
+/**
+ * Register the Youtube Channel Provider for all links to all user GData channels in YouTube
+ * <p/>
+ * Author: Sebastian Schaffert
+ */
+public class YoutubeVideoPageEndpointWeb extends Endpoint {
+
+    public YoutubeVideoPageEndpointWeb() {
+        super("YouTube Page (Web)", "YouTube Page", "^http://www\\.youtube\\.com/v/.*", null, 86400L);
+        setPriority(PRIORITY_HIGH);
+        addContentType(new ContentType("text","html"));
+    }
+}

http://git-wip-us.apache.org/repos/asf/incubator-marmotta/blob/c32963d5/ldclient/ldclient-provider-youtube/src/main/java/org/apache/marmotta/ldclient/provider/youtube/YoutubeChannelProvider.java
----------------------------------------------------------------------
diff --git a/ldclient/ldclient-provider-youtube/src/main/java/org/apache/marmotta/ldclient/provider/youtube/YoutubeChannelProvider.java b/ldclient/ldclient-provider-youtube/src/main/java/org/apache/marmotta/ldclient/provider/youtube/YoutubeChannelProvider.java
new file mode 100644
index 0000000..584358e
--- /dev/null
+++ b/ldclient/ldclient-provider-youtube/src/main/java/org/apache/marmotta/ldclient/provider/youtube/YoutubeChannelProvider.java
@@ -0,0 +1,163 @@
+/**
+ * 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.
+ */
+package org.apache.marmotta.ldclient.provider.youtube;
+
+import at.newmedialab.sesame.commons.model.Namespaces;
+import com.google.common.collect.ImmutableList;
+import org.apache.marmotta.ldclient.api.endpoint.Endpoint;
+import org.apache.marmotta.ldclient.api.provider.DataProvider;
+import org.apache.marmotta.ldclient.provider.xml.AbstractXMLDataProvider;
+import org.apache.marmotta.ldclient.provider.xml.mapping.XPathLiteralMapper;
+import org.apache.marmotta.ldclient.provider.xml.mapping.XPathURIMapper;
+import org.apache.marmotta.ldclient.provider.xml.mapping.XPathValueMapper;
+import org.apache.marmotta.ldclient.provider.youtube.mapping.YoutubeUriMapper;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
+import java.net.URI;
+import java.net.URISyntaxException;
+import java.util.Collections;
+import java.util.HashMap;
+import java.util.List;
+import java.util.Map;
+
+/**
+ * Support YouTube user channels as data source; they are mapped to collections in the Media Ontology
+ * <p/>
+ * Author: Sebastian Schaffert
+ */
+public class YoutubeChannelProvider extends AbstractXMLDataProvider implements DataProvider {
+
+    private static final String NS_MEDIA = "http://www.w3.org/ns/ma-ont#";
+
+    private static Map<String,String> youtubeNamespaces = new HashMap<String, String>();
+    static {
+        youtubeNamespaces.put("atom","http://www.w3.org/2005/Atom" );
+        youtubeNamespaces.put("media","http://search.yahoo.com/mrss/");
+        youtubeNamespaces.put("yt","http://gdata.youtube.com/schemas/2007");
+        youtubeNamespaces.put("gd","http://schemas.google.com/g/2005");
+        youtubeNamespaces.put("georss","http://www.georss.org/georss");
+        youtubeNamespaces.put("gml","http://www.opengis.net/gml");
+    }
+
+
+    private static Map<String,XPathValueMapper> mediaOntMappings = new HashMap<String, XPathValueMapper>();
+    static {
+        mediaOntMappings.put("http://www.w3.org/ns/ma-ont#collectionName",new XPathLiteralMapper("/atom:feed/atom:title", youtubeNamespaces));
+        mediaOntMappings.put("http://www.w3.org/ns/ma-ont#hasMember",     new YoutubeUriMapper("/atom:feed/atom:entry/atom:id", youtubeNamespaces));
+        mediaOntMappings.put("http://www.w3.org/ns/ma-ont#hasCreator",    new XPathURIMapper("/atom:feed/atom:author/@uri", youtubeNamespaces));               // URI
+        mediaOntMappings.put("http://www.w3.org/ns/ma-ont#hasPublisher",  new XPathURIMapper("/atom:feed/atom:author/@uri", youtubeNamespaces));               // URI
+    }
+
+
+
+    private static Logger log = LoggerFactory.getLogger(YoutubeChannelProvider.class);
+
+
+
+
+    /**
+     * Return the name of this data provider. To be used e.g. in the configuration and in log messages.
+     *
+     * @return
+     */
+    @Override
+    public String getName() {
+        return "YouTube Channel";
+    }
+
+    /**
+     * Return the list of mime types accepted by this data provider.
+     *
+     * @return
+     */
+    @Override
+    public String[] listMimeTypes() {
+        return new String[] {
+                "application/atom+xml"
+        };
+    }
+
+    /**
+     * Build the URL to use to call the webservice in order to retrieve the data for the resource passed as argument.
+     * In many cases, this will just return the URI of the resource (e.g. Linked Data), but there might be data providers
+     * that use different means for accessing the data for a resource, e.g. SPARQL or a Cache.
+     *
+     *
+     * @param resource
+     * @param endpoint endpoint configuration for the data provider (optional)
+     * @return
+     */
+    @Override
+    public List<String> buildRequestUrl(String resource, Endpoint endpoint) {
+        if(resource.startsWith("http://www.youtube.com/user/")) {
+            // YouTube playlist URI, request the GData URI instead
+            try {
+                URI uri = new URI(resource);
+                String[] p_components = uri.getPath().split("/");
+                String user_id = p_components[p_components.length-1];
+
+                return Collections.singletonList("http://gdata.youtube.com/feeds/api/users/" + user_id + "/uploads");
+
+            } catch (URISyntaxException e) {
+                throw new RuntimeException("URI '"+resource+"'could not be parsed, it is not a valid URI");
+            }
+        } else if(resource.startsWith("http://gdata.youtube.com/feeds/api/users/")) {
+            if(!resource.endsWith("/uploads"))
+                return Collections.singletonList(resource+"/uploads");
+            else
+                return Collections.singletonList(resource);
+        } else
+            throw new RuntimeException("URI '"+resource+"' not supported by this data provider");
+    }
+
+
+
+    /**
+     * Return a mapping table mapping from RDF properties to XPath Value Mappers. Each entry in the map is evaluated
+     * in turn; in case the XPath expression yields a result, the property is added for the processed resource.
+     *
+     * @return
+     * @param requestUrl
+     */
+    @Override
+    protected Map<String, XPathValueMapper> getXPathMappings(String requestUrl) {
+        return mediaOntMappings;
+    }
+
+    /**
+     * Return a list of URIs that should be added as types for each processed resource.
+     *
+     * @return
+     * @param resource
+     */
+    @Override
+    protected List<String> getTypes(org.openrdf.model.URI resource) {
+        return ImmutableList.of(NS_MEDIA + "Collection", Namespaces.NS_LMF_TYPES + "YoutubePlaylist");
+    }
+
+
+    /**
+     * Provide namespace mappings for the XPath expressions from namespace prefix to namespace URI. May be overridden
+     * by subclasses as appropriate, the default implementation returns an empty map.
+     *
+     * @return
+     */
+    @Override
+    protected Map<String, String> getNamespaceMappings() {
+        return youtubeNamespaces;
+    }
+}

http://git-wip-us.apache.org/repos/asf/incubator-marmotta/blob/c32963d5/ldclient/ldclient-provider-youtube/src/main/java/org/apache/marmotta/ldclient/provider/youtube/YoutubePlaylistProvider.java
----------------------------------------------------------------------
diff --git a/ldclient/ldclient-provider-youtube/src/main/java/org/apache/marmotta/ldclient/provider/youtube/YoutubePlaylistProvider.java b/ldclient/ldclient-provider-youtube/src/main/java/org/apache/marmotta/ldclient/provider/youtube/YoutubePlaylistProvider.java
new file mode 100644
index 0000000..cca6442
--- /dev/null
+++ b/ldclient/ldclient-provider-youtube/src/main/java/org/apache/marmotta/ldclient/provider/youtube/YoutubePlaylistProvider.java
@@ -0,0 +1,181 @@
+/**
+ * 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.
+ */
+package org.apache.marmotta.ldclient.provider.youtube;
+
+import at.newmedialab.sesame.commons.model.Namespaces;
+import com.google.common.collect.ImmutableList;
+import org.apache.http.NameValuePair;
+import org.apache.http.client.utils.URLEncodedUtils;
+import org.apache.marmotta.ldclient.api.endpoint.Endpoint;
+import org.apache.marmotta.ldclient.api.provider.DataProvider;
+import org.apache.marmotta.ldclient.provider.xml.AbstractXMLDataProvider;
+import org.apache.marmotta.ldclient.provider.xml.mapping.XPathLiteralMapper;
+import org.apache.marmotta.ldclient.provider.xml.mapping.XPathURIMapper;
+import org.apache.marmotta.ldclient.provider.xml.mapping.XPathValueMapper;
+import org.apache.marmotta.ldclient.provider.youtube.mapping.YoutubeUriMapper;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
+import java.net.URI;
+import java.net.URISyntaxException;
+import java.util.Collections;
+import java.util.HashMap;
+import java.util.List;
+import java.util.Map;
+
+/**
+ * Support YouTube Playlists as data source; they are mapped to collections in the Media Ontology
+ * <p/>
+ * Author: Sebastian Schaffert
+ */
+public class YoutubePlaylistProvider extends AbstractXMLDataProvider implements DataProvider {
+
+    private static final String NS_MEDIA = "http://www.w3.org/ns/ma-ont#";
+
+    private static Map<String,String> youtubeNamespaces = new HashMap<String, String>();
+    static {
+        youtubeNamespaces.put("atom","http://www.w3.org/2005/Atom" );
+        youtubeNamespaces.put("media","http://search.yahoo.com/mrss/");
+        youtubeNamespaces.put("yt","http://gdata.youtube.com/schemas/2007");
+        youtubeNamespaces.put("gd","http://schemas.google.com/g/2005");
+        youtubeNamespaces.put("georss","http://www.georss.org/georss");
+        youtubeNamespaces.put("gml","http://www.opengis.net/gml");
+    }
+
+
+    private static Map<String,XPathValueMapper> mediaOntMappings = new HashMap<String, XPathValueMapper>();
+    static {
+        mediaOntMappings.put("http://www.w3.org/ns/ma-ont#collectionName",new XPathLiteralMapper("/atom:feed/atom:title", youtubeNamespaces));
+        mediaOntMappings.put("http://www.w3.org/ns/ma-ont#hasMember",     new YoutubeUriMapper("/atom:feed/atom:entry/atom:link[@rel='related']/@href", youtubeNamespaces));
+        mediaOntMappings.put("http://www.w3.org/ns/ma-ont#hasCreator",    new XPathURIMapper("/atom:feed/atom:author/@uri", youtubeNamespaces));               // URI
+        mediaOntMappings.put("http://www.w3.org/ns/ma-ont#hasPublisher",  new XPathURIMapper("/atom:feed/atom:author/@uri", youtubeNamespaces));               // URI
+    }
+
+
+
+    private static Logger log = LoggerFactory.getLogger(YoutubePlaylistProvider.class);
+
+
+    /**
+     * Return the name of this data provider. To be used e.g. in the configuration and in log messages.
+     *
+     * @return
+     */
+    @Override
+    public String getName() {
+        return "YouTube Playlist";
+    }
+
+    /**
+     * Return the list of mime types accepted by this data provider.
+     *
+     * @return
+     */
+    @Override
+    public String[] listMimeTypes() {
+        return new String[] {
+                "application/atom+xml"
+        };
+    }
+
+    /**
+     * Build the URL to use to call the webservice in order to retrieve the data for the resource passed as argument.
+     * In many cases, this will just return the URI of the resource (e.g. Linked Data), but there might be data providers
+     * that use different means for accessing the data for a resource, e.g. SPARQL or a Cache.
+     *
+     *
+     * @param resource
+     * @param endpoint endpoint configuration for the data provider (optional)
+     * @return
+     */
+    @Override
+    public List<String> buildRequestUrl(String resource, Endpoint endpoint) {
+        if(resource.startsWith("http://www.youtube.com/p/")) {
+            // YouTube playlist URI, request the GData URI instead
+            try {
+                URI uri = new URI(resource);
+                String[] p_components = uri.getPath().split("/");
+                String playlist_id = p_components[p_components.length-1];
+
+                return Collections.singletonList("http://gdata.youtube.com/feeds/api/playlists/" + playlist_id);
+
+            } catch (URISyntaxException e) {
+                throw new RuntimeException("URI '"+resource+"'could not be parsed, it is not a valid URI");
+            }
+        } else if(resource.startsWith("http://www.youtube.com/playlist")) {
+            // YouTube playlist URI, request the GData URI instead
+            try {
+                URI uri = new URI(resource);
+
+                List<NameValuePair> params = URLEncodedUtils.parse(uri, "UTF-8");
+
+                String playlist_id = null;
+                for(NameValuePair pair : params) {
+                    if("list".equals(pair.getName())) {
+                        if(pair.getValue().startsWith("PL")) {
+                            // playlist always starts with PL, e.g. PL5A65D58E4867E738, but the ID is the part after the PL
+                            playlist_id = pair.getValue().substring(2);
+                        } else {
+                            playlist_id = pair.getValue();
+                        }
+                    }
+                }
+
+                if(playlist_id != null)
+                    return Collections.singletonList("http://gdata.youtube.com/feeds/api/playlists/"+playlist_id);
+            } catch (URISyntaxException e) {
+                throw new RuntimeException("URI '"+resource+"'could not be parsed, it is not a valid URI");
+            }
+        }
+        return Collections.singletonList(resource);
+    }
+
+
+    /**
+     * Return a mapping table mapping from RDF properties to XPath Value Mappers. Each entry in the map is evaluated
+     * in turn; in case the XPath expression yields a result, the property is added for the processed resource.
+     *
+     * @return
+     * @param requestUrl
+     */
+    @Override
+    protected Map<String, XPathValueMapper> getXPathMappings(String requestUrl) {
+        return mediaOntMappings;
+    }
+
+    /**
+     * Return a list of URIs that should be added as types for each processed resource.
+     *
+     * @return
+     * @param resource
+     */
+    @Override
+    protected List<String> getTypes(org.openrdf.model.URI resource) {
+        return ImmutableList.of(NS_MEDIA + "Collection", Namespaces.NS_LMF_TYPES + "YoutubePlaylist");
+    }
+
+
+    /**
+     * Provide namespace mappings for the XPath expressions from namespace prefix to namespace URI. May be overridden
+     * by subclasses as appropriate, the default implementation returns an empty map.
+     *
+     * @return
+     */
+    @Override
+    protected Map<String, String> getNamespaceMappings() {
+        return youtubeNamespaces;
+    }
+}

http://git-wip-us.apache.org/repos/asf/incubator-marmotta/blob/c32963d5/ldclient/ldclient-provider-youtube/src/main/java/org/apache/marmotta/ldclient/provider/youtube/YoutubeVideoPagesProvider.java
----------------------------------------------------------------------
diff --git a/ldclient/ldclient-provider-youtube/src/main/java/org/apache/marmotta/ldclient/provider/youtube/YoutubeVideoPagesProvider.java b/ldclient/ldclient-provider-youtube/src/main/java/org/apache/marmotta/ldclient/provider/youtube/YoutubeVideoPagesProvider.java
new file mode 100644
index 0000000..d459dd0
--- /dev/null
+++ b/ldclient/ldclient-provider-youtube/src/main/java/org/apache/marmotta/ldclient/provider/youtube/YoutubeVideoPagesProvider.java
@@ -0,0 +1,130 @@
+/**
+ * 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.
+ */
+package org.apache.marmotta.ldclient.provider.youtube;
+
+import org.apache.commons.lang.StringUtils;
+import org.apache.commons.lang.time.DateUtils;
+import org.apache.http.NameValuePair;
+import org.apache.http.client.utils.URLEncodedUtils;
+import org.apache.marmotta.ldclient.api.endpoint.Endpoint;
+import org.apache.marmotta.ldclient.api.ldclient.LDClientService;
+import org.apache.marmotta.ldclient.api.provider.DataProvider;
+import org.apache.marmotta.ldclient.exception.DataRetrievalException;
+import org.apache.marmotta.ldclient.model.ClientResponse;
+import org.openrdf.model.Resource;
+import org.openrdf.model.impl.URIImpl;
+import org.openrdf.repository.Repository;
+import org.openrdf.repository.RepositoryConnection;
+import org.openrdf.repository.RepositoryException;
+import org.openrdf.repository.sail.SailRepository;
+import org.openrdf.sail.memory.MemoryStore;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
+import java.net.URI;
+import java.net.URISyntaxException;
+import java.util.Date;
+import java.util.List;
+
+/**
+ * A data provider that allows to wrap the different Youtube Videos pages, linking with the actual
+ * entity
+ * 
+ * @author Sebastian Schaffert
+ * @author Sergio Fernández
+ */
+public class YoutubeVideoPagesProvider implements DataProvider {
+
+    private static final String YOUTUBE_V = "http://www.youtube.com/v/";
+    private static final String YOUTUBE_WATCH = "http://www.youtube.com/watch";
+    private static final String YOUTUBE_GDATA = "http://gdata.youtube.com/feeds/api/videos/";
+    private static final String FOAF_PRIMARY_TOPIC = "http://xmlns.com/foaf/0.1/primaryTopic";
+
+    private static Logger log = LoggerFactory.getLogger(YoutubeVideoPagesProvider.class);
+
+
+
+    @Override
+    public String getName() {
+        return "YouTube Page";
+    }
+
+    @Override
+    public String[] listMimeTypes() {
+        return new String[] {
+                "text/html"
+        };
+    }
+
+    @Override
+    public ClientResponse retrieveResource(String resource, LDClientService client, Endpoint endpoint) throws DataRetrievalException {
+
+        Repository triples = new SailRepository(new MemoryStore());
+        RepositoryConnection conn;
+        try {
+            triples.initialize();
+            conn = triples.getConnection();
+        } catch (RepositoryException e) {
+            String msg = "Error initializing in-memory repository connection: " + e.getMessage();
+            log.error(msg);
+            throw new RuntimeException(msg, e);
+        }
+
+        String uri = resource;
+        URI objUri;
+        try {
+            objUri = new URI(uri);
+        } catch (URISyntaxException e) {
+            throw new RuntimeException("URI '" + uri + "'could not be parsed, it is not a valid URI");
+        }
+
+        String video_id = null;
+        if (uri.startsWith(YOUTUBE_V)) { // YouTube short watch video URL
+            String[] p_components = objUri.getPath().split("/");
+            video_id = p_components[p_components.length - 1];
+        } else if (resource.startsWith(YOUTUBE_WATCH)) { // YouTube watch video URL
+            List<NameValuePair> params = URLEncodedUtils.parse(objUri, "UTF-8");
+            for (NameValuePair pair : params) {
+                if ("v".equals(pair.getName())) {
+                    video_id = pair.getValue();
+                    break;
+                }
+            }
+        } else if (uri.startsWith(YOUTUBE_GDATA)) { // GData URI
+            video_id = StringUtils.removeStart(uri, YOUTUBE_GDATA);
+        }
+        if (StringUtils.isBlank(video_id)) {
+            String msg = "Not valid video id found in '" + uri + "'";
+            log.error(msg);
+            throw new DataRetrievalException(msg);
+        } else {
+            try {
+                conn.add(new URIImpl(uri), new URIImpl(FOAF_PRIMARY_TOPIC), new URIImpl(YoutubeVideoProvider.YOUTUBE_BASE_URI + video_id), (Resource)null);
+                // FIXME: add inverse triple, but maybe at the YoutubeVideoProvider
+                conn.close();
+            } catch (RepositoryException e) {
+                String msg = "Error adding triples: " + e.getMessage();
+                log.error(msg);
+                throw new RuntimeException(msg, e);
+            }
+            ClientResponse clientResponse = new ClientResponse(triples);
+            clientResponse.setExpires(DateUtils.addYears(new Date(), 10));
+            return clientResponse;
+        }
+
+    }
+
+}

http://git-wip-us.apache.org/repos/asf/incubator-marmotta/blob/c32963d5/ldclient/ldclient-provider-youtube/src/main/java/org/apache/marmotta/ldclient/provider/youtube/YoutubeVideoProvider.java
----------------------------------------------------------------------
diff --git a/ldclient/ldclient-provider-youtube/src/main/java/org/apache/marmotta/ldclient/provider/youtube/YoutubeVideoProvider.java b/ldclient/ldclient-provider-youtube/src/main/java/org/apache/marmotta/ldclient/provider/youtube/YoutubeVideoProvider.java
new file mode 100644
index 0000000..657af44
--- /dev/null
+++ b/ldclient/ldclient-provider-youtube/src/main/java/org/apache/marmotta/ldclient/provider/youtube/YoutubeVideoProvider.java
@@ -0,0 +1,167 @@
+/**
+ * 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.
+ */
+package org.apache.marmotta.ldclient.provider.youtube;
+
+import at.newmedialab.sesame.commons.model.Namespaces;
+import com.google.common.collect.ImmutableList;
+import org.apache.commons.lang.StringUtils;
+import org.apache.marmotta.ldclient.api.endpoint.Endpoint;
+import org.apache.marmotta.ldclient.api.provider.DataProvider;
+import org.apache.marmotta.ldclient.provider.xml.AbstractXMLDataProvider;
+import org.apache.marmotta.ldclient.provider.xml.mapping.CommaSeparatedMapper;
+import org.apache.marmotta.ldclient.provider.xml.mapping.XPathLiteralMapper;
+import org.apache.marmotta.ldclient.provider.xml.mapping.XPathURIMapper;
+import org.apache.marmotta.ldclient.provider.xml.mapping.XPathValueMapper;
+import org.apache.marmotta.ldclient.provider.youtube.mapping.YoutubeCategoryMapper;
+import org.apache.marmotta.ldclient.provider.youtube.mapping.YoutubeLatitudeMapper;
+import org.apache.marmotta.ldclient.provider.youtube.mapping.YoutubeLongitudeMapper;
+import org.openrdf.model.URI;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
+import java.util.Collections;
+import java.util.HashMap;
+import java.util.List;
+import java.util.Map;
+
+/**
+ * A data provider that allows to wrap Youtube Videos. Video descriptions are mapped according to
+ * the Media Ontology:
+ * http://www.w3.org/TR/mediaont-10/
+ * 
+ * @author Sebastian Schaffert
+ * @author Sergio Fernández
+ */
+public class YoutubeVideoProvider extends AbstractXMLDataProvider implements DataProvider {
+
+    public static final String YOUTUBE_BASE_URI = "http://youtu.be/";
+    private static final String GDATA_VIDEO_FEED = "http://gdata.youtube.com/feeds/api/videos/";
+    private static final String NS_MEDIA = "http://www.w3.org/ns/ma-ont#";
+    
+    private static Logger log = LoggerFactory.getLogger(YoutubeVideoProvider.class);
+
+
+    private static Map<String,String> youtubeNamespaces = new HashMap<String, String>();
+    static {
+        youtubeNamespaces.put("atom","http://www.w3.org/2005/Atom" );
+        youtubeNamespaces.put("media","http://search.yahoo.com/mrss/");
+        youtubeNamespaces.put("yt","http://gdata.youtube.com/schemas/2007");
+        youtubeNamespaces.put("gd","http://schemas.google.com/g/2005");
+        youtubeNamespaces.put("georss","http://www.georss.org/georss");
+        youtubeNamespaces.put("gml","http://www.opengis.net/gml");
+    }
+
+    private static Map<String,XPathValueMapper> mediaOntMappings = new HashMap<String, XPathValueMapper>();
+    static {
+        mediaOntMappings.put(NS_MEDIA + "title", new XPathLiteralMapper("/atom:entry/atom:title", youtubeNamespaces));
+        mediaOntMappings.put(NS_MEDIA + "locator", new XPathLiteralMapper("/atom:entry/media:group/media:content/@url", youtubeNamespaces, "anyURI")); // URI
+        mediaOntMappings.put(NS_MEDIA + "hasCreator", new XPathURIMapper("/atom:entry/atom:author/@uri", youtubeNamespaces)); // URI
+        mediaOntMappings.put(NS_MEDIA + "hasPublisher", new XPathURIMapper("/atom:entry/atom:author/@uri", youtubeNamespaces)); // URI
+        mediaOntMappings.put(NS_MEDIA + "date", new XPathLiteralMapper("/atom:entry/atom:published", youtubeNamespaces, "dateTime"));
+        mediaOntMappings.put(NS_MEDIA + "locationLatitude", new YoutubeLatitudeMapper("/atom:entry/georss:where/gml:Point/gml:pos",youtubeNamespaces));
+        mediaOntMappings.put(NS_MEDIA + "locationLongitude", new YoutubeLongitudeMapper("/atom:entry/georss:where/gml:Point/gml:pos",youtubeNamespaces));
+        mediaOntMappings.put(NS_MEDIA + "description", new XPathLiteralMapper("/atom:entry/media:group/media:description",youtubeNamespaces));
+        mediaOntMappings.put(NS_MEDIA + "hasKeyword", new XPathLiteralMapper("/atom:entry/atom:category[@scheme='http://gdata.youtube.com/schemas/2007/keywords.cat']/@term",youtubeNamespaces));
+        mediaOntMappings.put(NS_MEDIA + "hasGenre", new YoutubeCategoryMapper("/atom:entry/media:group/media:category",youtubeNamespaces));       // URI, should  be mapped to YouTube schemas (http://gdata.youtube.com/schemas/2007#)
+        mediaOntMappings.put(NS_MEDIA + "hasRating", new XPathLiteralMapper("/atom:entry/gd:rating/@average",youtubeNamespaces,"float"));          // Float
+        mediaOntMappings.put(NS_MEDIA + "copyright", new XPathURIMapper("/atom:entry/media:group/media:license/@href",youtubeNamespaces));         // URI of license terms
+        mediaOntMappings.put(NS_MEDIA + "hasCompression", new XPathLiteralMapper("/atom:entry/media:group/media:content/@type",youtubeNamespaces));
+        mediaOntMappings.put(NS_MEDIA + "duration", new XPathLiteralMapper("/atom:entry/media:group/media:content/@duration",youtubeNamespaces,"integer"));
+        mediaOntMappings.put(NS_MEDIA + "format", new XPathLiteralMapper("/atom:entry/media:group/media:content/@type",youtubeNamespaces));
+        mediaOntMappings.put("http://xmlns.com/foaf/0.1/thumbnail", new CommaSeparatedMapper("/atom:entry/media:group/media:thumbnail/@url",youtubeNamespaces,"anyURI"));
+        mediaOntMappings.put("http://rdfs.org/sioc/ns#num_views", new XPathLiteralMapper("/atom:entry/yt:statistics/@viewCount",youtubeNamespaces,"integer"));
+    }
+
+
+    /**
+     * Return the name of this data provider. To be used e.g. in the configuration and in log messages.
+     *
+     * @return
+     */
+    @Override
+    public String getName() {
+        return "YouTube Video";
+    }
+
+    /**
+     * Return the list of mime types accepted by this data provider.
+     *
+     * @return
+     */
+    @Override
+    public String[] listMimeTypes() {
+        return new String[] {
+                "application/atom+xml"
+        };
+    }
+
+    /**
+     * Build the URL to use to call the webservice in order to retrieve the data for the resource passed as argument.
+     * In many cases, this will just return the URI of the resource (e.g. Linked Data), but there might be data providers
+     * that use different means for accessing the data for a resource, e.g. SPARQL or a Cache.
+     *
+     *
+     * @param resource
+     * @param endpoint endpoint configuration for the data provider (optional)
+     * @return
+     */
+    @Override
+    public List<String> buildRequestUrl(String resource, Endpoint endpoint) {
+        String uri = resource;
+        if (uri.startsWith(YOUTUBE_BASE_URI)) {
+            // YouTube video URI, request the GData URI instead
+            String video_id = StringUtils.removeStart(uri, YOUTUBE_BASE_URI);
+            if (StringUtils.isNotBlank(video_id))
+                return Collections.singletonList(GDATA_VIDEO_FEED + video_id);
+        }
+        return Collections.singletonList(uri);
+    }
+
+    /**
+     * Return a mapping table mapping from RDF properties to XPath Value Mappers. Each entry in the map is evaluated
+     * in turn; in case the XPath expression yields a result, the property is added for the processed resource.
+     *
+     * @return
+     * @param requestUrl
+     */
+    @Override
+    protected Map<String, XPathValueMapper> getXPathMappings(String requestUrl) {
+        return mediaOntMappings;
+    }
+
+    /**
+     * Return a list of URIs that should be added as types for each processed resource.
+     *
+     * @return
+     * @param resource
+     */
+    @Override
+    protected List<String> getTypes(URI resource) {
+        return ImmutableList.of(NS_MEDIA + "MediaResource",NS_MEDIA + "VideoTrack", Namespaces.NS_LMF_TYPES + "YoutubeVideo");
+    }
+
+    /**
+     * Provide namespace mappings for the XPath expressions from namespace prefix to namespace URI. May be overridden
+     * by subclasses as appropriate, the default implementation returns an empty map.
+     *
+     * @return
+     */
+    @Override
+    protected Map<String, String> getNamespaceMappings() {
+        return youtubeNamespaces;
+    }
+
+}

http://git-wip-us.apache.org/repos/asf/incubator-marmotta/blob/c32963d5/ldclient/ldclient-provider-youtube/src/main/java/org/apache/marmotta/ldclient/provider/youtube/mapping/YoutubeCategoryMapper.java
----------------------------------------------------------------------
diff --git a/ldclient/ldclient-provider-youtube/src/main/java/org/apache/marmotta/ldclient/provider/youtube/mapping/YoutubeCategoryMapper.java b/ldclient/ldclient-provider-youtube/src/main/java/org/apache/marmotta/ldclient/provider/youtube/mapping/YoutubeCategoryMapper.java
new file mode 100644
index 0000000..21fc26a
--- /dev/null
+++ b/ldclient/ldclient-provider-youtube/src/main/java/org/apache/marmotta/ldclient/provider/youtube/mapping/YoutubeCategoryMapper.java
@@ -0,0 +1,57 @@
+/**
+ * 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.
+ */
+package org.apache.marmotta.ldclient.provider.youtube.mapping;
+
+import org.apache.marmotta.ldclient.provider.xml.mapping.XPathValueMapper;
+import org.openrdf.model.Value;
+import org.openrdf.model.ValueFactory;
+
+import java.util.Collections;
+import java.util.List;
+import java.util.Map;
+
+/**
+ * Maps youtube categories to their respective Schema URIs
+ * <p/>
+ * Author: Sebastian Schaffert
+ */
+public class YoutubeCategoryMapper extends XPathValueMapper {
+    
+    private static final String YT_SCHEMA = "http://gdata.youtube.com/schemas/2007#";
+    
+    public YoutubeCategoryMapper(String xpath) {
+        super(xpath);
+    }
+
+    public YoutubeCategoryMapper(String xpath, Map<String, String> namespaces) {
+        super(xpath, namespaces);
+    }
+
+    /**
+     * Take the selected value, process it according to the mapping definition, and create Sesame Values using the
+     * factory passed as argument.
+     *
+     *
+     * @param resourceUri
+     * @param selectedValue
+     * @param factory
+     * @return
+     */
+    @Override
+    public List<Value> map(String resourceUri, String selectedValue, ValueFactory factory) {
+        return Collections.singletonList((Value)factory.createURI(YT_SCHEMA+selectedValue));
+    }
+}

http://git-wip-us.apache.org/repos/asf/incubator-marmotta/blob/c32963d5/ldclient/ldclient-provider-youtube/src/main/java/org/apache/marmotta/ldclient/provider/youtube/mapping/YoutubeLatitudeMapper.java
----------------------------------------------------------------------
diff --git a/ldclient/ldclient-provider-youtube/src/main/java/org/apache/marmotta/ldclient/provider/youtube/mapping/YoutubeLatitudeMapper.java b/ldclient/ldclient-provider-youtube/src/main/java/org/apache/marmotta/ldclient/provider/youtube/mapping/YoutubeLatitudeMapper.java
new file mode 100644
index 0000000..5be4449
--- /dev/null
+++ b/ldclient/ldclient-provider-youtube/src/main/java/org/apache/marmotta/ldclient/provider/youtube/mapping/YoutubeLatitudeMapper.java
@@ -0,0 +1,56 @@
+/**
+ * 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.
+ */
+package org.apache.marmotta.ldclient.provider.youtube.mapping;
+
+import org.apache.marmotta.ldclient.provider.xml.mapping.XPathLiteralMapper;
+import org.openrdf.model.Value;
+import org.openrdf.model.ValueFactory;
+
+import java.util.List;
+import java.util.Map;
+
+/**
+ * Add file description here!
+ * <p/>
+ * Author: Sebastian Schaffert
+ */
+public class YoutubeLatitudeMapper extends XPathLiteralMapper {
+
+    public YoutubeLatitudeMapper(String xpath) {
+        super(xpath,"decimal");
+    }
+
+    public YoutubeLatitudeMapper(String xpath, Map<String, String> namespaces) {
+        super(xpath, namespaces, "decimal");
+    }
+
+    /**
+     * Take the selected value, process it according to the mapping definition, and create Sesame Values using the
+     * factory passed as argument.
+     *
+     *
+     * @param resourceUri
+     * @param selectedValue
+     * @param factory
+     * @return
+     */
+    @Override
+    public List<Value> map(String resourceUri, String selectedValue, ValueFactory factory) {
+        String[] latlong = selectedValue.split(" ");
+
+        return super.map(resourceUri, latlong[0], factory);
+    }
+}

http://git-wip-us.apache.org/repos/asf/incubator-marmotta/blob/c32963d5/ldclient/ldclient-provider-youtube/src/main/java/org/apache/marmotta/ldclient/provider/youtube/mapping/YoutubeLongitudeMapper.java
----------------------------------------------------------------------
diff --git a/ldclient/ldclient-provider-youtube/src/main/java/org/apache/marmotta/ldclient/provider/youtube/mapping/YoutubeLongitudeMapper.java b/ldclient/ldclient-provider-youtube/src/main/java/org/apache/marmotta/ldclient/provider/youtube/mapping/YoutubeLongitudeMapper.java
new file mode 100644
index 0000000..59c49a3
--- /dev/null
+++ b/ldclient/ldclient-provider-youtube/src/main/java/org/apache/marmotta/ldclient/provider/youtube/mapping/YoutubeLongitudeMapper.java
@@ -0,0 +1,62 @@
+/**
+ * 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.
+ */
+package org.apache.marmotta.ldclient.provider.youtube.mapping;
+
+import org.apache.marmotta.ldclient.provider.xml.mapping.XPathLiteralMapper;
+import org.openrdf.model.Value;
+import org.openrdf.model.ValueFactory;
+
+import java.util.List;
+import java.util.Map;
+
+/**
+ * Add file description here!
+ * <p/>
+ * Author: Sebastian Schaffert
+ */
+public class YoutubeLongitudeMapper extends XPathLiteralMapper {
+
+    public YoutubeLongitudeMapper(String xpath) {
+        super(xpath,"decimal");
+    }
+
+    public YoutubeLongitudeMapper(String xpath, Map<String, String> namespaces) {
+        super(xpath, namespaces, "decimal");
+    }
+
+    /**
+     * Take the selected value, process it according to the mapping definition, and create Sesame Values using the
+     * factory passed as argument.
+     *
+     *
+     * @param resourceUri
+     * @param selectedValue
+     * @param factory
+     * @return
+     */
+    @Override
+    public List<Value> map(String resourceUri, String selectedValue, ValueFactory factory) {
+        String[] latlong = selectedValue.split(" ");
+
+        if(latlong.length == 2) {
+            return super.map(resourceUri, latlong[1], factory);
+        } else {
+            throw new RuntimeException("not a valid position value: "+selectedValue);
+        }
+
+    }
+
+}

http://git-wip-us.apache.org/repos/asf/incubator-marmotta/blob/c32963d5/ldclient/ldclient-provider-youtube/src/main/java/org/apache/marmotta/ldclient/provider/youtube/mapping/YoutubeUriMapper.java
----------------------------------------------------------------------
diff --git a/ldclient/ldclient-provider-youtube/src/main/java/org/apache/marmotta/ldclient/provider/youtube/mapping/YoutubeUriMapper.java b/ldclient/ldclient-provider-youtube/src/main/java/org/apache/marmotta/ldclient/provider/youtube/mapping/YoutubeUriMapper.java
new file mode 100644
index 0000000..5fee223
--- /dev/null
+++ b/ldclient/ldclient-provider-youtube/src/main/java/org/apache/marmotta/ldclient/provider/youtube/mapping/YoutubeUriMapper.java
@@ -0,0 +1,86 @@
+/**
+ * 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.
+ */
+package org.apache.marmotta.ldclient.provider.youtube.mapping;
+
+import org.apache.http.NameValuePair;
+import org.apache.http.client.utils.URLEncodedUtils;
+import org.apache.marmotta.ldclient.provider.xml.mapping.XPathValueMapper;
+import org.openrdf.model.Value;
+import org.openrdf.model.ValueFactory;
+
+import java.net.URI;
+import java.net.URISyntaxException;
+import java.util.Collections;
+import java.util.List;
+import java.util.Map;
+
+/**
+ * Add file description here!
+ * <p/>
+ * Author: Sebastian Schaffert
+ */
+public class YoutubeUriMapper extends XPathValueMapper {
+
+    public YoutubeUriMapper(String xpath) {
+        super(xpath);
+    }
+
+    public YoutubeUriMapper(String xpath, Map<String, String> namespaces) {
+        super(xpath, namespaces);
+    }
+
+    /**
+     * Take the selected value, process it according to the mapping definition, and create Sesame Values using the
+     * factory passed as argument.
+     *
+     *
+     * @param resourceUri
+     * @param selectedValue
+     * @param factory
+     * @return
+     */
+    @Override
+    public List<Value> map(String resourceUri, String selectedValue, ValueFactory factory) {
+        if(selectedValue.startsWith("http://gdata.youtube.com/feeds/api/videos") && selectedValue.indexOf('?') >= 0) {
+            return Collections.singletonList((Value)factory.createURI(selectedValue.substring(0,selectedValue.indexOf('?'))));
+        } else if(selectedValue.startsWith("http://www.youtube.com/v/")) {
+            String[] p_components = selectedValue.split("/");
+            String video_id = p_components[p_components.length-1];
+
+            return Collections.singletonList((Value)factory.createURI("http://gdata.youtube.com/feeds/api/videos/"+video_id));
+        } else if(selectedValue.startsWith("http://www.youtube.com/watch")) {
+            try {
+                URI uri = new URI(selectedValue);
+
+                List<NameValuePair> params = URLEncodedUtils.parse(uri, "UTF-8");
+
+                String video_id = null;
+                for(NameValuePair pair : params) {
+                    if("v".equals(pair.getName())) {
+                        video_id = pair.getValue();
+                    }
+                }
+
+                if(video_id != null) {
+                    return Collections.singletonList((Value)factory.createURI("http://gdata.youtube.com/feeds/api/videos/"+video_id));
+                }
+            } catch (URISyntaxException e) {
+                return Collections.singletonList((Value)factory.createURI(selectedValue));
+            }
+        }
+        return Collections.singletonList((Value)factory.createURI(selectedValue));
+    }
+}

http://git-wip-us.apache.org/repos/asf/incubator-marmotta/blob/c32963d5/ldclient/ldclient-provider-youtube/src/main/resources/META-INF/services/org.apache.marmotta.ldclient.api.endpoint.Endpoint
----------------------------------------------------------------------
diff --git a/ldclient/ldclient-provider-youtube/src/main/resources/META-INF/services/org.apache.marmotta.ldclient.api.endpoint.Endpoint b/ldclient/ldclient-provider-youtube/src/main/resources/META-INF/services/org.apache.marmotta.ldclient.api.endpoint.Endpoint
new file mode 100644
index 0000000..66ab487
--- /dev/null
+++ b/ldclient/ldclient-provider-youtube/src/main/resources/META-INF/services/org.apache.marmotta.ldclient.api.endpoint.Endpoint
@@ -0,0 +1,9 @@
+org.apache.marmotta.ldclient.endpoint.youtube.YoutubeChannelEndpointGData
+org.apache.marmotta.ldclient.endpoint.youtube.YoutubeChannelEndpointWeb
+org.apache.marmotta.ldclient.endpoint.youtube.YoutubePlaylistEndpointGData
+org.apache.marmotta.ldclient.endpoint.youtube.YoutubePlaylistEndpointWeb
+org.apache.marmotta.ldclient.endpoint.youtube.YoutubePlaylistEndpointWebLong
+org.apache.marmotta.ldclient.endpoint.youtube.YoutubeVideoEndpoint
+org.apache.marmotta.ldclient.endpoint.youtube.YoutubeVideoPageEndpointGData
+org.apache.marmotta.ldclient.endpoint.youtube.YoutubeVideoPageEndpointWatch
+org.apache.marmotta.ldclient.endpoint.youtube.YoutubeVideoPageEndpointWeb
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/incubator-marmotta/blob/c32963d5/ldclient/ldclient-provider-youtube/src/main/resources/META-INF/services/org.apache.marmotta.ldclient.api.provider.DataProvider
----------------------------------------------------------------------
diff --git a/ldclient/ldclient-provider-youtube/src/main/resources/META-INF/services/org.apache.marmotta.ldclient.api.provider.DataProvider b/ldclient/ldclient-provider-youtube/src/main/resources/META-INF/services/org.apache.marmotta.ldclient.api.provider.DataProvider
new file mode 100644
index 0000000..91b40a5
--- /dev/null
+++ b/ldclient/ldclient-provider-youtube/src/main/resources/META-INF/services/org.apache.marmotta.ldclient.api.provider.DataProvider
@@ -0,0 +1,4 @@
+org.apache.marmotta.ldclient.provider.youtube.YoutubeChannelProvider
+org.apache.marmotta.ldclient.provider.youtube.YoutubePlaylistProvider
+org.apache.marmotta.ldclient.provider.youtube.YoutubeVideoProvider
+org.apache.marmotta.ldclient.provider.youtube.YoutubeVideoPagesProvider
\ No newline at end of file