Drupal user profiles in RDFa

4 views
Skip to first unread message

Stephane Corlosquet

unread,
Oct 11, 2009, 11:09:52 AM10/11/09
to semant...@w3.org, sioc...@googlegroups.com, foaf...@lists.foaf-project.org, RDFa mailing list
Hi all,

I'm checking the RDFa markup we have chosen for Drupal 7 and want to make sure it's optimal, given that it won't be able to change it after the code freeze (which in one week!). In particular I'd like to discuss the case of the user markup which is used to describe the author or a page or comment. "User profile" in this email refers to the concept of sioc:User / foaf:OnlineAccount. Drupal has 3 main cases which all have different markup.


1. If the administrator of the site decided to make the user profile pages public, then the author will be a link to the author profile page http://example.org/user/23. The original markup is:

<a href="/user/23" title="View user profile." class="username">John</a>

We have 2 options to add RDFa to this link which both return the same RDF data:

<a href="/user/1" rel="sioc:has_creator foaf:maker" title="View user profile." class="username"><span resource="/user/1" typeof="sioc:User" property="foaf:name">Henry</span></a>

or

<span rel="sioc:has_creator foaf:maker"><a href="/d7sprint/user/1" typeof="sioc:User" property="foaf:name" title="View user profile." class="username">Henry</a></span></span>

Question for the RDFa ninjas reading this: is there a way to embed all this information without adding a span tag either inside or outside the a existing a tag. I'm asking this because adding extra markup is frown upon by Drupal themers as it might break some CSS rules or have unintended effects, so if we can do without it it's best. To understand the risk of adding an extra span, take a long at the second option above: if there is a CSS rule on "a span" path targetting other markup on the site, then name of the author will suddenly be affected by this rule, while it would not in the original non-RDFa markup. Unfortunately there is no "blank" tag which maybe would have been helpful here by not interacting with CSS. Such "blank" HTML tag would have been useful in this case to wrap RDFa markup and ensure it is not targeted by any CSS rule (this could be a convention at least).


2. If the user profile pages are not accessible then only the name of the author will be displayed and we are missing the URL of her profile page, or rather I should say we can generate a URI for the user profile, but resolving it would lead to a 403 Access denied. The default Drupal markup in this case is simply:
<span class="username">John</span>

I see 3 alternatives to annotate this in RDFa:

  2.1 Use a markup similar to the one above, but the cons is that the user profile URI will not be dereferencable (and hereby breaking one of the Linked Data principles). It will return a 403 Access denied.

<span rel="sioc:has_creator foaf:maker" class="username"><span resource="/user/1" typeof="sioc:User" property="foaf:name">Henry</span></span>

  2.2 Same as 2.1 but without the resource attribute hence generating a bnode. I always try hard to avoid generating these, but if this is no work around, then we'll have to use it.

<span rel="sioc:has_creator foaf:maker" class="username"><span resource="/user/1" typeof="sioc:User" property="foaf:name">Henry</span></span>

  2.3 We don't introduce the concept of user profile and simply link the page to a name (literal).

<span class="username" property="foaf:maker">Henry</span>

I don't like 2.3 because it's not as meaningful from an RDF perspective. Also, we don't have the same choices in the RDF properties we can use due to the domain which is now a literal, which would be a problem in the context of Drupal since the page -> author relationship gets the same set of RDF properties no matter what the case is (between 1, 2 or 3). So I'd rather use 2.1 or 2.2. but we've got to decide between the best of the two: a non dereferencable URI or a bnode? I like the non referencable URI because we can uniquely identify the author outside the scope of the page, but I wonder how the parsers will react when trying to resolve the URI.


3. In the case of a non registered user leaving a comment, Drupal offers to leave her name, homepage and email address (though the email address is not displayed for privacy reasons). The default markup is:

<a href="http://openspring.net/" rel="nofollow" class="username">Stephane Corlosquet (not verified)</a>

We don't have a user profile URI here, but a homepage which is usually linked to a foaf:Person. Here we have multiple options again to describe the author of a comment. I'm not sure we should directly link a page to a foaf:Person, should we?. Do we have to generate a foaf:OnlineAccount /sioc:User URI here based on the homepage by adding #user to it? use a bnode? opinions?

Stephane.

Simon Reinhardt

unread,
Oct 11, 2009, 11:59:00 AM10/11/09
to SIOC-Dev
Hiya!

On Oct 11, 5:09 pm, Stephane Corlosquet <scorlosq...@gmail.com> wrote:
> Hi all,
>
> I'm checking the RDFa markup we have chosen for Drupal 7 and want to make
> sure it's optimal, given that it won't be able to change it after the code
> freeze (which in one week!). In particular I'd like to discuss the case of
> the user markup which is used to describe the author or a page or comment.
> "User profile" in this email refers to the concept of sioc:User /
> foaf:OnlineAccount. Drupal has 3 main cases which all have different markup.

First of all it's great to see you guys deploying RDFa and SIOC!

> 1. If the administrator of the site decided to make the user profile pages
> public, then the author will be a link to the author profile pagehttp://example.org/user/23. The original markup is:
>
> <a href="/user/23" title="View user profile." class="username">John</a>
>
> We have 2 options to add RDFa to this link which both return the same RDF
> data:
>
> <a href="/user/1" rel="sioc:has_creator foaf:maker" title="View user
> profile." class="username"><span resource="/user/1" typeof="sioc:User"
> property="foaf:name">Henry</span></a>
>
> or
>
> <span rel="sioc:has_creator foaf:maker"><a href="/d7sprint/user/1"
> typeof="sioc:User" property="foaf:name" title="View user profile."
> class="username">Henry</a></span></span>

One important remark here first: if you use both sioc:has_creator
(which has a range of sioc:User) and foaf:maker (with a range of
foaf:Agent) then you're declaring the profile to be both an agent and
an account. I'd very much prefer you don't merge those two entities in
that way. :-)

On a side-note people still haven't agreed if the URIs of profile
pages can be used as the URIs of the accounts but I wouldn't worry too
much about that.

> Question for the RDFa ninjas reading this: is there a way to embed all this
> information without adding a span tag either inside or outside the a
> existing a tag. I'm asking this because adding extra markup is frown upon by
> Drupal themers as it might break some CSS rules or have unintended effects,
> so if we can do without it it's best. To understand the risk of adding an
> extra span, take a long at the second option above: if there is a CSS rule
> on "a span" path targetting other markup on the site, then name of the
> author will suddenly be affected by this rule, while it would not in the
> original non-RDFa markup. Unfortunately there is no "blank" tag which maybe
> would have been helpful here by not interacting with CSS. Such "blank" HTML
> tag would have been useful in this case to wrap RDFa markup and ensure it is
> not targeted by any CSS rule (this could be a convention at least).

I'm no RDFa ninja so people have to correct me if I'm wrong here:
can't you just use @rel, @href, @typeof and @property on one tag? Or
will that confuse the processing?

Alternatively you could get rid of the span by just not declaring the
name (I think SIOC would prefer sioc:name instead of foaf:name but
those properties need mapping anyway) and/or the type on this page.
Instead you just link the maker with the appropriate property. The
type can be inferred from the range of the property and the name could
be supplied when dereferencing the profile. This is of course
problematic with the case you describe below where the profile is not
accessible.

> 2. If the user profile pages are not accessible then only the name of the
> author will be displayed and we are missing the URL of her profile page, or
> rather I should say we can generate a URI for the user profile, but
> resolving it would lead to a 403 Access denied. The default Drupal markup in
> this case is simply:
> <span class="username">John</span>
>
> I see 3 alternatives to annotate this in RDFa:
>
>   2.1 Use a markup similar to the one above, but the cons is that the user
> profile URI will not be dereferencable (and hereby breaking one of the
> Linked Data principles). It will return a 403 Access denied.

But it won't always return a 403, right? At least one person (the
admin) will have access to the pages, often registered users can see
them as well. So if they can't be accessed then that's just bad luck
for the client - there's a reason for this after all. But at least you
identified the user and provided some information, like the name
(unless you do what I proposed above).

An interesting point though: someone who does have access to the pages
should be able to have their semantic client log in / authenticate
with their credentials. And clients who don't have access should be
built robust enough to deal with this situation.

>   2.2 Same as 2.1 but without the resource attribute hence generating a
> bnode. I always try hard to avoid generating these, but if this is no work
> around, then we'll have to use it.

I would avoid this too, since you do have the URIs. At least they can
be used for merging data: if I crawl several post pages and always get
the same URI for the sioc:has_creator then I know they were created
from the same account. With a bnode I don't know that.

>   2.3 We don't introduce the concept of user profile and simply link the
> page to a name (literal).
>
> <span class="username" property="foaf:maker">Henry</span>

I wouldn't do that because foaf:maker has a range of foaf:Agent (and
is declared as an owl:ObjectProperty) so it shouldn't be used with
literal values.
You could use dc:creator though (from the DC elements namespace) which
doesn't make any statement if it's range supposed to be a resource or
a literal.

> 3. In the case of a non registered user leaving a comment, Drupal offers to
> leave her name, homepage and email address (though the email address is not
> displayed for privacy reasons). The default markup is:
>
> <a href="http://openspring.net/" rel="nofollow" class="username">Stephane
> Corlosquet (not verified)</a>
>
> We don't have a user profile URI here, but a homepage which is usually
> linked to a foaf:Person. Here we have multiple options again to describe the
> author of a comment. I'm not sure we should directly link a page to a
> foaf:Person, should we?. Do we have to generate a foaf:OnlineAccount
> /sioc:User URI here based on the homepage by adding #user to it? use a
> bnode? opinions?

Well, they don't have an account on the platform so I wouldn't
generate a URI for a foaf:OnlineAccount. I would probably create a
bnode typed as a foaf:Person (linking from the post to it with
foaf:maker), give it a foaf:name and link it to the homepage with
foaf:homepage.

Stephane Corlosquet

unread,
Oct 13, 2009, 3:17:44 PM10/13/09
to Steven Pemberton, semant...@w3.org, sioc...@googlegroups.com, foaf...@lists.foaf-project.org, RDFa mailing list
Hi,

Thank you all for your feedback, that's excellent! :)


On a side-note people still haven't agreed if the URIs of profile
pages can be used as the URIs of the accounts but I wouldn't worry too
much about that.

Yes, I asked the same question to Dan Brickley during DrupalCon Paris, and he said it was ok to do that.That's also simpler to grasp for people with little background in RDF.


Alternatively you could get rid of the span by just not declaring the
name [...] and/or the type on this page.

Instead you just link the maker with the appropriate property. The
type can be inferred from the range of the property and the name could
be supplied when dereferencing the profile. This is of course
problematic with the case you describe below where the profile is not
accessible.

That was also my first take on this, but I changed my mind as some plugins or UI tool can take advantage of the typeof values. There exist plugins which target specific attributes on RDFa pages and format them depending on their value, e.g. sioc:User of a page in a special form (with a logo, popup or whatever - I know Michael Hausenblas or Alexandre Passant have an example for this). Relying on reasoning and dereferencing is too much to expect and would slow down such interface.


I'd like to get more opinions on the 3 third case where anonymous visitor can leave comments. I agree that using foaf:homepage here is inappropriate due to the IFP, and since we do not control what URI people will put in there we should be careful. Options suggested so far:
1. bnode typed sioc:User or foaf:Agent to cover the case where it's a link to a company homepage.
2. link this bnode to the "homepage" URI with foaf:isPrimaryTopicOf, foaf:page or rdfs:seeAlso.

foaf:isPrimaryTopicOf is also an IFP, so I think we should avoid it. rdfs:seeAlso is good though somewhat generic. foaf:page seems the most appropriate here and does not imply strong assumptions. What do you think?

Stephane.

On Mon, Oct 12, 2009 at 7:48 AM, Steven Pemberton <Steven.P...@cwi.nl> wrote:
On Sun, 11 Oct 2009 17:09:52 +0200, Stephane Corlosquet <scorl...@gmail.com> wrote:

Hi all,

I'm checking the RDFa markup we have chosen for Drupal 7 and want to make
sure it's optimal, given that it won't be able to change it after the code freeze (which in one week!). In particular I'd like to discuss the case of the user markup which is used to describe the author or a page or comment.

Thanks for the chance to feedback!


"User profile" in this email refers to the concept of sioc:User /
foaf:OnlineAccount. Drupal has 3 main cases which all have different markup.


1. If the administrator of the site decided to make the user profile pages public, then the author will be a link to the author profile page
http://example.org/user/23. The original markup is:

<a href="/user/23" title="View user profile." class="username">John</a>

We have 2 options to add RDFa to this link which both return the same RDF
data:

<a href="/user/1" rel="sioc:has_creator foaf:maker" title="View user
profile." class="username"><span resource="/user/1" typeof="sioc:User"
property="foaf:name">Henry</span></a>

or

<span rel="sioc:has_creator foaf:maker"><a href="/d7sprint/user/1"
typeof="sioc:User" property="foaf:name" title="View user profile."
class="username">Henry</a></span></span>

I'm assuming the /dsprint7 is a typo here, otherwise they wouldn't have the same triples.

So the triples they produce are like:

 <http://www.w3.org/basedoc.html> <http://sioc.org/has_creator> <http://www.w3.org/user/1> .
 <http://www.w3.org/basedoc.html> <http://foaf.org/maker> <http://www.w3.org/user/1> .
 <http://www.w3.org/user/1> <http://foaf.org/name> "Henry" .
 <http://www.w3.org/user/1> <http://www.w3.org/1999/02/22-rdf-syntax-ns#type> <http://sioc.org/User> .

Of the two I slightly prefer the second, with the outer <span>, since the URI doesn't have to get repeated.

If it weren't for the @typeof, you could do it all in one go:

<a href="/user/3" rel="sioc:has_creator foaf:maker" title="View user
profile." class="username" property="foaf:name">Steven</a>

but of course the @typeof changes the subject.


Question for the RDFa ninjas reading this: is there a way to embed all this
information without adding a span tag either inside or outside the a
existing a tag. I'm asking this because adding extra markup is frown upon by
Drupal themers as it might break some CSS rules or have unintended effects,
so if we can do without it it's best.

At the cost of repeating the URI, but with the advantage that it doesn't risk messing up your CSS, you don't have to nest the extra span:

<a href="/user/1" rel="sioc:has_creator foaf:maker" title="View user profile." class="username" property="foaf:name">Henry</a>
<span about="/user/1" typeof="sioc:User"></span>

So this is a non-nested version of your first solution.
I think you're worrying too much about the 403s. The triples are true, whether or not you try to dereference the URIs:

 <http://www.w3.org/basedoc.html> <http://sioc.org/has_creator> <http://www.w3.org/user/1> .
 <http://www.w3.org/basedoc.html> <http://foaf.org/maker> <http://www.w3.org/user/1> .
 <http://www.w3.org/user/1> <http://www.w3.org/1999/02/22-rdf-syntax-ns#type> <http://sioc.org/User> .
 <http://www.w3.org/user/1> <http://foaf.org/name> "Henry" .

What you may want to avoid is making them *easy* to dereference. Then I would use a span+@resource instead of an a:

<span resource="/user/1" rel="sioc:has_creator foaf:maker" title="Inaccessible user profile" class="username" property="foaf:name">Henry</a>
<span about="/user/1" typeof="sioc:User"></span>


3. In the case of a non registered user leaving a comment, Drupal offers to leave her name, homepage and email address (though the email address is not displayed for privacy reasons). The default markup is:

<a href="http://openspring.net/" rel="nofollow" class="username">Stephane
Corlosquet (not verified)</a>

We don't have a user profile URI here, but a homepage which is usually
linked to a foaf:Person. Here we have multiple options again to describe the author of a comment. I'm not sure we should directly link a page to a
foaf:Person, should we?

No.


Do we have to generate a foaf:OnlineAccount
/sioc:User URI here based on the homepage by adding #user to it? use a
bnode? opinions?

In the absence of other information I prefer to use rel="foaf:isPrimaryTopicOf" to identify a person from their homepage.
(See http://www.w3.org/MarkUp/2009/rdfa-for-html-authors)

Hope this helps.

Best wishes,

Steven Pemberton


Stephane.


Reply all
Reply to author
Forward
0 new messages