Commit e892ed5c authored by Dries's avatar Dries

- Patch #712538 by scor: clean up RDF namespaces and mappings before Drupal 7 release.

parent b225882e
......@@ -1180,7 +1180,7 @@ 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[contains(@class, "comment") and contains(@typeof, "sioct:Comment")]//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[contains(@class, "comment") and contains(@typeof, "sioct:Comment")]//span[@rel="sioc:has_creator"]/a[contains(@class, "username") and @typeof="sioc:UserAccount" 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[contains(@class, "comment") and contains(@typeof, "sioct:Comment")]//span[@rel="sioc:has_creator"]/a[@about]');
......@@ -1191,7 +1191,7 @@ 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[contains(@class, "comment") and contains(@typeof, "sioct:Comment")]//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[contains(@class, "comment") and contains(@typeof, "sioct:Comment")]//span[@rel="sioc:has_creator"]/a[contains(@class, "username") and @typeof="sioc:UserAccount" 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[contains(@class, "comment") and contains(@typeof, "sioct:Comment")]//span[@rel="sioc:has_creator"]/a[@about]');
......@@ -1216,7 +1216,7 @@ class CommentRdfaTestCase extends CommentHelperCase {
$comment_date = $this->xpath('//div[contains(@class, "comment") and contains(@typeof, "sioct:Comment")]//*[contains(@property, "dc:date") and contains(@property, "dc:created")]');
$this->assertTrue(!empty($comment_date), t("RDFa markup for the date of the comment found."));
// The author tag can be either a or span
$comment_author = $this->xpath('//div[contains(@class, "comment") and contains(@typeof, "sioct:Comment")]//span[@rel="sioc:has_creator"]/*[contains(@class, "username") and @typeof="sioc:User" and @property="foaf:name"]');
$comment_author = $this->xpath('//div[contains(@class, "comment") and contains(@typeof, "sioct:Comment")]//span[@rel="sioc:has_creator"]/*[contains(@class, "username") and @typeof="sioc:UserAccount" and @property="foaf:name"]');
$name = empty($account["name"]) ? $this->web_user->name : $account["name"] . " (not verified)";
$this->assertEqual((string)$comment_author[0], $name, t("RDFa markup for the comment author found."));
$comment_body = $this->xpath('//div[contains(@class, "comment") and contains(@typeof, "sioct:Comment")]//div[@class="content"]//div[contains(@class, "comment-body")]//div[@property="content:encoded"]');
......
......@@ -77,7 +77,6 @@ function rdf_help($path, $arg) {
*/
function rdf_rdf_namespaces() {
return array(
'admin' => 'http://webns.net/mvcb/',
'content' => 'http://purl.org/rss/1.0/modules/content/',
'dc' => 'http://purl.org/dc/terms/',
'foaf' => 'http://xmlns.com/foaf/0.1/',
......@@ -85,10 +84,8 @@ function rdf_rdf_namespaces() {
'rdf' => 'http://www.w3.org/1999/02/22-rdf-syntax-ns#',
'rdfs' => 'http://www.w3.org/2000/01/rdf-schema#',
'rss' => 'http://purl.org/rss/1.0/',
'tags' => 'http://www.holygoat.co.uk/owl/redwood/0.1/tags/',
'sioc' => 'http://rdfs.org/sioc/ns#',
'sioct' => 'http://rdfs.org/sioc/types#',
'ctag' => 'http://commontag.org/ns#',
'skos' => 'http://www.w3.org/2004/02/skos/core#',
'xsd' => 'http://www.w3.org/2001/XMLSchema#',
);
......@@ -439,7 +436,7 @@ function rdf_process(&$variables, $hook) {
function rdf_preprocess_node(&$variables) {
// Adds RDFa markup to the node container. The about attribute specifies the
// URI of the resource described within the HTML element, while the typeof
// attribute indicates its RDF type (foaf:Document, or sioc:User, etc.).
// attribute indicates its RDF type (foaf:Document, or sioc:Person, etc.).
$variables['attributes_array']['about'] = empty($variables['node_url']) ? NULL: $variables['node_url'];
$variables['attributes_array']['typeof'] = empty($variables['node']->rdf_mapping['rdftype']) ? NULL : $variables['node']->rdf_mapping['rdftype'];
......@@ -549,8 +546,8 @@ function rdf_preprocess_user_profile(&$variables) {
$variables['attributes_array']['typeof'] = $account->rdf_mapping['rdftype'];
$variables['attributes_array']['about'] = url($uri['path'], $uri['options']);
}
// Adds the relationship between the sioc:User and the foaf:Person who holds
// the account.
// Adds the relationship between the sioc:UserAccount and the foaf:Person who
// holds the account.
$account_holder_meta = array(
'#tag' => 'meta',
'#attributes' => array(
......
......@@ -322,7 +322,7 @@ class RdfMappingDefinitionTestCase extends DrupalWebTestCase {
$account_uri = url('user/' . $user2->uid);
$person_uri = url('user/' . $user2->uid, array('fragment' => 'me'));
$user2_profile_about = $this->xpath('//div[@class="profile" and @typeof="sioc:User" and @about=:account-uri]', array(
$user2_profile_about = $this->xpath('//div[@class="profile" and @typeof="sioc:UserAccount" and @about=:account-uri]', array(
':account-uri' => $account_uri,
));
$this->assertTrue(!empty($user2_profile_about), t('RDFa markup found on user profile page'));
......@@ -331,7 +331,7 @@ class RdfMappingDefinitionTestCase extends DrupalWebTestCase {
':person-uri' => $person_uri,
':account-uri' => $account_uri,
));
$this->assertTrue(!empty($user_account_holder), t('URI created for account holder and username set on sioc:User.'));
$this->assertTrue(!empty($user_account_holder), t('URI created for account holder and username set on sioc:UserAccount.'));
$user_username = $this->xpath('//meta[@about=:account-uri and contains(@property, "foaf:name") and @content=:username]', array(
':account-uri' => $account_uri,
......@@ -346,7 +346,7 @@ class RdfMappingDefinitionTestCase extends DrupalWebTestCase {
$this->drupalGet('node/' . $node->nid);
// Ensures the default bundle mapping for user is used on the Authored By
// information on the node.
$author_about = $this->xpath('//a[@typeof="sioc:User" and @about=:account-uri and @property="foaf:name" and contains(@xml:lang, "")]', array(
$author_about = $this->xpath('//a[@typeof="sioc:UserAccount" and @about=:account-uri and @property="foaf:name" and contains(@xml:lang, "")]', array(
':account-uri' => $account_uri,
));
$this->assertTrue(!empty($author_about), t('RDFa markup found on author information on post. xml:lang on username is set to empty string.'));
......@@ -466,7 +466,7 @@ class RdfTrackerAttributesTestCase extends DrupalWebTestCase {
$this->assertTrue(!empty($tracker_title), t('Title property attribute found on @user content.', array('@user'=> $user)));
// Tests whether the relationship between the content and user has been set.
$tracker_user = $this->xpath('//tr[@about=:url]//td[contains(@rel, "sioc:has_creator")]//*[contains(@typeof, "sioc:User") and contains(@property, "foaf:name")]', array(':url' => $url));
$tracker_user = $this->xpath('//tr[@about=:url]//td[contains(@rel, "sioc:has_creator")]//*[contains(@typeof, "sioc:UserAccount") and contains(@property, "foaf:name")]', array(':url' => $url));
$this->assertTrue(!empty($tracker_user), t('Typeof and name property attributes found on @user.', array('@user'=> $user)));
// There should be an about attribute on logged in users and no about
// attribute for anonymous users.
......
......@@ -1421,12 +1421,9 @@ function taxonomy_rdf_mapping() {
'description' => array(
'predicates' => array('skos:definition'),
),
// 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',
'predicates' => array('skos:inScheme'),
'type' => 'rel',
),
'parent' => array(
'predicates' => array('skos:broader'),
......@@ -1438,9 +1435,9 @@ function taxonomy_rdf_mapping() {
'type' => 'taxonomy_vocabulary',
'bundle' => RDF_DEFAULT_BUNDLE,
'mapping' => array(
'rdftype' => array('skos:Collection'),
'rdftype' => array('skos:ConceptScheme'),
'name' => array(
'predicates' => array('rdfs:label'),
'predicates' => array('dc:title'),
),
'description' => array(
'predicates' => array('rdfs:comment'),
......
......@@ -3522,7 +3522,7 @@ function user_rdf_mapping() {
'type' => 'user',
'bundle' => RDF_DEFAULT_BUNDLE,
'mapping' => array(
'rdftype' => array('sioc:User'),
'rdftype' => array('sioc:UserAccount'),
'name' => array(
'predicates' => array('foaf:name'),
),
......
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