summaryrefslogtreecommitdiff
path: root/www/api/export_sioc.php
diff options
context:
space:
mode:
authorcweiske <cweiske@b3834d28-1941-0410-a4f8-b48e95affb8f>2009-10-03 14:00:33 +0000
committercweiske <cweiske@b3834d28-1941-0410-a4f8-b48e95affb8f>2009-10-03 14:00:33 +0000
commit29422fa55379aa61a61019b832c83dab6d450264 (patch)
treee5884ce6fed2cf1d02165a1b5667b99cd80262e5 /www/api/export_sioc.php
parentb8b1d06b2d899658fae64d0de506439ca0ea067c (diff)
downloadsemanticscuttle-29422fa55379aa61a61019b832c83dab6d450264.tar.gz
semanticscuttle-29422fa55379aa61a61019b832c83dab6d450264.tar.bz2
move files to new locations
git-svn-id: https://semanticscuttle.svn.sourceforge.net/svnroot/semanticscuttle/trunk@386 b3834d28-1941-0410-a4f8-b48e95affb8f
Diffstat (limited to 'www/api/export_sioc.php')
-rw-r--r--www/api/export_sioc.php90
1 files changed, 90 insertions, 0 deletions
diff --git a/www/api/export_sioc.php b/www/api/export_sioc.php
new file mode 100644
index 0000000..746d0ea
--- /dev/null
+++ b/www/api/export_sioc.php
@@ -0,0 +1,90 @@
+<?php
+/* Export data with semantic format (SIOC: http://sioc-project.org/, FOAF, SKOS, Annotea Ontology) */
+
+require_once('../header.inc.php');
+header('Content-Type: text/xml; charset=utf-8'); //we change headers html defined in headers.inc.php
+
+/* Service creation: only useful services are created */
+$userservice =& ServiceFactory::getServiceInstance('UserService');
+$bookmarkservice =& ServiceFactory::getServiceInstance('BookmarkService');
+
+?>
+<?php echo "<?xml version=\"1.0\" encoding=\"utf-8\"\n?>"; ?>
+<rdf:RDF
+ xmlns="http://xmlns.com/foaf/0.1/"
+ xmlns:foaf="http://xmlns.com/foaf/0.1/"
+ xmlns:rss="http://purl.org/rss/1.0/"
+ xmlns:dc="http://purl.org/dc/elements/1.1/"
+ xmlns:dcterms="http://purl.org/dc/terms/"
+ xmlns:rdfs="http://www.w3.org/2000/01/rdf-schema#"
+ xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"
+ xmlns:sioc="http://rdfs.org/sioc/ns#"
+ xmlns:sioc_t="http://rdfs.org/sioc/types#"
+ xmlns:bm="http://www.w3.org/2002/01/bookmark#"
+ xmlns:skos="http://www.w3.org/2004/02/skos/core#">
+
+<?php
+//site and community are described using FOAF and SIOC ontology
+?>
+<sioc:Site rdf:about="<?php echo ROOT?>" >
+ <rdf:label><?php echo $GLOBALS['sitename']?></rdf:label>
+</sioc:Site>
+
+<?php //<sioc_t:BookmarkFolder />?>
+
+<?php
+//users are described using FOAF and SIOC ontology
+$users = $userservice->getObjectUsers();
+
+$usersArray = array(); // useful for bookmarks display
+foreach($users as $user) {
+ $usersArray[$user->getId()] = $user->getUserName();
+}
+?>
+
+<?php foreach($users as $user) :?>
+<sioc:User rdf:about="<?php echo createUrl('profile', $user->getUserName())?>">
+ <sioc:name><?php echo $user->getUserName() ?></sioc:name>
+ <sioc:member_of rdf:resource="<?php echo ROOT?>" />
+</sioc:User>
+<?php endforeach; ?>
+
+<?php
+/*
+No page for usergroup (users/admin) for the moment
+ <sioc:Usergroup rdf:ID="authors">
+ <sioc:name>Authors at PlanetRDF.com</sioc:name>
+ <sioc:has_member rdf:nodeID="sioc-id2245901" />
+ </sioc:Usergroup>
+*/
+?>
+
+<?php
+//bookmarks are described using Annotea ontology
+$bookmarks =& $bookmarkservice->getBookmarks(0, NULL, NULL, NULL);
+?>
+
+<?php foreach($bookmarks['bookmarks'] as $bookmark): ?>
+<bm:Bookmark rdf:about="<?php echo createUrl('history', $bookmark['bHash']) ?>">
+ <dc:title><?php echo filter($bookmark['bTitle']) ?></dc:title>
+ <dc:created><?php echo filter($bookmark['bCreated']) ?></dc:created>
+ <dc:description><?php echo filter(strip_tags($bookmark['bDescription'])) ?></dc:description>
+ <dc:date><?php echo $bookmark['bDateTime'] ?></dc:date>
+ <bm:recalls rdf:resource="<?php echo filter($bookmark['bAddress']) ?>"/>
+ <sioc:owner_of rdf:resource="<?php echo createUrl('profile', $usersArray[$bookmark['uId']]) ?>"/>
+ <?php foreach($bookmark['tags'] as $tag): ?>
+ <sioc:topic>
+ <skos:concept rdf:about="<?php echo createUrl('bookmarks', $usersArray[$bookmark['uId']].'/'.$tag) ?>" />
+ </sioc:topic>
+ <?php endforeach; ?>
+</bm:Bookmark>
+
+<?php endforeach; ?>
+
+<?php
+// tags and concepts are described using SKOS ontology
+//concept for user/admins, preflabel, definition, top concept
+?>
+
+</rdf:RDF>
+