RDF: Difference between revisions
Content deleted Content added
Duesentrieb (talk | contribs) first brainstorming |
Jack Phoenix (talk | contribs) Replacing page with '{{MovedToMediaWiki|Extension:RDF}} Imported with full page histories. --~~~~' |
||
(19 intermediate revisions by 12 users not shown) | |||
Line 1: | Line 1: | ||
{{MovedToMediaWiki|Extension:RDF}} |
|||
This page is about an effort to provide an extensive RDF interface for mediawiki. The idea is to create a flexible framework that goes byond the ability of the code described at [[RDF metadata]]. I ([[User:Duesentrieb]]) am working on this together with [[User:Evan]]. |
|||
Imported with full page histories. --[[User:Roosa|<b>Roosa</b>]] <sub>([[User talk:Roosa|<font color="hotpink">Talk</font>]]) </sub> 20:04, 25 June 2007 (UTC) |
|||
== Scope == |
|||
The idea is to provide a way to query different kinds of information about a wiki page in RDF format. This may include |
|||
* basic metadata as defined by the Dublin Core standard and/or the Creative Commons project. |
|||
* List of all authors |
|||
* List of all links to and from a page |
|||
* List of keyworkds (Categories for a page) |
|||
* List of members of a category |
|||
* ...and a plugin interface for more. |
|||
Also, the RDF could be deliver in different notations, like |
|||
* RDF/XML |
|||
* N-Tripel |
|||
* Turtle |
|||
* ..and my be others. |
|||
This will probably implemented as an extension that provides a special page which, wehn called without parameters, would present a form where the user can specify what data is wanted in what format. |
|||
== Implementation == |
|||
The implementation will probably be based on the RAP framework [http://www.wiwiss.fu-berlin.de/suhl/bizer/rdfapi/]. The core function will take a list of "models", i.e. datasets wanted, and return a RAP model which can then be serialized to create the actual output. |
|||
Here is the code for that function, as suggested by [[User:Evan]]: |
|||
<nowiki> |
|||
function getRdf($article, $modelNames=$wgDefaultModelNames) { |
|||
global $wgModelFunctions; |
|||
#empty model |
|||
$fullModel = new RAP::Model(); |
|||
for ($modelNames as $modelName) { |
|||
$modelFunction = $wgModelFunctions[$modelName]; |
|||
if ($modelFunction == null) { |
|||
#print error |
|||
continue; |
|||
} |
|||
$model = $modelFunction($article); |
|||
$fullModel->merge($model); |
|||
} |
|||
return $fullModel; |
|||
} |
|||
</nowiki> |
|||
$wgModelFunctions may be changed to contain a human readable description of the data set in addition to the function name. This would the be displayed on the query form where the user can choose the data sets. |
|||
Here's an exampel function for creating Dublin Core base data (code suggested by [[User:evan]]): |
|||
<nowiki> |
|||
function DublinCoreModel($article) { |
|||
global $DC_creator, $DC_date; # available from RAP system |
|||
$model = new Model(); |
|||
$resource = getArticleResource($article); # Gets a RAP resource for the article; we'll have some utilities like this |
|||
$user = getUserResource($article->getUser()); # another utility |
|||
$model->add(new Statement($resource, $DC_creator, $user)); |
|||
$model->add(new Statement($resource, $DC_date, new Literal($article->getDate())); |
|||
# etc. |
|||
return $model; |
|||
} |
|||
</nowiki> |
|||
Example function for listing all links from a page (also suggested by [[User:evan]]): |
|||
<nowiki> |
|||
function LinkingModel($article) { |
|||
global $DCMES, $DCTERM, $DCMI_types; |
|||
$model = new Model(); |
|||
$resource = getArticleResource($article); # here's that utility again |
|||
$linkFromTitles = $article->links(); # actually, I'm pretty sure this doesn't exist, but it should. B-) |
|||
for ($linkFromTitles as $linkFromTitle) { |
|||
$model->add(new Statement($resource, $DCTERM['References'], titleToResource($linkFromTitle)); |
|||
} |
|||
$linkToTitles = $article->whatLinksHere(); # another function that never was |
|||
for ($linkToTitles as $linkToTitle) { |
|||
$model->add(new Statement($resource, $DCTERM['isReferencedBy'], titleToResource($linkToTitle)); |
|||
} |
|||
# ... more for Image links, etc. |
|||
return $model; |
|||
} |
|||
</nowiki> |
|||
It may however be better to have a more generic function that allows to build such a list directly from an SQL query. This would make it very easy to add new datasets. |
Latest revision as of 20:04, 25 June 2007
This page has been moved to Extension:RDF on mediawiki.org.
Any modifications or additions to this page should be made on mediawiki.org instead. |
Imported with full page histories. --Roosa (Talk) 20:04, 25 June 2007 (UTC)