W3C home > Mailing lists > Public > semantic-web@w3.org > August 2007

RDF 2.0 proposal: contextual properties

From: Garret Wilson <garret@globalmentor.com>
Date: Mon, 06 Aug 2007 10:11:02 -0700
Message-ID: <46B75626.6070306@globalmentor.com>
To: Semantic Web <semantic-web@w3.org>

Here's one more proposal for an addition to RDF 2.0. It promised to be 
no less controversial than my proposal for removal of literals, but 
don't worry---I have no delusions that this actually has a chance of 
becoming part of an RDF 2.0. (I expect RDF 2.0 to come long after there 
is an XHTML 2.0, which will arrive when Internet Explorer supports XHTML 
1.0. In short, I'm not putting any bets on there being an RDF 2.0.)

I look forward to feedback---RDF 2.0 or no, this will help me put the 
last pieces in place of an idea that's been brewing for years. If you 
don't understand the proposal, or it confuses you to no end, please feel 
no obligation to participate. Let me lay out my proposal as a series of 
preludes:

***OEBPS Spines***
Back when I was leading the Open eBook Publication Structure 2 effort 
circa 2001/2002 and trying to get OEBPS to adopt RDF, I laid out an 
RDF-based proposal (the XPackage ontology that appears in the  RDF 
Primer). The XPackage specification included a "manifest" which 
specified the content of a packaged book. The person from Microsoft 
working on OEB stressed that there should be a way to specify content 
properties that were only valid in the context of the manifest. In other 
words, if I include about-author.html in the book's manifest, I need to 
be able to specify that about-author.html has a stylesheet 
fancy.css---but only when that document appears in this book. We don't 
want to specify that about-author.html has a stylesheet fancy.css 
wherever it appears (perhaps also in another book). OEB never adopted 
RDF, so I never had to come to terms with the nagging question: how do I 
specify contextual properties in RDF?

***vCard Telephones***
We've got a significant problem in creating an RDF version of vCard. We 
want to be able to specify someone's telephone number with a vcard:tel 
property (with value <tel:+1-201-555-123>, for example). But we also 
need to specify if that telephone number is a mobile number, a work 
number, a fax number, a preferred number, etc. The current W3C vCard 
Ontology draft adds a vcard:homeTel property, a vcard:mobileTel 
property, a vcard:workTel property, etc. But that's a cumbersome 
solution---imagine a vcard:preferredHomeWorkFaxTel property. It's 
unclear to me that this even represents the semantics we desire. Aren't 
we really trying to say, "The resource identified by 
<tel:+1-201-555-123> has a vcard:phoneType of "home", but only in the 
context of this VCard's vcard:tel property?

***vCard Names***
And then we have vCard names. The vcard:Name class can have a 
vcard:familyName property. But according to the vCard specification, we 
need to be able to specify multiple vcard:familyName properties---but 
the order of them may be significant. The only way in RDF to keep track 
of order is to put the vcard:familyName properties in an rdf:Seq or 
rdf:List. But requiring an rdf:List for every vcard:familyName is 
overkill for what will most of the time be a single vcard:familyName 
value. Furthermore, are we going to require an rdf:List in every 
situation in which there could be multiple, ordered property values? 
Isn't what we're really trying to say, "This vcard:Name has multiple 
vcard:familyName values, but they each have an order that only has 
meaning in the context of this vcard:Name resource?"

***RDF xml:lang***
At this point you may be dismissing the whole idea of so-called 
"contextual values". But RDF already includes one contextual property 
that behaves exactly as I'm describing: xml:lang. The xml:lang 
pseudo-property can appear "on any node element or property element", 
according to 
<http://www.w3.org/TR/rdf-syntax-grammar/#section-Syntax-languages>. The 
semantics of xml:lang seems to be, "This resource has the specified 
language---but only in the context of the given property." In other 
words, if I use the string "mais" with an xml:lang of "fr" ("mais" means 
"but" in French), I don't mean that all instances of the string "mais" 
should have that language specified---in other contexts, "mais" may have 
an xml:lang of "pt" ("mais" means "more" in Portuguese). (That RDF 
doesn't allow xml:lang for typed literals doesn't affect the point I'm 
making here---don't get confused by the inconsistent and incomplete ways 
RDF deals with literals.)

Obviously xml:lang is a hack in the RDF model for a single case, forcing 
the model to carry around language information that isn't a real 
"property". We could add other similar hacks for individual 
cases---perhaps creating an rdf:order property that is defined to be 
contextual in the same way that xml:lang is contextual. But I would 
prefer a general solution.

***A General Contextual Property Solution***
When I say that <http://example.com/william> has a vcard:nickname of 
"Bill" in the xml:lang of "en", what am I really saying? I'm saying that 
<http://example.com/william> uses "Bill" as a vcard:nickname, and when 
he does, he considers "Bill" to be in the English language. Similarly, 
if <http://example.com/book> has eg:content of 
<http://example.com/about-author.html>, which in turn has a x:stylesheet 
of <http://example.com/fancy.css> but only for this book, I'm trying to 
say that <http://example.com/book> considers 
<http://example.com/fancy.css> to be the x:stylesheet of 
<http://example.com/about-author.html>, but only as the eg:content of 
<http://example.com/book>.

So let me reformulate xml:lang that using a general solution, in which 
the contextual subject has an rdf:context property with an rdf:Statement 
value, indicating the contextual property using rdf:of. I'm going to use 
RDFON because I'm still not completely up to speed on N3, but the 
notation is close enough so that you should be able to follow along:

<http://example.com/william>
{
  vcard#nickname : "Bill",
  rdf#context : rdf#Statement()
  {
    rdf#of : vcard#nickname,
    rdf#subject : "Bill",
    rdf#predicate : x#lang,
    rdf#object : "en"
  }
}

Similarly, the second example:

<http://example.com/book>
{
  eg#content : <http://example.com/about-author.html>,
  rdf#context : rdf#Statement()
  {
    rdf#of : eg#content,
    rdf#subject : <http://example.com/about-author.html>,
    rdf#predicate : x:stylesheet,
    rdf#object : <http://example.com/fancy.css>
  }
}

But I would also want to have a shortcut notation. Let me give the same 
two examples, using "~" to indicate contextual properties. These would 
be equivalent to the examples above

<http://example.com/william>
{
  vcard#nickname : "Bill"
  {
    ~x#lang : "en"
  }
}

http://example.com/book
{
  eg#content : <http://example.com/about-author.html>
  {
    ~x:stylesheet : <http://example.com/fancy.css>
  }
}

Now let's talk about vcard:familyName of a vcard:Name. If we were to 
have an rdf:order property that could be made contextual, we could 
easily add multiple, ordered family names of "Jones van Buren" like this:

vcard#Name()
{
  vcard#givenName : "William",
  vcard#familyName : "Jones",
  rdf#context : rdf#Statement()
  {
    rdf#of : vcard#familyName,
    rdf#subject : "Jones",
    rdf#predicate : rdf#order,
    rdf#object : 0
  },
  vcard#familyName : "van Buren",
  rdf#context : rdf#Statement()
  {
    rdf#of : vcard#familyName,
    rdf#subject : "van Buren",
    rdf#predicate : rdf#order,
    rdf#object : 1
  }
}

In other words, the family names have contextual orders of 0 and 1. This 
contextual-list like pattern would also have a shortcut syntax: the "|" 
delimiter or something similar:

vcard#Name()
{
  vcard#givenName : "William",
  vcard#familyName : |"Jones", "van Buren"|
}

This would automatically create two vcard:familyName properties (normal 
RDF 1.x properties), and would also create two rdf:context properties 
(again, normal RDF 1.x properties), each providing a generated a 
contextual order of 0 and 1, respectively. An API could query each of 
the properties as normal. An API would also provide a contextual 
property query, like this:

Resource.getProperty(contextSubject, contextPredicate, property);

I think that contextual properties solve a host of problems relating to 
modeling the world---we've ran into several of them just trying to make 
a vCard RDF ontology. The solution presented here is 100% RDF 1.x 
compatible. It's just that in RDF 2.0 we could make it a more natural 
part of the framework, with more natural serialization and query syntaxes.

If you don't like this proposal, don't worry---it has the proverbial 
snowball chance of going anywhere. But it does meet what I consider to 
be a real need for contextual properties. If you have a better proposal, 
let me know. And if you have suggestions on how to make this proposal 
better, I'd love to hear it.

Garret
Received on Monday, 6 August 2007 17:11:23 GMT

This archive was generated by hypermail 2.3.1 : Tuesday, 26 March 2013 21:45:17 GMT