Commit 102a6829 authored by Dries's avatar Dries

- Patch #652588 by scor: updated RDF mapping definition in the core modules.

parent 8691c9f2
......@@ -2341,7 +2341,7 @@ function template_preprocess_html(&$variables) {
// mechanisms for extraction of this RDF content via XSLT transformation
// using an associated GRDDL profile.
$variables['rdf_namespaces'] = drupal_get_rdf_namespaces();
$variables['grddl_profile'] = 'http://ns.inria.fr/grddl/rdfa/';
$variables['grddl_profile'] = 'http://www.w3.org/1999/xhtml/vocab';
$variables['language'] = $GLOBALS['language'];
$variables['language']->dir = $GLOBALS['language']->direction ? 'rtl' : 'ltr';
......
......@@ -219,7 +219,7 @@ function blog_rdf_mapping() {
'type' => 'node',
'bundle' => 'blog',
'mapping' => array(
'rdftype' => array('sioct:Weblog'),
'rdftype' => array('sioc:Post', 'sioct:BlogPost'),
),
),
);
......
......@@ -2465,7 +2465,7 @@ function comment_rdf_mapping() {
'type' => 'comment',
'bundle' => RDF_DEFAULT_BUNDLE,
'mapping' => array(
'rdftype' => array('sioct:Post'),
'rdftype' => array('sioc:Post'),
'title' => array(
'predicates' => array('dc:title'),
),
......@@ -2474,14 +2474,21 @@ function comment_rdf_mapping() {
'datatype' => 'xsd:dateTime',
'callback' => 'date_iso8601',
),
'changed' => array(
'predicates' => array('dc:modified'),
'datatype' => 'xsd:dateTime',
'callback' => 'date_iso8601',
),
'body' => array(
'predicates' => array('content:encoded'),
),
'pid' => array(
'predicates' => array('sioc:reply_of'),
'type' => 'rel',
),
'uid' => array(
'predicates' => array('sioc:has_creator'),
'type' => 'rel',
),
'name' => array(
'predicates' => array('foaf:name'),
......
......@@ -1144,10 +1144,10 @@ class CommentRdfaTestCase extends CommentHelperCase {
// Tests comment #2 as anonymous user.
$this->_testBasicCommentRdfaMarkup($comment2, $anonymous_user);
// Tests the RDFa markup for the homepage (specific to anonymous comments).
$comment_homepage = $this->xpath("//div[@typeof='sioct:Post']//span[@rel='sioc:has_creator']/a[contains(@class, 'username') and @typeof='sioc:User' and @property='foaf:name' and @href='http://example.org/' and contains(@rel, 'foaf:page')]");
$comment_homepage = $this->xpath("//div[@typeof='sioc:Post']//span[@rel='sioc:has_creator']/a[contains(@class, 'username') and @typeof='sioc:User' and @property='foaf:name' and @href='http://example.org/' and contains(@rel, 'foaf:page')]");
$this->assertTrue(!empty($comment_homepage), t('RDFa markup for the homepage of anonymous user found.'));
// There should be no about attribute on anonymous comments.
$comment_homepage = $this->xpath("//div[@typeof='sioct:Post']//span[@rel='sioc:has_creator']/a[@about]");
$comment_homepage = $this->xpath("//div[@typeof='sioc:Post']//span[@rel='sioc:has_creator']/a[@about]");
$this->assertTrue(empty($comment_homepage), t('No about attribute is present on anonymous user comment.'));
// Tests comment #2 as logged in user.
......@@ -1155,10 +1155,10 @@ class CommentRdfaTestCase extends CommentHelperCase {
$this->drupalGet('node/' . $this->node2->nid);
$this->_testBasicCommentRdfaMarkup($comment2, $anonymous_user);
// Tests the RDFa markup for the homepage (specific to anonymous comments).
$comment_homepage = $this->xpath("//div[@typeof='sioct:Post']//span[@rel='sioc:has_creator']/a[contains(@class, 'username') and @typeof='sioc:User' and @property='foaf:name' and @href='http://example.org/' and contains(@rel, 'foaf:page')]");
$comment_homepage = $this->xpath("//div[@typeof='sioc:Post']//span[@rel='sioc:has_creator']/a[contains(@class, 'username') and @typeof='sioc:User' and @property='foaf:name' and @href='http://example.org/' and contains(@rel, 'foaf:page')]");
$this->assertTrue(!empty($comment_homepage), t('RDFa markup for the homepage of anonymous user found.'));
// There should be no about attribute on anonymous comments.
$comment_homepage = $this->xpath("//div[@typeof='sioct:Post']//span[@rel='sioc:has_creator']/a[@about]");
$comment_homepage = $this->xpath("//div[@typeof='sioc:Post']//span[@rel='sioc:has_creator']/a[@about]");
$this->assertTrue(empty($comment_homepage), t('No about attribute is present on anonymous user comment.'));
}
......@@ -1173,14 +1173,14 @@ class CommentRdfaTestCase extends CommentHelperCase {
* An array containing information about an anonymous user.
*/
function _testBasicCommentRdfaMarkup($comment, $account = array()) {
$comment_container = $this->xpath("//div[contains(@class, 'comment') and @typeof='sioct:Post']");
$comment_container = $this->xpath("//div[contains(@class, 'comment') and @typeof='sioc:Post']");
$this->assertTrue(!empty($comment_container));
$comment_title = $this->xpath("//div[@typeof='sioct:Post']//h3[@property='dc:title']");
$comment_title = $this->xpath("//div[@typeof='sioc:Post']//h3[@property='dc:title']");
$this->assertEqual((string)$comment_title[0]->a, $comment->subject);
$comment_date = $this->xpath("//div[@typeof='sioct:Post']//*[contains(@property, 'dc:date') and contains(@property, 'dc:created')]");
$comment_date = $this->xpath("//div[@typeof='sioc:Post']//*[contains(@property, 'dc:date') and contains(@property, 'dc:created')]");
$this->assertTrue(!empty($comment_date));
// The author tag can be either a or span
$comment_author = $this->xpath("//div[@typeof='sioct:Post']//span[@rel='sioc:has_creator']/*[contains(@class, 'username') and @typeof='sioc:User' and @property='foaf:name']");
$comment_author = $this->xpath("//div[@typeof='sioc:Post']//span[@rel='sioc:has_creator']/*[contains(@class, 'username') and @typeof='sioc:User' and @property='foaf:name']");
$name = empty($account['name']) ? $this->web_user->name : $account['name'] . ' (not verified)';
$this->assertEqual((string)$comment_author[0], $name);
}
......
......@@ -1194,7 +1194,7 @@ function forum_rdf_mapping() {
'type' => 'node',
'bundle' => 'forum',
'mapping' => array(
'rdftype' => array('sioct:Post', 'sioct:ForumTopic'),
'rdftype' => array('sioc:Post', 'sioct:BoardPost'),
'taxonomy_forums' => array(
'predicates' => array('sioc:has_container'),
'type' => 'rel',
......@@ -1205,7 +1205,7 @@ function forum_rdf_mapping() {
'type' => 'taxonomy_term',
'bundle' => 'forums',
'mapping' => array(
'rdftype' => array('sioct:Container'),
'rdftype' => array('sioc:Container', 'sioc:Forum'),
),
),
);
......
......@@ -800,12 +800,15 @@ function node_rdf_mapping() {
),
'changed' => array(
'predicates' => array('dc:modified'),
'datatype' => 'xsd:dateTime',
'callback' => 'date_iso8601',
),
'body' => array(
'predicates' => array('content:encoded'),
),
'uid' => array(
'predicates' => array('sioc:has_creator'),
'type' => 'rel',
),
'name' => array(
'predicates' => array('foaf:name'),
......
......@@ -910,3 +910,17 @@ function poll_user_cancel($edit, $account, $method) {
}
}
/**
* Implements hook_rdf_mapping().
*/
function poll_rdf_mapping() {
return array(
array(
'type' => 'node',
'bundle' => 'poll',
'mapping' => array(
'rdftype' => array('sioc:Post', 'sioct:Poll'),
),
),
);
}
......@@ -1329,14 +1329,21 @@ function taxonomy_rdf_mapping() {
'mapping' => array(
'rdftype' => array('skos:Concept'),
'name' => array(
'predicates' => array('skos:prefLabel'),
'predicates' => array('rdfs:label', 'skos:prefLabel'),
),
'description' => array(
'predicates' => array('skos:definition'),
),
// The vocabulary this term belongs to.
// The vocabulary this term belongs to. The type 'rev' is used to denote
// the fact that the skos:member property domain is skos:Collection and
// its range is skos:Concept or skos:Collection.
'vid' => array(
'predicates' => array('skos:member'),
'type' => 'rev',
),
'parent' => array(
'predicates' => array('skos:broader'),
'type' => 'rel',
),
),
),
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment