From W3C Wiki
Revision as of 02:16, 31 August 2011 by Mamundse (Talk | contribs)

(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to: navigation, search

An attempt to hack together the vocabulary necessary to describe affordances. See RdfAffordances


Status : rough proposal

Initial aim is to do just enough to be able to write some running code to try things out. For the setup described further down, the following terms seem to be needed.

Future compatibility with Web Intents is desirable and should be zero cost if we define an Intent as a composite Action, where an Action is a HTTP-level operation.

@prefix rdf: <> .
@prefix rdfs: <> . 
@prefix : <> .

# Classes

:Affordance a rdfs:Class ;
rdfs:label "Affordance";
rdfs:comment "resource description which allows a client to perform an action" .

:Action a rdfs:Class ;
rdfs:subClassOf :Affordance ;
rdfs:label "Action";
rdfs:comment "a HTTP-level affordance" .

:Intent a rdfs:Class ;
rdfs:subClassOf :Affordance ;
rdfs:label "Intent";
rdfs:comment "composite affordance, e.g. edit" .

:Target a rdfs:Class ;
rdfs:label "Target";
rdfs:comment "resource to which an affordance applies" .

:Representation a rdfs:Class ;
rdfs:label "Representation";
rdfs:comment "media type-specific representation of a resource" .

# Properties

:supports a rdf:Property ;
rdfs:label "supports";
rdfs:comment "affordance available at resource" ;
rdfs:domain :Target;
rdfs:range :Affordance .

:method a rdf:Property ;
rdfs:label "method" ;
rdfs:comment "the HTTP method" ;
rdfs:domain rdf:Resource;
rdfs:range rdfs:Literal .

:media a rdf:Property ;
rdfs:label "media" ;
rdfs:comment "supported media type" ;
rdfs:domain rdf:Resource;
rdfs:range rdfs:Literal .

:requires a rdf:Property ;
rdfs:label "requires" ;
rdfs:comment "prerequisite for an affordance" ;
rdfs:domain :Affordance;
rdfs:range rdf:Resource .

:representation a rdf:Property ;
rdfs:label "representation" ;
rdfs:comment "object is a representation of the subject" ;
rdfs:domain :Target;
rdfs:range rdf:Representation .

:content a rdf:Property ;
rdfs:label "content" ;
rdfs:comment "content" ;
rdfs:domain rdf:Representation;
rdfs:range rdf:Literal .

# special affordances - these seem common enough that they should be given an elevated status

:login a rdf:Property ;
rdfs:label "login" ;
rdfs:comment "endpoint through which authorization may be obtained" ;
rdfs:domain :Target;
rdfs:range rdf:Resource .

:sparql a rdf:Property ;
rdfs:label "sparql" ;
rdfs:comment "SPARQL endpoint to a triplestore containing information about the target" ;
rdfs:domain :Target;
rdfs:range rdf:Resource .

Possible setup

I've got a node.js installation that should be ideal for playing with this stuff. A simple Wiki-like setup with NTriple content seems like a reasonable first app. - DannyAyers

While the affordance description RDF could appear anywhere, because this stuff is meant to be interactive then such data ideally needs to be easily available just-in-time in close proximity to the resource it describes. So I'm going to try the following:

Affordance data about e.g.
will be available at

in JSON-LD format. (As far as I can tell the ? is legal and doesn't break anything, seems a reasonable place to put metadata about the resource without the ?).

MCA: Another option for accessing the affordance information associated w/ a URI is to use a protocol-level request on the same URI:

*** REQUEST ***
OPTIONS /active/index HTTP/1.1
Accept: application/json-ld

*** RESPONSE ***

Or provide a URI as control information in the response to the initial request (via Web Linking [RFC5988]):

*** REQUEST ***
GET /active/index HTTP/1.1
Accept: text/turtle
*** RESPONSE ***
200 OK
Content-Type: text/turtle

Sample Data

(will appear in JSON-LD at
# tags the URI as a target
<> a :Target .

# the simplest affordance (well, almost)
<> :supports [
a :Action ;
:method "GET" ;
:media "application/rdf+xml" ; 
:media "text/html" .
] .

# something requiring UI
<> :supports <> .
<> a :Intent ;
# point to the Javascript that'll do the work
:ui <> ;
:requires :Target ;
:requires :Representation .

the representation will contain the "before" part of the edit (the triples in question or whatever) and look something like:

a :Representation ;
:media "text/turtle" ;
:content "<#me> foaf:nick \"danja\" . "

(that " escaping probably isn't correct)

See Also