In a discussion on groups.drupal.org, fago suggested to agree on a foaf:Person URI for each user profile. This is also on the wish list of Dan Brickley's feedback on the integration of RDFa in Drupal 7 (point 3).

Having core asserting this foaf:Person URI would prevent contrib modules to mint their own URI according to their own rules, which would lead to a mess. It would also make it easier for people to update their foaf file with the foaf:Person URI associated with their account on Drupal sites.

The reason for distinguishing between a sioc:User and a foaf:Person is that these types carry different information, e.g. a date of birth is associated with a foaf:Person, while a registration date or a username describe the user account (sioc:User).

Appending #me to the user profile URI looks like a good pattern, e.g. http://example.com/user/4#me

The foaf:Person URI only needs to be added on the user profile page.

Support from Acquia helps fund testing for Drupal Acquia logo

Comments

Anonymous’s picture

Adding a wrapping div to the user that contains the foaf:account relationship with the foaf:Agent... Is this too hard-coded??

Anonymous’s picture

Status: Active » Needs review
scor’s picture

Status: Needs review » Needs work

looks like what you're trying to do could be achieved with the rdf_metadata theme function, see how rdf_metadata_attributes_array is implemented in rdf_preprocess_comment() for example. It would also allow other modules to alter this markup if necessary, which they can't do if you're hard-coding it in HTML.

Anonymous’s picture

Setting the rdf_metadata_attributes_array does not work as expected when used with MODULE_preprocess_user_profile.

I have created an issue for this, #702664: theme_rdf_metadata doesn't work for most MODULE_preprocess_HOOK()

Anonymous’s picture

Status: Needs work » Needs review
FileSize
853 bytes

This patch adds the #me URI using rdf_metadata_attributes_array.

It is dependent on the patch from #702664: theme_rdf_metadata doesn't work for most MODULE_preprocess_HOOK().

I can write tests for this sometime this week.

scor’s picture

Status: Needs review » Needs work

At this stage since we're dependent on this other issue which might never move on, it's best to just add the following to the tag (like we do for node title):

<meta about="/user/1#me" typeof="foaf:Person" rel="foaf:account" resource="/user/1" />

The benefit is also that we get 2 triples for the price of one tag.

Anonymous’s picture

This patch adds a meta tag as per suggestion in #6 and a test.

aspilicious’s picture

Status: Needs work » Needs review
scor’s picture

Status: Needs review » Needs work
+++ modules/rdf/rdf.module	11 Feb 2010 14:43:27 -0000
@@ -481,6 +481,18 @@ function rdf_preprocess_user_profile(&$v
+      'about' => url('user/' . $variables['elements']['#account']->uid, array('fragment' => 'me')),
+      'typeof' => array('foaf:Person'),
+      'rel' => array('foaf:account'),
+      'resource' => url('user/' . $variables['elements']['#account']->uid),

no need to use the lengthy $variables['elements']['#account'] here: we already have all this information in $account which contains the user object loaded at the beginning of rdf_preprocess_user_profile().

Powered by Dreditor.

Anonymous’s picture

Status: Needs work » Needs review
FileSize
4.78 KB

This patch also includes the relationship between the sioc:User and username.

Because the current rdf_preprocess_user_profile loads the logged in user into the $account variable, this is dependent on #711592: rdf_preprocess_user_profile uses currently logged in user to really work.

scor’s picture

like when displaying a full node, we follow the same practice which is to include the name of the user in a meta tag at the top of the page. The main reason being that the title is tricky to annotate with RDFa, themers are likely to want to tweak it and we don't want them to have to deal with RDFa.

We could also remove " // @todo move to user.module". We've decided to keep that in rdf.module.

Anonymous’s picture

Status: Needs review » Needs work

Thinking about this, should the typeof really be foaf:Person? There may be organization accounts, so should we use foaf:Agent instead?

scor’s picture

let's go with foaf:Person for now and discuss this later. There will be a pre release patch to clean-up some non-used namespaces, and such a change could also be integrated (see #712538: Clean up RDF namespaces and mappings before Drupal 7 release).

Anonymous’s picture

Status: Needs work » Needs review
FileSize
1.64 KB

Rerolled... now with 1 fewer errant todo.

scor’s picture

Status: Needs review » Needs work

looks like we lost the tests...

Anonymous’s picture

Hmmm... whooooops.

Here is the patch with the tests reincorporated.

Anonymous’s picture

Status: Needs work » Needs review
scor’s picture

Status: Needs review » Reviewed & tested by the community

Thanks Lin! tried the patch and works as intended.

scor’s picture

#16: rdf_foafagent-uri_701672-16.patch queued for re-testing.

Dries’s picture

Status: Reviewed & tested by the community » Fixed

Committed to CVS HEAD.

Status: Fixed » Closed (fixed)

Automatically closed -- issue fixed for 2 weeks with no activity.

tourendal’s picture

Sorry to comment on a closed bug. Let me know if this is worth opening a new bug...

I noticed, that in the meta tag of the profile HTML I get "/users/username#me" but in the RDF at '/users/1/rdf' I see "/users/username#this".

It would be nice if there weren't several URIs created for the same thing/person. Is this data from different modules? I don't fully understand the difference between data in RDF and RDFa in Drupal.

Best.

scor’s picture

@Atrus, don't be sorry at all :) yes, this issue belongs to the RDF package in contrib, please an issue at http://drupal.org/project/issues/rdf?version=7.x

tourendal’s picture

The bug is at #1139894: Person identifier "#me" vs. "#this" in Drupal's RDFa vs. RDF.

Scor, thanks for the warm welcome.

Liam Morland’s picture

Issue summary: View changes

This now causes a validation error and should be removed or changed, see #2931842: Validation error with foaf:Person URI.