<?xml version='1.0' encoding='UTF-8'?><?xml-stylesheet href="http://www.blogger.com/styles/atom.css" type="text/css"?><feed xmlns='http://www.w3.org/2005/Atom' xmlns:openSearch='http://a9.com/-/spec/opensearchrss/1.0/' xmlns:blogger='http://schemas.google.com/blogger/2008' xmlns:georss='http://www.georss.org/georss' xmlns:gd="http://schemas.google.com/g/2005" xmlns:thr='http://purl.org/syndication/thread/1.0'><id>tag:blogger.com,1999:blog-7390223865029902668</id><updated>2024-03-08T07:49:45.721-08:00</updated><category term="api"/><category term="discovery"/><category term="docker"/><category term="example"/><category term="lambda"/><category term="node"/><category term="profiles"/><category term="protocols"/><category term="rest"/><category term="standards"/><category term="web"/><title type='text'>jasnell.me</title><subtitle type='html'>- open source, open standards, and the open web</subtitle><link rel='http://schemas.google.com/g/2005#feed' type='application/atom+xml' href='http://chmod777self.blogspot.com/feeds/posts/default'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/7390223865029902668/posts/default?redirect=false'/><link rel='alternate' type='text/html' href='http://chmod777self.blogspot.com/'/><link rel='hub' href='http://pubsubhubbub.appspot.com/'/><link rel='next' type='application/atom+xml' href='http://www.blogger.com/feeds/7390223865029902668/posts/default?start-index=26&amp;max-results=25&amp;redirect=false'/><author><name>jasnell</name><uri>http://www.blogger.com/profile/12993461992320512775</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='https://img1.blogblog.com/img/b16-rounded.gif'/></author><generator version='7.00' uri='http://www.blogger.com'>Blogger</generator><openSearch:totalResults>109</openSearch:totalResults><openSearch:startIndex>1</openSearch:startIndex><openSearch:itemsPerPage>25</openSearch:itemsPerPage><entry><id>tag:blogger.com,1999:blog-7390223865029902668.post-2550893738603643553</id><published>2015-07-31T01:04:00.000-07:00</published><updated>2015-07-31T01:04:02.618-07:00</updated><category scheme="http://www.blogger.com/atom/ns#" term="docker"/><category scheme="http://www.blogger.com/atom/ns#" term="example"/><category scheme="http://www.blogger.com/atom/ns#" term="lambda"/><category scheme="http://www.blogger.com/atom/ns#" term="node"/><title type='text'>Just for fun... Lambda-like Functions with Node.js and Docker</title><content type='html'>&lt;p&gt;Ok, so this one was largely just for fun. I put this together quickly last weekend as a quick demo for an upcoming &lt;a href=&quot;http://www.meetup.com/fresno-node-js/&quot;&gt;Node.js meetup&lt;/a&gt; that will be focusing on Docker.&lt;/p&gt;
&lt;hr /&gt;
&lt;p&gt;RESTful &quot;Lambda Functions&quot; are getting quite a bit of attention lately, largely thanks to the new AWS Lambda service. If you&#39;re not familiar with the concept, a &quot;Lambda Function&quot; is essentially a lightweight stateless REST API endpoint that accepts a POST input and carries out one specific operation in response. They are ideal for handling event notifications or implementing simple single operation request/response type operations. They are also intended to be as ephemeral and stateless as possible.&lt;/p&gt;

&lt;p&gt;While you could choose to make use of Amazon&#39;s new service, it&#39;s possible to get up and running easily with Lamdba functions using nothing but Node.js and your favorite docker container. To help you get started, I created a quick demo and have uploaded it to Github at &lt;a href=&quot;http://github.com/jasnell/lambda&quot;&gt;http://github.com/jasnell/lambda&lt;/a&gt;.&lt;/p&gt;

&lt;p&gt;Step one is to make sure your local Docker environment is set up. If you&#39;re new to Docker and Containers, I recommend that you take a look at the documentation for &lt;a href=&quot;https://www.ng.bluemix.net/docs/containers/container_index.html&quot;&gt;Bluemix Containers&lt;/a&gt;. Sign up for a free trial account and follow the instructions provided on getting set up. &lt;/p&gt;

&lt;p&gt;The next step is to clone the Github repo and build your Docker image from the source:&lt;/p&gt;

&lt;pre&gt;
$&amp;gt; git clone http://github.com/jasnell/lambda.git
$&amp;gt; cd lambda/daemon
$&amp;gt; npm install
$&amp;gt; docker build -t lambda .
&lt;/pre&gt;

&lt;p&gt;This will create the basic lamdba container image. Change to a different directory and create a new &lt;code&gt;lambda.js&lt;/code&gt; file to implement your Lambda function:&lt;/p&gt;

&lt;pre&gt;
exports.handler = function(input, context) {
  // do something with input
  context.succeed({&#39;Hello&#39;:&#39;World&#39;});
  // call context.fail(error) to fail,
  // call context.cancel() to cancel
  // see README.md in the project dir for more detail
}
&lt;/pre&gt;

&lt;p&gt;The lambda.js needs to export a &lt;code&gt;handler&lt;/code&gt; function that accepts two input parameters: &lt;code&gt;input&lt;/code&gt; and &lt;code&gt;context&lt;/code&gt;. The &lt;code&gt;input&lt;/code&gt; is a JSON object passed either within the body of the received HTTP POST or generated from URL-encoded form input. The &lt;code&gt;context&lt;/code&gt; is used to report the status of the function. &lt;/p&gt;

&lt;p&gt;Your Lambda function should be written to be completely stateless and to perform it&#39;s work as quickly as possible. There is a default timeout of 10 seconds. If the work has not been completed within that time, the operation is automatically aborted. You can set a different timeout using an environment variable but that&#39;s getting a bit ahead of ourselves.&lt;/p&gt;

&lt;p&gt;Once your Lambda function is implemented, you can create a new Docker image. First, create your new &lt;code&gt;Dockerfile&lt;/code&gt;:&lt;/p&gt;

&lt;pre&gt;
FROM lambda
COPY lambda.js /usr/src/app/lambda/
EXPOSE 8080
&lt;/pre&gt;

&lt;p&gt;This tells Docker to first use the lambda container image you created above as a starting point, then copy over the new Lambda function that you just created, and expose the Node.js server on port 8080. Next, build your new image:&lt;/p&gt;

&lt;pre&gt;
$&amp;gt; docker build -t lambda-example .
&lt;/pre&gt;

&lt;p&gt;Once your image is built, getting the Lambda function up and running on your preferred Docker environment is as simple as:&lt;/p&gt;

&lt;pre&gt;
$&amp;gt; docker run -p=8080:8080 lambda-example
&lt;/pre&gt;

&lt;p&gt;Once launched, your Lambda function will be running at &lt;code&gt;http://{dockerhost}:8080/&lt;/code&gt;. (Where {dockerhost} is the IP address or host name of your Docker container). You can test it easily using curl:&lt;/p&gt;

&lt;pre&gt;
$&amp;gt; curl --data &quot;abc=xyz&quot; -v http://{dockerhost}:8080/
&lt;/pre&gt;

&lt;p&gt;The demo itself is intentionally pretty simplistic but should be enough to get up and running quickly. If you want to add authentication, Lamdba Functions can provide their own Passport Authentication Strategy by exporting a &lt;code&gt;auth&lt;/code&gt; property (see the &lt;a href=&quot;https://github.com/jasnell/lambda/blob/master/example/lambda.js&quot;&gt;example&lt;/a&gt; to see how). &lt;/p&gt;

&lt;p&gt;While Lamdba functions may not be that complex, they can be quite powerful and scalable when leveraged properly. They can also be easily integrated with other services, such as the workflow and business process services &lt;a href=&quot;https://console.ng.bluemix.net/catalog/&quot;&gt;available on Bluemix&lt;/a&gt;.&lt;/p&gt;
 </content><link rel='replies' type='application/atom+xml' href='http://chmod777self.blogspot.com/feeds/2550893738603643553/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://chmod777self.blogspot.com/2015/07/node-docker-lambda.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/7390223865029902668/posts/default/2550893738603643553'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/7390223865029902668/posts/default/2550893738603643553'/><link rel='alternate' type='text/html' href='http://chmod777self.blogspot.com/2015/07/node-docker-lambda.html' title='Just for fun... Lambda-like Functions with Node.js and Docker'/><author><name>jasnell</name><uri>http://www.blogger.com/profile/12993461992320512775</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='https://img1.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-7390223865029902668.post-5064318393816020225</id><published>2015-05-06T08:56:00.002-07:00</published><updated>2015-05-06T08:58:16.197-07:00</updated><title type='text'>JSON-LD v.Next Wishlist</title><content type='html'>&lt;p&gt;As I&#39;ve been going through a few updates to the Activity Streams 2.0 drafts, I&#39;ve been keeping a log of things I&#39;d really like to see added to the next version of JSON-LD&lt;/p&gt;
&lt;h2&gt;Paging!&lt;/h2&gt;
&lt;p&gt;Right now, Activity Streams has to define it&#39;s own paging model for collections. It would be so much easier if this was built in to JSON-LD.&lt;/p&gt;
&lt;pre&gt;&lt;code&gt;
  {
    &quot;@id&quot;: &quot;http://example.org/foo&quot;,
    &quot;@next&quot;: &quot;http://example.org/foo?p3&quot;,
    &quot;@prev&quot;: &quot;http://example.org/foo?p1&quot;,
    &quot;@first&quot;: &quot;http://example.org/foo&quot;,
    &quot;@last&quot;: &quot;http://example/foo?p9&quot;,
    ...
  }
&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;These would function in pretty much the same way as &lt;a href=&quot;http://www.w3.org/TR/ldp-paging/&quot;&gt;LDP Paging&lt;/a&gt;. That is, the JSON-LD document expands out to a graph, the total graph is the merge of all pages. So, if we&#39;re talking about Activity Streams 2.0, for example:&lt;/p&gt;
&lt;figure&gt;&lt;figcaption&gt;http://example.org/foo:&lt;/figcaption&gt;&lt;pre&gt;&lt;code&gt;
  {
    &quot;@context&quot;: &quot;http://www.w3.org/ns/activitystreams&quot;,
    &quot;@id&quot;: &quot;http://example.org/foo&quot;,
    &quot;@next&quot;: &quot;http://example.org/bar&quot;,
    &quot;items&quot;: [
      {
        &quot;@type&quot;: &quot;Note&quot;,
        &quot;content&quot;: &quot;the first note&quot;
      }
    ]
  }
&lt;/code&gt;&lt;/pre&gt;
&lt;/figure&gt;
&lt;figure&gt;&lt;figcaption&gt;http://example.org/bar:&lt;/figcaption&gt;&lt;pre&gt;&lt;code&gt;
  {
    &quot;@context&quot;: &quot;http://www.w3.org/ns/activitystreams&quot;,
    &quot;@id&quot;: &quot;http://example.org/foo&quot;,
    &quot;@prev&quot;: &quot;http://example.org/foo&quot;,
    &quot;items&quot;: [
      {
        &quot;@type&quot;: &quot;Note&quot;,
        &quot;content&quot;: &quot;the second note&quot;
      }
    ]
  }
&lt;/code&gt;&lt;/pre&gt;
&lt;/figure&gt;
... would be equivalent to:
&lt;figure&gt;&lt;figcaption&gt;http://example.org/foo:&lt;/figcaption&gt;&lt;pre&gt;&lt;code&gt;
  {
    &quot;@context&quot;: &quot;http://www.w3.org/ns/activitystreams&quot;,
    &quot;@id&quot;: &quot;http://example.org/foo&quot;,
    &quot;items&quot;: [
      {
        &quot;@type&quot;: &quot;Note&quot;,
        &quot;content&quot;: &quot;the first note&quot;
      },
      {
        &quot;@type&quot;: &quot;Note&quot;,
        &quot;content&quot;: &quot;the second note&quot;
      }
    ]
  }
&lt;/code&gt;&lt;/pre&gt;
&lt;/figure&gt;
&lt;p&gt;Similar to the how JSON-LD can use either the inline &lt;code&gt;@context&lt;/code&gt; or context Link header, the paging link headers could also be used. Nice and simple.&lt;/p&gt;
&lt;h2&gt;Qualified Statement Support&lt;/h2&gt;
&lt;p&gt;RDF has this notion of a qualified statement. In Activity Streams 2.0, we use the as:Link object type for this. What I&#39;d like to see in the next version of JSON-Ld is something like:&lt;/p&gt;
&lt;pre&gt;&lt;code&gt;
  {
    &quot;@context&quot;: [
      &quot;http://www.w3.org/ns/activitystreams&quot;,
      {
        &quot;foo&quot;: {
          &quot;@id&quot;: &quot;http://example.org/foo&quot;,
          &quot;@type&quot;: &quot;@statement&quot;
        }
      }
    ],
    &quot;@id&quot;: &quot;http://example.org/A/Thing&quot;,
    &quot;foo&quot;: {
      &quot;@id&quot;: &quot;http://example.org/Reference&quot;,
      &quot;@ref&quot;: &quot;http://example.org/Another/Thing&quot;,
      &quot;displayName&quot;: &quot;A reference to another thing&quot;
    }
  }
&lt;/pre&gt;
&lt;/code&gt;
&lt;p&gt;In the equivalent turtle representation, this would look something like:&lt;/p&gt;
&lt;pre&gt;&lt;code&gt;
  &amp;lt;http://example.org/Reference&amp;gt; a rdf:Statement ;
    rdf:subject &amp;lt;http://example.org/A/Thing&amp;gt; ;
    rdf:predicate &amp;lt;http://example.org/foo&amp;gt; ;
    rdf:object &amp;lt;http://example.org/Another/Thing&amp;gt; ;
    as:displayName &quot;A reference to another thing&quot; .
&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;That&#39;s it for now. May add more as I go along.&lt;/p&gt;
</content><link rel='replies' type='application/atom+xml' href='http://chmod777self.blogspot.com/feeds/5064318393816020225/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://chmod777self.blogspot.com/2015/05/json-ld-vnext-wishlist.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/7390223865029902668/posts/default/5064318393816020225'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/7390223865029902668/posts/default/5064318393816020225'/><link rel='alternate' type='text/html' href='http://chmod777self.blogspot.com/2015/05/json-ld-vnext-wishlist.html' title='JSON-LD v.Next Wishlist'/><author><name>jasnell</name><uri>http://www.blogger.com/profile/12993461992320512775</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='https://img1.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-7390223865029902668.post-235590443746217420</id><published>2015-03-25T11:59:00.000-07:00</published><updated>2015-03-25T11:59:28.758-07:00</updated><title type='text'>An Update on Me</title><content type='html'>&lt;p&gt;On January 1st of this year I took on a new role as IBM&#39;s Technical Lead for Node.js. Needless to say, it&#39;s been keeping me rather busy.&lt;/p&gt;&lt;br /&gt;
&lt;p&gt;First, what exactly does the new role entail? Well, IBM has been starting to do quite a bit with Node.js. We&#39;ve &lt;a href=&quot;http://www.ibm.com/developerworks/web/nodesdk/&quot;&gt;ported it to System Z and Power&lt;/a&gt;, for instance. We provide Node.js support on &lt;a href=&quot;http://bluemix.net&quot;&gt;Bluemix&lt;/a&gt;. We&#39;ve integrated Node.js directly into &lt;a href=&quot;http://www-01.ibm.com/support/knowledgecenter/SS9H2Y_7.0.0/com.ibm.dp.xg.doc/gatewayscript_development_reference.html?lang=en&quot;&gt;products&lt;/a&gt;. And more recently, we stepped up to help launch the &lt;a href=&quot;https://www.joyent.com/blog/introducing-the-nodejs-foundation&quot;&gt;Node.js Foundation&lt;/a&gt;. My new role is essentially to help coordinate IBM&#39;s engagement with the Node.js Community as a whole. This means not only working inside IBM but also with the Node.js project externally helping to fix bugs, update dependencies, improve performance, improve internationalization, and so forth.&lt;/p&gt;&lt;br /&gt;
&lt;p&gt;I&#39;ll still be working on Activity Streams 2.0 stuff while that is progressing through the W3C recommendation process but more and more the things I post here will be focused on Node.js, starting with this: The draft Node.js Foundation Technical Governance documents are available for public review and comment... https://github.com/joyent/nodejs-advisory-board/pull/30. If you&#39;ve got an interest in Node.js, it&#39;s worth taking a look. I&#39;ll be back later with more details.&lt;/p&gt;</content><link rel='replies' type='application/atom+xml' href='http://chmod777self.blogspot.com/feeds/235590443746217420/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://chmod777self.blogspot.com/2015/03/an-update-on-me.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/7390223865029902668/posts/default/235590443746217420'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/7390223865029902668/posts/default/235590443746217420'/><link rel='alternate' type='text/html' href='http://chmod777self.blogspot.com/2015/03/an-update-on-me.html' title='An Update on Me'/><author><name>jasnell</name><uri>http://www.blogger.com/profile/12993461992320512775</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='https://img1.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-7390223865029902668.post-6336956775605612834</id><published>2015-01-08T15:24:00.001-08:00</published><updated>2015-01-09T08:57:58.281-08:00</updated><title type='text'>Activity Streams Update, Where we&#39;re at now</title><content type='html'>&lt;p&gt;Back in October, the W3C Social Web Working Group published the &lt;a href=&quot;http://www.w3.org/TR/activitystreams-core/&quot;&gt;First Public Working Draft of Activity Streams 2.0&lt;/a&gt;. Since that first draft, quite a bit of additional work has been done and I think we&#39;re &lt;i&gt;almost&lt;/i&gt; about ready to get another draft out. The current Editor&#39;s Drafts can be found &lt;a href=&quot;http://jasnell.github.io/w3c-socialwg-activitystreams/activitystreams2.html&quot;&gt;here&lt;/a&gt; and &lt;a href=&quot;http://jasnell.github.io/w3c-socialwg-activitystreams/activitystreams2-vocabulary.html&quot;&gt;here&lt;/a&gt;.&lt;/p&gt;&lt;br /&gt;
&lt;p&gt;There are a number of key changes&lt;/p&gt;&lt;br /&gt;
&lt;h2&gt;A Real Namespace URI, OWL Ontology and Updated JSON-LD Context&lt;/h2&gt;&lt;br /&gt;
&lt;p&gt;The Social WG decided that the official namespace URI for Activity Streams 2.0 will be &quot;&lt;code&gt;http://www.w3.org/ns/activitystreams#&lt;/code&gt;&quot;. This will (eventually) also be the location of the JSON-LD context document, but for now, you can find the latest version of the JSON-LD context at &lt;a href=&quot;http://asjsonld.mybluemix.net&quot;&gt;&quot;&lt;code&gt;http://asjsonld.mybluemix.net&lt;/code&gt;&quot;&lt;/a&gt;. There is also an OWL/Turtle Ontology definition for the Activity Streams Vocabulary available &lt;a href=&quot;http://jasnell.github.io/w3c-socialwg-activitystreams/activitystreams2.owl&quot;&gt;here&lt;/a&gt;.&lt;/p&gt;&lt;br /&gt;
&lt;h2&gt;Changes to the Syntax Model&lt;/h2&gt;&lt;br /&gt;
&lt;p&gt;The Activity Streams 2.0 specification is divided into two parts. The first part is the main syntax model, described &lt;a href=&quot;http://jasnell.github.io/w3c-socialwg-activitystreams/activitystreams2.html&quot;&gt;here&lt;/a&gt;. The model has been revised since the First Public Working Draft to better align with JSON-LD mechanisms. Natural Language Values have been refactored, the definition of Link has been updated, the Actor and OrderedCollection classes have been introduced, and the handling of extensions on non-JSON-LD compatible mechanisms has been dealt with.&lt;/p&gt;&lt;br /&gt;
&lt;h3&gt;Natural Language Values&lt;/h3&gt;&lt;br /&gt;
&lt;p&gt;The changes to Natural Language Values are straightforward and are directly related to how JSON-LD algorithms deal with language context. Previously, language-sensitive properties such as &quot;displayName&quot; could have a value that was &lt;i&gt;either&lt;/i&gt; a string or a JSON-LD language map. This, however, was a bit problematic because the JSON-LD algorithms could not deal with values that were optionally language tagged -- they either are language tagged or they are not. In order to address that issue, the JSON-LD context was modified so that language tagged values use a different naming convention as illustrated below.&lt;/p&gt;&lt;br /&gt;
&lt;figure&gt;&lt;figcaption&gt;Previously, we had this:&lt;/figcaption&gt;&lt;br /&gt;
&lt;pre&gt;&lt;code&gt;{
  &quot;displayName&quot;: {
    &quot;en&quot;: &quot;Foo&quot;,
    &quot;sp&quot;: &quot;Bar&quot;
  }
}&lt;/code&gt;&lt;/pre&gt;&lt;/figure&gt;&lt;br /&gt;
&lt;br /&gt;
&lt;figure&gt;&lt;figcaption&gt;Now, we have this:&lt;/figcaption&gt;&lt;br /&gt;
&lt;pre&gt;&lt;code&gt;{
  &quot;displayNameMap&quot;: {
    &quot;en&quot;: &quot;Foo&quot;,
    &quot;sp&quot;: &quot;Bar&quot;
  }
}&lt;/code&gt;&lt;/pre&gt;&lt;/figure&gt;&lt;br /&gt;
&lt;br /&gt;
When processed using the Activity Streams 2.0 JSON-LD context, the generated triples come out as:&lt;br /&gt;
&lt;br /&gt;
&lt;figure&gt;&lt;figcaption&gt;&lt;/figcaption&gt;&lt;pre&gt;&lt;code&gt;
_:c14n0 &amp;lt;http://www.w3.org/ns/activitystreams#displayName&gt; &quot;Foo&quot;@en .
_:c14n0 &amp;lt;http://www.w3.org/ns/activitystreams#displayName&gt; &quot;Bar&quot;@sp .
&lt;/code&gt;&lt;/pre&gt;&lt;/figure&gt;&lt;br /&gt;
&lt;br /&gt;
&lt;p&gt;If there&#39;s no language tagging, you&#39;d just use &quot;displayName&quot;:&lt;/p&gt;&lt;figure&gt;&lt;figcaption&gt;&lt;/figcaption&gt;&lt;br /&gt;
&lt;pre&gt;&lt;code&gt;{
  &quot;displayName&quot;: &quot;Foo&quot;
}&lt;/code&gt;&lt;/pre&gt;&lt;/figure&gt;&lt;br /&gt;
&lt;br /&gt;
When processed using the Activity Streams 2.0 JSON-LD context, the generated triples come out as:&lt;br /&gt;
&lt;br /&gt;
&lt;figure&gt;&lt;figcaption&gt;&lt;/figcaption&gt;&lt;pre&gt;&lt;code&gt;
_:c14n0 &amp;lt;http://www.w3.org/ns/activitystreams#displayName&gt; &quot;Foo&quot; .
&lt;/code&gt;&lt;/pre&gt;&lt;/figure&gt;&lt;br /&gt;
&lt;br /&gt;
&lt;p&gt;It&#39;s a subtle but important change. The fields affected include &lt;code&gt;displayName&lt;/code&gt;, &lt;code&gt;title&lt;/code&gt;, &lt;code&gt;summary&lt;/code&gt; and &lt;code&gt;content&lt;/code&gt;.&lt;/p&gt;&lt;h3&gt;Links&lt;/h3&gt;&lt;p&gt;The model for Links has been further refined but isn&#39;t largely different from what was published in the First Public Working Draft. The most significant change is the fact that a Link cannot also be an Object. A Link is just an indirect reference so some other kind of resource. The model is closely related to the model of Links defined in RFC 5988.&lt;/p&gt;&lt;h2&gt;Expanded Vocabulary&lt;/h2&gt;&lt;p&gt;The single most significant change since FPWD is the introduction of the &quot;Extended Vocabulary&quot;. This is essentially an updated and refactored version of the original &lt;a href=&quot;https://github.com/activitystreams/activity-schema/blob/master/activity-schema.md&quot;&gt;Activity Streams 1.0 Base Schema&lt;/a&gt;. For those who have followed Activity Streams 1.0 for a while, the Base Schema should be familiar... it is the informal documentation for many of the core Verbs, Object Types and Extensions that are common across many Activity Streams implementations. The Activity Streams 2.0 Extended Vocabulary updates and refines these around the new model. I&#39;d show some examples here but the &lt;a href=&quot;http://jasnell.github.io/w3c-socialwg-activitystreams/activitystreams2-vocabulary.html&quot;&gt;Vocabulary&lt;/a&gt; draft itself has 920 individual examples already that have been added that illustrate the use of the Activity Streams 2.0 vocabulary in JSON-LD, Microdata, RDFa, Microformats and Turtle. The selection of items in the Extended Vocabulary has been largely driven by real world social use cases as documented on &lt;a href=&quot;https://www.w3.org/wiki/Activity_Streams/Expanded_Vocabulary&quot;&gt;the wiki&lt;/a&gt;.&lt;/p&gt;&lt;p&gt;Hopefully the WG will publish an updated official Working Draft soon. But until then, feedback on the Editor&#39;s Draft is always greatly appreciated.&lt;/p&gt;</content><link rel='replies' type='application/atom+xml' href='http://chmod777self.blogspot.com/feeds/6336956775605612834/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://chmod777self.blogspot.com/2015/01/activity-streams-update-where-were-at.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/7390223865029902668/posts/default/6336956775605612834'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/7390223865029902668/posts/default/6336956775605612834'/><link rel='alternate' type='text/html' href='http://chmod777self.blogspot.com/2015/01/activity-streams-update-where-were-at.html' title='Activity Streams Update, Where we&#39;re at now'/><author><name>jasnell</name><uri>http://www.blogger.com/profile/12993461992320512775</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='https://img1.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-7390223865029902668.post-2491432766584151966</id><published>2014-10-23T10:30:00.000-07:00</published><updated>2014-10-23T11:02:06.562-07:00</updated><title type='text'>W3C Activity Streams - First Public Working Draft</title><content type='html'>&lt;p&gt;I&#39;m very happy to report that the W3C Social Web Working Group&#39;s &lt;a href=&quot;http://www.w3.org/TR/activitystreams-core/&quot;&gt;First Public Working Draft of Activity Streams 2.0&lt;/a&gt; has been published. For those of you who have been &lt;a href=&quot;https://datatracker.ietf.org/doc/draft-snell-activitystreams/&quot;&gt;tracking the evolution&lt;/a&gt; of Activity Streams 2.0, this represents an important and exciting new milestone: Activity Streams 2.0 is now one critical step closer to becoming a W3C Recommendation.&lt;/p&gt;

&lt;p&gt;So you may be wondering, what&#39;s new in the First Public Working Draft. The answer is: quite a bit.&lt;/p&gt;

&lt;h2&gt;Focus on Linked Data&lt;/h2&gt;

&lt;p&gt;One of the most critical changes made by the Social Web Working Group is that Activity Streams is now formally defined as a Web Ontology as described by the &lt;a href=&quot;http://www.w3.org/TR/activitystreams-vocabulary/&quot;&gt;Activity Vocabulary specification&lt;/a&gt;. This document establishes the set of abstract classes and associated terms that make up the Activity Streams ontology. &lt;a href=&quot;http://www.w3.org/TR/json-ld/&quot;&gt;JSON-LD&lt;/a&gt; is currently defined as the &lt;a href=&quot;http://www.w3.org/TR/activitystreams-core/&quot;&gt;serialization&lt;/a&gt; for the Activity Streams vocabulary. For those of you currently using Activity Streams 1.0, don&#39;t worry: the ontology and JSON-LD serialization have been designed so that all valid Activity Streams 1.0 documents are still valid Activity Streams 2.0 documents.&lt;/p&gt;

&lt;p&gt;&lt;mark&gt;Note: the current &lt;i&gt;development&lt;/i&gt; version of the Activity Streams JSON-LD @context is hosted at &lt;a href=&quot;http://asjsonld.mybluemix.net&quot;&gt;http://asjsonld.mybluemix.net&lt;/a&gt;. Also, the &lt;code&gt;http://activitystrea.ms/2.0/&lt;/code&gt; Namespace URI is likely temporary. It will likely change to a proper W3C Namespace URI in the next published working draft.&lt;/mark&gt;&lt;/p&gt;

&lt;figure&gt;&lt;figcaption&gt;For example, let&#39;s suppose that &quot;Sally&quot; likes the AS 2.0 First Public Working Draft:&lt;/figcaption&gt;
&lt;pre&gt;{
  &quot;@context&quot;: &quot;http://asjsonld.mybluemix.net&quot;,
  &quot;actor&quot;: {
    &quot;@type&quot;: &quot;foaf:Agent&quot;,
    &quot;@id&quot;: &quot;acct:sally@example.org&quot;,
    &quot;displayName&quot;: &quot;Sally&quot;,
  },
  &quot;verb&quot;: &quot;like&quot;,
  &quot;object&quot;: {
    &quot;@type&quot;: &quot;as:Link&quot;,
    &quot;@id&quot;: &quot;http://www.w3.org/TR/2014/WD-activitystreams-core-20141023/&quot;,
    &quot;displayName&quot;: &quot;Activity Streams 2.0&quot;
  }
}&lt;/pre&gt;&lt;/figure&gt;

&lt;p&gt;The example ought to be pretty straightforward and should look familiar to anyone who is already familiar with Activity Streams 1.0 or JSON-LD. However, the fact that AS 2.0 has been defined as a Web Ontology allows us to do something that previously was not possible with Activity Streams: we can represent the exact same data using HTML5 Microdata:&lt;/p&gt;

&lt;figure&gt;
&lt;pre&gt;&amp;lt;div itemscope itemtype=&quot;http://activitystrea.ms/2.0/Activity&quot;&gt;
  &amp;lt;link itemprop=&quot;actor&quot; itemscope 
        itemtype=&quot;http://xmlns.com/foaf/0.1/Agent&quot; 
        href=&quot;acct:sally@example.org&gt;
    &amp;lt;span itemprop=&quot;displayName&quot;&gt;Sally&amp;lt;/span&gt;
  &amp;lt;/link&gt;
  &amp;lt;link itemprop=&quot;verb&quot; href=&quot;_:like&quot;&gt;liked&amp;lt;/link&gt;
  &amp;lt;a itemprop=&quot;object&quot; itemscope
     itemtype=&quot;http://activitystrea.ms/2.0/Link&quot;
     href=&quot;http://www.w3.org/TR/2014/WD-activitystreams-core-20141023/&quot;&gt;
    &amp;lt;span itemprop=&quot;displayName&quot;&gt;Activity Streams 2.0&amp;lt;/span&gt;
  &amp;lt;/a&gt;
&amp;lt;/div&gt;&lt;/pre&gt;
&lt;/figure&gt;

&lt;p&gt;Or even using RDFa:&lt;/p&gt;

&lt;figure&gt;
&lt;pre&gt;&amp;lt;div vocab=&quot;http://activitystrea.ms/2.0/&quot; 
     prefix=&quot;foaf: http://xmlns.com/foaf/0.1/&quot;  
     typeof=&quot;Activity&quot;&gt;
  &amp;lt;link property=&quot;actor&quot; 
        typeof=&quot;foaf:Agent&quot; 
        href=&quot;acct:sally@example.org&gt;
    &amp;lt;span property=&quot;displayName&quot;&gt;Sally&amp;lt;/span&gt;
  &amp;lt;/link&gt;
  &amp;lt;link property=&quot;verb&quot; href=&quot;_:like&quot;&gt;liked&amp;lt;/link&gt;
  &amp;lt;a property=&quot;object&quot;
     typeof=&quot;Link&quot;
     href=&quot;http://www.w3.org/TR/2014/WD-activitystreams-core-20141023/&quot;&gt;
    &amp;lt;span property=&quot;displayName&quot;&gt;Activity Streams 2.0&amp;lt;/span&gt;
  &amp;lt;/a&gt;
&amp;lt;/div&gt;&lt;/pre&gt;
&lt;/figure&gt;

&lt;p&gt;We can even break this down further and represent the data model using Turtle:&lt;/p&gt;

&lt;figure&gt;
&lt;pre&gt;@prefix as: &amp;lt;http://activitystrea.ms/2.0/&gt; .
@prefix foaf: &amp;lt;http://xmlns.com/foaf/0.1/&gt; .

&amp;lt;_:c1&gt; a as:Activity ;
     as:actor &amp;lt;acct:sally@example.org&gt; ;
     as:verb &amp;lt;_:like&gt; ;
     as:object &amp;lt;http://example.org/articles/1&gt; .

&amp;lt;acct:sally@example.org&gt; a foaf:Agent ;
     as:displayName &quot;Sally&quot;@en .

&amp;lt;http://www.w3.org/TR/2014/WD-activitystreams-core-20141023/&gt; a as:Link ;
     as:displayName &quot;Activity Streams 2.0&quot;@en .&lt;/pre&gt;
&lt;/figure&gt;

&lt;p&gt;The flexibility the new Activities Vocabulary affords developers can be extremely powerful. For one, as illustrated the examples above, it allows the Activities data model to be represented in a range of different ways depending on whatever developers need. Second, it allows developers to directly leverage other Web Ontologies such as Friend of a Friend, vCard, Schema.org, the W3C&#39;s Org Ontology, Geo location, and so forth. Whereas Activity Streams 1.0 previous started down the path of &lt;a href=&quot;https://github.com/activitystreams/activity-schema/blob/master/activity-schema.md&quot;&gt;defining it&#39;s own vocabularies&lt;/a&gt; for things like Person, Location, etc, the focus in Activity Streams 2.0 is to allow implementors to use as many existing &quot;paved roads&quot; as possible.&lt;/p&gt;

&lt;p&gt;For instance, consider the following example:&lt;/p&gt;

&lt;figure&gt;
&lt;pre&gt;{
  &quot;@context&quot;: &quot;http://asjsonld.mybluemix.net&quot;,
  &quot;actor&quot;: {
    &quot;@id&quot;: &quot;acct:sally@example.org&quot;,
    &quot;@type&quot;: &quot;foaf:Agent&quot;,
    &quot;displayName&quot;: &quot;Sally&quot;, 
    &quot;location&quot;: {
      &quot;@type&quot;: &quot;geo:Point&quot;,
      &quot;geo:lat&quot;: 36.7468422,
      &quot;geo:long&quot;: -119.7725868
    },
    &quot;verb&quot;: &quot;like&quot;,
    &quot;object&quot;: {
      &quot;@context&quot;: {
        &quot;gr&quot;: &quot;http://purl.org/goodrelations/v1#&quot;
      },
      &quot;@type&quot;: &quot;gr:Brand&quot;,
      &quot;gr:name&quot;: &quot;IBM&quot;,
      &quot;url&quot;: &quot;http://ibm.com&quot;
    }
  }
}&lt;/pre&gt;
&lt;/figure&gt;

&lt;p&gt;Here we see a mixing of Activity Streams, the W3C Basic Geo Vocabulary, FOAF, and the Good Relations Ontology. Everything just fits and works together.&lt;/p&gt;

&lt;h2&gt;Refining the Link Model&lt;/h2&gt;

&lt;p&gt;If you&#39;ve been following the Activity Streams 2.0 evolution, you&#39;ll be aware that a few iterations ago I had introduced the notions of &quot;Link Value&quot; and &quot;Type Value&quot;. These were added because, at the time, Activity Streams 2.0 was not quite yet fully compatible with the JSON for Linked Data model and I needed to introduce a kind of bridge between the pure JSON and Linked Data JSON world views. Now that Activity Streams 2.0 is fully JSON-LD, these concepts are no longer necessary. The idea of a Type Value has been removed and Link Values have been refined into a &quot;Link&quot; class. The way this Link class works is simple: If an object is marked as &quot;@type&quot;: &quot;as:Link&quot;, it means that the object&#39;s global identifier (specified by the JSON-LD &lt;code&gt;@id&lt;/code&gt; property) is a dereferenceable URI, and that the object can have an additional set of properties such as &lt;code&gt;rel&lt;/code&gt;, &lt;code&gt;hreflang&lt;/code&gt;, &lt;code&gt;mediaType&lt;/code&gt;, etc. The model is heavily influenced and aligned with &lt;a href=&quot;https://tools.ietf.org/html/rfc5988&quot;&gt;RFC 5988&lt;/a&gt;. We&#39;ve already seen an example of this in the examples shown above.&lt;/p&gt;

&lt;figure&gt;&lt;figcaption&gt;For instance, here is how you would describe a Link to the Activity Streams 2.0 JSON-LD @context:&lt;/figcaption&gt;
&lt;pre&gt;{
  &quot;@context&quot;: &quot;http://asjsonld.mybluemix.net&quot;,
  &quot;@type&quot;: &quot;as:Link&quot;,
  &quot;@id&quot;: &quot;http://asjsonld.mybluemix.net&quot;,
  &quot;displayName&quot;: &quot;The Activity Streams 2.0 JSON-LD @context&quot;,
  &quot;mediaType&quot;: &quot;application/ld+json&quot;,
  &quot;hreflang&quot;: &quot;en&quot;
}&lt;/pre&gt;&lt;/figure&gt;

&lt;p&gt;In JSON-LD, any single object can have multiple types. so it&#39;s possible to do something like:&lt;/p&gt;

&lt;figure&gt;&lt;pre&gt;{
  &quot;@context&quot;: &quot;http://asjsonld.mybluemix.net&quot;,
  &quot;@type&quot;: [&quot;as:Link&quot;, &quot;foaf:Agent&quot;],
  &quot;@id&quot;: &quot;http://example.org/profiles/Sally&quot;,
  &quot;displayName&quot;: &quot;Sally&quot;
}&lt;/pre&gt;&lt;/figure&gt;

&lt;p&gt;In this case, the object is marked as being both a foaf:Agent and an as:Link. The as:Link serves as a marker indicating that the global identifier given by the &lt;code&gt;@id&lt;/code&gt; property should be considered dereferenceable.&lt;/p&gt;

&lt;h2&gt;Compatibility with Activity Streams 1.0&lt;/h2&gt;

&lt;p&gt;One of the nicest things about the Activity Streams 2.0 vocabulary and JSON-LD serialization is that it is defined, as much as possible, to ensure that all valid Activity Streams 1.0 documents are still valid Activity Streams 2.0 documents (However, it is important to note that the reverse is not true). The &lt;code&gt;objectType&lt;/code&gt; and &lt;code&gt;id&lt;/code&gt; properties used by 1.0 are defined as aliases of the JSON-LD &lt;code&gt;@type&lt;/code&gt; and &lt;code&gt;@id&lt;/code&gt; properties, respectively. All of the existing verb and objectType definitions used in AS 1.0 documents carry over easily to 2.0. And many of the extensions ought to be preserved so long as they do not violate the constraints of the JSON-LD data format (one important exception are extensions based on the GeoJSON vocabulary, which is not currently not compatible with JSON-LD). While it would be a good idea for existing implementers to upgrade their applications to the 2.0 syntax, doing so is not critical, and existing Activity Streams 1.0 documents should continue to work with no problem in 2.0 implementations.&lt;/p&gt;

&lt;h2&gt;What&#39;s Next: Potential Actions&lt;/h2&gt;

&lt;p&gt;For this First Public Working Draft, the Social Web Working Group decided to hold back on the &quot;Action Handlers&quot; piece. That&#39;s still a work in progress that I, personally, am hoping will move forward in the next few weeks. If you&#39;ve been tracking my previous efforts on Action Handlers, it&#39;s worth noting that there have been some very significant &lt;a href=&quot;http://jasnell.github.io/w3c-socialwg-activitystreams/activitystreams2-actions.html&quot;&gt;recent modifications&lt;/a&gt; to the model.&lt;/p&gt;

&lt;p&gt;For example, the following describes an article object with &quot;Save&quot;, &quot;Like&quot; and &quot;Share&quot; actions:&lt;/p&gt;

&lt;figure&gt;&lt;pre&gt;{
  &quot;@context&quot;: &quot;http://asjsonld.mybluemix.net&quot;,
  &quot;@type&quot;: &quot;http://schema.org/Article&quot;,
  &quot;displayName&quot;: &quot;An Article&quot;,
  &quot;action&quot;: [
    {
      &quot;@type&quot;: &quot;urn:example:actions:Save&quot;,
      &quot;displayName&quot;: &quot;Save&quot;, 
      &quot;using&quot;: {
        &quot;@type&quot;: &quot;as:HttpRequest&quot;,
        &quot;method&quot;: &quot;POST&quot;,
        &quot;url&quot;: &quot;http://api.example.org/save?id=123&quot;
      }
    },
    {
      &quot;@type&quot;: &quot;urn:example:actions:Like&quot;,
      &quot;displayName&quot;: &quot;Like&quot;,
      &quot;using&quot;:
        {
          &quot;@type&quot;: &quot;as:HttpRequest&quot;,
          &quot;method&quot;: &quot;POST&quot;,
          &quot;url&quot;: &quot;http://api.example.org/like?id=123&quot;
        }
    },
    {
      &quot;@type&quot;: &quot;urn:example:actions:Share&quot;,
      &quot;displayName&quot;: &quot;Share&quot;,
      &quot;using&quot;: {
        &quot;@type&quot;: &quot;as:EmbeddedView&quot;,
        &quot;mediaType&quot;: &quot;text/html&quot;,
        &quot;content&quot;: &quot;&amp;lt;div&gt;...&amp;lt;/div&gt;&quot;
      }
    }
  ]
}&lt;/pre&gt;&lt;/figure&gt;

&lt;p&gt;The new &quot;Potential Actions&quot; model has been designed to be more compatible with that defined by the &lt;a href=&quot;https://schema.org/Action&quot;&gt;schema.org/Action&lt;/a&gt; model without introducing any direct dependencies on schema.org. What this means is that implementers who want to leverage the schema.org/Action model can do so without forcing that one particular model on everyone else. Choice is a very good thing.&lt;/p&gt;

&lt;p&gt;I&#39;ll hopefully have some more good news on the Potential Actions front in a few weeks.&lt;/p&gt;

&lt;p&gt;For now, I recommend that you all go out and take a look at the Activity Streams 2.0 First Public Working Draft. Write code, test it out, deploy software, have fun. Then let the Social WG know what does or does not work so we can make sure things are moving in the right direction.&lt;/p&gt;</content><link rel='replies' type='application/atom+xml' href='http://chmod777self.blogspot.com/feeds/2491432766584151966/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://chmod777self.blogspot.com/2014/10/w3c-activity-streams-first-public.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/7390223865029902668/posts/default/2491432766584151966'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/7390223865029902668/posts/default/2491432766584151966'/><link rel='alternate' type='text/html' href='http://chmod777self.blogspot.com/2014/10/w3c-activity-streams-first-public.html' title='W3C Activity Streams - First Public Working Draft'/><author><name>jasnell</name><uri>http://www.blogger.com/profile/12993461992320512775</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='https://img1.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-7390223865029902668.post-3681332445293418371</id><published>2014-09-30T08:51:00.001-07:00</published><updated>2014-09-30T08:53:17.435-07:00</updated><title type='text'>Activity and Actions Vocabulary Examples</title><content type='html'>&lt;p&gt;Below is a &lt;a href=&quot;http://lists.w3.org/Archives/Public/public-socialweb/2014Sep/0139.html&quot;&gt;copy of a note&lt;/a&gt; I sent to the W3C Social WG mailing list... copied here so others can comments&lt;/p&gt;
&lt;hr/&gt;

&lt;p&gt;As a follow up to &lt;a href=&quot;http://lists.w3.org/Archives/Public/public-socialweb/2014Sep/0136.html&quot;&gt;my note yesterday&lt;/a&gt;, I wanted to provide a few examples that illustrate the changes that were made. These examples are primarily going to focus on the use of JSON-LD, but I will also show some examples using other serializations, including RDFa, Microdata and a hypothetical Microformats mapping.&lt;/p&gt;

&lt;p&gt;First, a few notes:&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;The &quot;id&quot; attribute is defined as an alias of JSON-LD&#39;s &quot;@id&quot;, so in the JSON-LD examples, I&#39;m using the &quot;@id&quot;&lt;/li&gt;
&lt;li&gt;&quot;objectType&quot; is defined as an alias of JSON-LD &quot;@type&quot;, so the examples will use &quot;@type&quot;&lt;/li&gt;
&lt;li&gt;&quot;language&quot; is defined as an alias of JSON-LD &quot;@language&quot;, so the examples will use &quot;@language&quot;&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;To start this off, let&#39;s look first at a basic Activity might look like prior to these changes. This *old* example makes use of several bits that were controversial. I&#39;m using this example so I can contrast the changes that have been made.&lt;/p&gt;

&lt;figure&gt;&lt;figcaption&gt;Ex.A:&lt;/figcaption&gt;
&lt;pre&gt;&lt;code&gt;  {
    &quot;id&quot;: &quot;urn:example:activity:1&quot;,
    &quot;actor&quot;: {
      &quot;objectType&quot;: &quot;person&quot;,
      &quot;id&quot;: &quot;urn:example:person:1&quot;,
      &quot;displayName&quot;: &quot;Sally Smith&quot;
    },
    &quot;verb&quot;: {
      &quot;@id&quot;: &quot;urn:example:verbs:edit&quot;,
      &quot;displayName&quot;: &quot;Edit&quot;
    },
    &quot;object&quot;: {
      &quot;objectType&quot;: {
        &quot;id&quot;: &quot;urn:example:objectTypes:note&quot;,
        &quot;displayName&quot;: &quot;Note&quot;
      },
      &quot;content&quot;: &quot;This is the content&quot;,
      &quot;mediaType&quot;: &quot;text/html&quot;,
      &quot;url&quot;: &quot;http://example.org/notes/1&quot;,
      &quot;self&quot;: &quot;http://api.example.org/notes/1.json&quot;,
      &quot;icon&quot;: {
        &quot;objectType&quot;: &quot;urn:example:objectTypes:icon&quot;,
        &quot;url&quot;: &quot;http://example.org/assets/note.png&quot;
      }
    }
  }&lt;/code&gt;&lt;/pre&gt;&lt;/figure&gt;

&lt;p&gt;In this example, we see use of the Type Value and Link Value constructs, the use of Link Relations as attribute names, and the use of an Object value for &quot;icon&quot;.&lt;/p&gt;

&lt;p&gt;In the updated vocabulary model, the Type Value construct goes away, Link Value&#39;s are redefined, and Link Relations are no longer mixed in with the object property names. Also, the value of the &quot;verb&quot; property is a Verb object, which (in JSON-LD) can be expressed as either a simple IRI or a JSON object. In the new vocabulary model, this example would be expressed as:&lt;/p&gt;

&lt;figure&gt;&lt;figcaption&gt;Ex.B:&lt;/figcaption&gt;
&lt;pre&gt;&lt;code&gt;  {
    &quot;@id&quot;: &quot;urn:example:activity:1&quot;,
    &quot;actor&quot;: {
      &quot;@type&quot;: &quot;http://activitystrea.ms/1.0/person&quot;,
      &quot;@id&quot;: &quot;urn:example:person:1&quot;,
      &quot;displayName&quot;: &quot;Sally Smith&quot;
    },
    &quot;verb&quot;: {
      &quot;@id&quot;: &quot;urn:example:verbs:edit&quot;,
      &quot;displayName&quot;: &quot;Edit&quot;
    },
    &quot;object&quot;: {
      &quot;@type&quot;: &quot;urn:example:objectTypes:note&quot;,
      &quot;content&quot;: &quot;This is the content&quot;,
      &quot;url&quot;: [
        {
          &quot;@id&quot;: &quot;http://example.org/notes/1&quot;,
          &quot;mediaType&quot;: &quot;text/html&quot;
        }
        {
          &quot;@id&quot;: &quot;http://api.example.org/notes/1.json&quot;,
          &quot;mediaType&quot;: &quot;application/activity+json&quot;,
          &quot;rel&quot;: &quot;self&quot;
        }
      ],
      &quot;icon&quot;: &quot;http://example.org/assets/note.png&quot;
    }
  }&lt;/code&gt;&lt;/pre&gt;&lt;/figure&gt;

&lt;p&gt;Note the structural changes on &quot;url&quot;. In the Vocabulary, there is a Link class. The Link class defines a link to some other resource. Unlike in the previous version, Links are *not* Objects. Link&#39;s have a target URL which is expressed as the Link instance&#39;s &quot;@id&quot;. Links can also have &quot;rel&quot; and &quot;mediaType&quot; attributes.&lt;/p&gt;

&lt;p&gt;In the vocabulary, the &quot;url&quot;, &quot;icon&quot; and &quot;image&quot; properties in particular have been changed so that their values are strictly Links. (Some of the other properties on Object and Activity can take either Object or Link as their value). There are no cardinality restraints on the &quot;url&quot;, &quot;icon&quot; and &quot;image&quot; properties so any one object can have 1 or more values for each. Because of the way JSON-LD serialization works, this means that we can express the value of these properties as either: (a) a String with an IRI, (b) a Single json object with an &quot;@id&quot;, or (c) An array of IRIs/json objects. For instance, each of the following are equivalent:&lt;/p&gt;

&lt;figure&gt;&lt;figcaption&gt;&lt;/figcaption&gt;
&lt;pre&gt;&lt;code&gt;  &quot;url&quot;: &quot;http://example.org/foo&quot;

  &quot;url&quot;: { &quot;@id&quot;: &quot;http://example.org/foo&quot; }

  &quot;url&quot;: [ { &quot;@id&quot;: &quot;http://example.org/foo&quot; } ]&lt;/code&gt;&lt;/pre&gt;&lt;/figure&gt;

&lt;p&gt;In the previous model, all Link Value&#39;s had an associated Link Relation. If the &quot;rel&quot; attribute did not appear in the Link Value directly, the name of the property was used as the Link Relation. This allowed us to use IANA and HTML5 link relations directly as property names in our objects. While this qualified as a &quot;neat trick&quot; that was convenient in some ways, many rightly pointed out that this mixing of link relations and property names muddied the water a bit and opened the door for naming conflicts. In the updated vocabulary this is revised. The Link class has a &quot;rel&quot; attribute, and this attribute is the only way to associate a Link Relation with the Link.&lt;/p&gt;

&lt;figure&gt;&lt;figcaption&gt;Given this snippet from Ex.B above:&lt;/figcaption&gt;
&lt;pre&gt;&lt;code&gt;      &quot;url&quot;: [
        {
          &quot;@id&quot;: &quot;http://example.org/notes/1&quot;,
          &quot;mediaType&quot;: &quot;text/html&quot;
        }
        {
          &quot;@id&quot;: &quot;http://api.example.org/notes/1.json&quot;,
          &quot;mediaType&quot;: &quot;application/activity+json&quot;,
          &quot;rel&quot;: &quot;self&quot;
        }
      ]&lt;/code&gt;&lt;/pre&gt;&lt;/figure&gt;

&lt;p&gt;The object has two &quot;url&quot; values. For the first value, the Link target is &quot;http://example.org/notes/1&quot;, the mediaType of that target is &quot;text/html&quot; and there is no Link Relation. For the second, the Link target is &quot;http://api.example.org/notes/1.json&quot;, the mediaType is &quot;application/activity+json&quot; and the Link Relation is &quot;self&quot;.&lt;/p&gt;

&lt;p&gt;If you look at the &quot;icon&quot; property for Ex.B, you&#39;ll see that there is only a single Link provided. The Link target is &quot;http://example.org/assets/note.png&quot; and no additional information is given.&lt;/p&gt;

&lt;p&gt;For &quot;url&quot;, &quot;icon&quot; and &quot;image&quot;, the value is *required* to be a Link. However, for quite a few properties defined in the vocabulary, the value can be either a Link or an Object. For instance, the &quot;actor&quot; property on an Activity could have either of the following:&lt;/p&gt;

&lt;figure&gt;&lt;figcaption&gt;&lt;/figcaption&gt;
&lt;pre&gt;&lt;code&gt;  &quot;actor&quot;: {
    &quot;@type&quot;: &quot;urn:example:objectType:person&quot;,
    &quot;displayName&quot;: &quot;Sally&quot;
  }

  &quot;actor&quot;: {
    &quot;@type&quot;: &quot;http://activitystrea.ms/2.0/Link&quot;,
    &quot;@id&quot;: &quot;http://example.org/profiles/sally&quot;,
    &quot;mediaType&quot;: &quot;text.html&quot;
  }&lt;/code&gt;&lt;/pre&gt;&lt;/figure&gt;

&lt;figure&gt;&lt;figcaption&gt;Or even a mix of the two:&lt;/figcaption&gt;
&lt;pre&gt;&lt;code&gt;  &quot;actor&quot;: [
    {
      &quot;@type&quot;: &quot;urn:example:objectType:person&quot;,
      &quot;displayName&quot;: &quot;Sally&quot;
    },
    {
      &quot;@type&quot;: &quot;http://activitystrea.ms/2.0/Link&quot;,
      &quot;@id&quot;: &quot;http://example.org/profiles/sally&quot;,
      &quot;mediaType&quot;: &quot;text.html&quot;
    }
  ]&lt;/code&gt;&lt;/pre&gt;&lt;/figure&gt;

&lt;p&gt;In such cases, it is important to explicitly specify the &quot;@type&quot; in order to let a consuming application know what type of value is being passed. Yes, that&#39;s a bit annoying, but it is what it is. If the &quot;@type&quot; is omitted, then a reasonable default should be assumed. I propose that the reasonable default is to assume that it&#39;s an object.&lt;/p&gt;

&lt;p&gt;As with Link, the JSON-LD serialization of the Object value is flexible. If the Object consists of nothing else but an @id, then we can serialize it simply as a String with an IRI. The following, then, are equivalent:&lt;/p&gt;

&lt;figure&gt;&lt;figcaption&gt;&lt;/figcaption&gt;
&lt;pre&gt;&lt;code&gt;  &quot;actor&quot;: &quot;urn:example:people:sally&quot;

  &quot;actor&quot;: {&quot;@id&quot;: &quot;urn:example:people:sally&quot;}

  &quot;actor&quot;: [{&quot;@id&quot;: &quot;urn:example:people:sally&quot;}]&lt;/code&gt;&lt;/pre&gt;&lt;/figure&gt;

&lt;p&gt;Note that while all this looks quite a bit different, because of the way the vocabulary and JSON-LD context are defined, existing Activity Streams 1.0 documents are still valid. For instance, if we look at Ex.C below, which is taken from an existing Pump.io implementation:&lt;/p&gt;

&lt;figure&gt;&lt;figcaption&gt;Ex.C:&lt;/figcaption&gt;
&lt;pre&gt;&lt;code&gt;  {
    &quot;id&quot;: &quot;http://coding.example/api/activity/bwkflwken&quot;,
    &quot;actor&quot;: {
        &quot;id&quot;: &quot;acct:bwk@coding.example&quot;,
        &quot;objectType&quot;: &quot;person&quot;,
        &quot;displayName&quot;: &quot;Brian Kernighan&quot;
    },
    &quot;verb&quot;: &quot;follow&quot;,
    &quot;to&quot;: [{
        &quot;id&quot;: &quot;acct:ken@coding.example&quot;,
        &quot;objectType&quot;: &quot;person&quot;
    }],
    &quot;object&quot;: {
        &quot;id&quot;: &quot;acct:ken@coding.example&quot;,
        &quot;objectType&quot;: &quot;person&quot;,
        &quot;displayName&quot;: &quot;Ken Thompson&quot;
    },
    &quot;published&quot;: &quot;1974-01-01T00:00:00&quot;,
    &quot;links&quot;: [
        {&quot;rel&quot;: &quot;self&quot;, &quot;href&quot;: &quot;http://coding.example/api/activity/bwkflwken&quot;}
    ]
  }&lt;/code&gt;&lt;/pre&gt;&lt;/figure&gt;

&lt;p&gt;If we properly apply the JSON-LD @context when processing this, things just work. The only wonkiness we get is with the &quot;links&quot; extension property. A properly crafted JSON-LD @context can define &quot;links&quot; as an alias of &quot;url&quot; and &quot;href&quot; as an alias of &quot;@id&quot;. Once done, this example is directly processable using the updated vocabulary without requiring any changes to the original serialized document.&lt;/p&gt;

&lt;p&gt;That covers the main changes to Object and Activity, let&#39;s look at PotentialAction now.&lt;/p&gt;

&lt;p&gt;A &quot;PotentialAction&quot; is an Activity that might occur in the future. I have modified the definition of this to be in closer alignment with the direction taken by schema.org/Actions without actually overlapping or introducing any dependencies on the schema.org Vocabulary. This ought to meant that the two models can peacefully coexist without giving developers two distinctly different ways of accomplishing the same thing. It&#39;s even possible to mix and match but I&#39;ll get into that later on.&lt;/p&gt;

&lt;p&gt;The model here is simple: Any Object can have one or more PotentialAction&#39;s, expressed using the &quot;action&quot; property. A PotentialAction can have one or more methods of completing that action, expressed using the &quot;using&quot; property. For instance:&lt;/p&gt;

&lt;figure&gt;&lt;figcaption&gt;Ex.D:&lt;/figcaption&gt;
&lt;pre&gt;&lt;code&gt;  {
    &quot;@type&quot;: &quot;urn:example:objectTypes:note&quot;,
    &quot;displayName&quot;: &quot;My Note&quot;,
    &quot;action&quot;: {
      &quot;@type&quot;: &quot;urn:example:action:LikeAction&quot;,
      &quot;confirm&quot;: true,
      &quot;using&quot;: {
        &quot;@type&quot;: &quot;http://activitystrea.ms/2.0/HttpRequest&quot;,
        &quot;url&quot;: &quot;http://api.example.org/like?id=1&quot;,
        &quot;method&quot;: &quot;POST&quot;,
        &quot;potentialResult&quot;: {
          &quot;@type&quot;: &quot;http://activitystrea.ms/2.0/Payload&quot;,
          &quot;mediaType&quot;: &quot;application/activity+json&quot;
        }
      }
    }
  }&lt;/code&gt;&lt;/pre&gt;&lt;/figure&gt;

&lt;p&gt;Here we have a &quot;urn:example:objectTypes:note&quot; Object with a single PotentialAction of type &quot;urn:example:action:LikeAction&quot;. Invocation of this action requires user confirmation (confirm: true). To invoke this action, we would use an HTTP POST request to &quot;http://api.example.org/like?id=1&quot; and would expect to get back a JSON document.&lt;/p&gt;

&lt;p&gt;Here&#39;s another example:&lt;/p&gt;

&lt;figure&gt;&lt;figcaption&gt;Ex.D:&lt;/figcaption&gt;
&lt;pre&gt;&lt;code&gt;  {
    &quot;@type&quot;: &quot;urn:example:objectTypes:movie&quot;,
    &quot;displayName&quot;: &quot;Vacation Video&quot;,
    &quot;action&quot;: {
      &quot;@type&quot;: &quot;urn:example:action:ViewAction&quot;,
      &quot;confirm&quot;: false,
      &quot;using&quot;: {
        &quot;@type&quot;: &quot;http://activitystrea.ms/2.0/EmbeddedView&quot;,
        &quot;url&quot;: {
          &quot;@id&quot;: &quot;http://example.org/movies/vacation.mpg&quot;,
          &quot;mediaType&quot;: &quot;video/mpeg&quot;
        }
      }
    }
  }&lt;/code&gt;&lt;/pre&gt;&lt;/figure&gt;

&lt;p&gt;Here we have a &quot;urn:example:objectTypes:movie&quot; object with a single PotentialAction of type &quot;urn:example:action:ViewAction&quot;. Invocation of this action does *not* require user confirmation. To invoke the action, we would use an Embedded View, which is really just the mpeg file for the video itself.&lt;/p&gt;

&lt;p&gt;The Vocabulary defines four specific types of &quot;PotentialActionHandler&quot; instances:&lt;/p&gt;

&lt;ul&gt;
 &lt;li&gt;HttpRequest (should be self explanatory)&lt;/li&gt;
 &lt;li&gt;BrowserView (a subclass of HttpRequest that results in the display and navigation of a browser context)&lt;/li&gt;
 &lt;li&gt;EmbeddedView (displays embedded content)&lt;/li&gt;
 &lt;li&gt;Intent (largely undefined right now, the idea here is to shell out to a native application or allow the consuming application to figure out the details for itself...)&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;For folks who are familiar with the schema.org/Action way of doing things (documented here: http://schema.org/docs/actions.html) much of this ought to look pretty familiar. The differences between the two models are *intentional*. The idea here is to follow the same basic path without introducing any direct dependencies. There are also additional use cases that simply are not covered by the current schema.org/Actions model (embedded content, for instance). That said, the two approaches are compatible with one another and can be used together.&lt;/p&gt;

&lt;p&gt;I can go into more detail on the PotentialActions bit later on. For now, I&#39;d like to turn attention back to other, non JSON-LD serializations. With the vocabulary defined the way that it is, we can easily serialize Activity and Action terms into HTML using either HTML5&#39;s built in Microdata attributes, RDFa or Microformats. Here are some examples:&lt;/p&gt;

&lt;figure&gt;&lt;figcaption&gt;Ex.E:&lt;/figcaption&gt;
&lt;pre&gt;&lt;code&gt;  &amp;lt;div itemscope itemtype=&quot;http://activitystrea.ms/2.0/Activity&quot; itemid=&quot;urn:example:activity:1&quot;&gt;
    &amp;lt;span itemprop=&quot;actor&quot; itemscope itemtype=&quot;urn:example:objectTypes:person&quot;&gt;
      &amp;lt;span itemprop=&quot;displayName&quot;&gt;Sally&amp;lt;/span&gt;
     &amp;lt;/span&gt;
    &amp;lt;span itemprop=&quot;verb&quot; itemscope itemtype=&quot;http://activitystrea.ms/2.0/Verb&quot; itemid=&quot;urn:example:verbs:upload&quot;&gt;
      &amp;lt;span itemprop=&quot;displayName&quot;&gt;uploaded&amp;lt;/span&gt;
    &amp;lt;/span&gt;
    &amp;lt;span itemprop=&quot;object&quot; itemscope itemtype=&quot;urn:example:objectTypes:file&quot;&gt;
      &amp;lt;span itemprop=&quot;displayName&quot;&gt;a file&amp;lt;/span&gt;
      (&amp;lt;a href=&quot;http://example.org/foo.jpg&quot; itemprop=&quot;url&quot;&gt;...&amp;lt;/a&gt;)
    &amp;lt;/span&gt;
  &amp;lt;/div&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/figure&gt;

&lt;p&gt;A bit verbose, yes, but that&#39;s the way HTML5 microdata works.&lt;/p&gt;

&lt;p&gt;Using RDFa, it would look something like:&lt;/p&gt;

&lt;figure&gt;&lt;figcaption&gt;Ex.F:&lt;/figcaption&gt; 
&lt;pre&gt;&lt;code&gt;  &amp;lt;div vocab=&quot;http://activitystrea.ms/2.0&quot; typeof=&quot;Activity&quot;&gt;
    &amp;lt;span property=&quot;actor&quot; typeof=&quot;urn:example:objectTypes:person&quot;&gt;
      &amp;lt;span property=&quot;displayName&quot;&gt;Sally&amp;lt;/span&gt;
     &amp;lt;/span&gt;
    &amp;lt;span property=&quot;verb&quot; typeof=&quot;http://activitystrea.ms/2.0/Verb&quot; resource=&quot;urn:example:verbs:upload&quot;&gt;
      &amp;lt;span property=&quot;displayName&quot;&gt;uploaded&amp;lt;/span&gt;
    &amp;lt;/span&gt;
    &amp;lt;span property=&quot;object&quot; typeof=&quot;urn:example:objectTypes:file&quot;&gt;
      &amp;lt;span property=&quot;displayName&quot;&gt;a file&amp;lt;/span&gt;
      (&amp;lt;a href=&quot;http://example.org/foo.jpg&quot; property=&quot;url&quot;&gt;...&amp;lt;/a&gt;)
    &amp;lt;/span&gt; 
  &amp;lt;/div&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/figure&gt;

&lt;p&gt;Using microformats we&#39;d get something like (my microformats-foo is a bit rusty so some details could likely be refined)&lt;/p&gt;

&lt;figure&gt;&lt;figcaption&gt;Ex.G:&lt;/figcaption&gt;
&lt;pre&gt;&lt;code&gt; &amp;lt;div class=&quot;h-activity&quot;&gt;
    &amp;lt;span class=&quot;p-actor&quot;&gt;
      &amp;lt;span class=&quot;p-displayname&quot;&gt;Sally&amp;lt;/span&gt;
     &amp;lt;/span&gt;
    &amp;lt;link class=&quot;p-verb&quot; href=&quot;urn:example:verbs:upload&quot;&gt;
      &amp;lt;span property=&quot;displayName&quot;&gt;uploaded&amp;lt;/span&gt;
    &amp;lt;/link&gt;
    &amp;lt;span class=&quot;p-object&quot;&gt;
      &amp;lt;link class=&quot;u-type&quot; href=&quot;urn:example:objectTypes:file&quot; /&gt;
      &amp;lt;a href=&quot;http://example.org/foo.jpg&quot; class=&quot;u-url p-displayName&quot;&gt;a file&amp;lt;/a&gt;
    &amp;lt;/span&gt;
  &amp;lt;/div&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/figure&gt;

&lt;p&gt;We can even express the data using normalized N-Quads...&lt;/p&gt;

&lt;figure&gt;&lt;figcaption&gt;Ex.H:&lt;/figcaption&gt;
&lt;pre&gt;&lt;code&gt;  _:c14n0 &amp;lt;http://activitystrea.ms/2.0/displayName&gt; &quot;a file&quot; . 
  _:c14n0 &amp;lt;http://activitystrea.ms/2.0/url&gt; &amp;lt;http://example.org/foo.jpg&gt; .
  _:c14n0 &amp;lt;http://www.w3.org/1999/02/22-rdf-syntax-ns#type&gt; &amp;lt;urn:example:objectTypes:file&gt; .
  _:c14n1 &amp;lt;http://activitystrea.ms/2.0/actor&gt; &amp;lt;urn:example:people:sally&gt; .
  _:c14n1 &amp;lt;http://activitystrea.ms/2.0/object&gt; _:c14n0 .
  _:c14n1 &amp;lt;http://activitystrea.ms/2.0/verb&gt; &amp;lt;urn:example:verbs:upload&gt; .
  _:c14n1 &amp;lt;http://www.w3.org/1999/02/22-rdf-syntax-ns#type&gt; &amp;lt;http://activitystrea.ms/2.0/Activity&gt; .&lt;/code&gt;&lt;/pre&gt;&lt;/figure&gt;

&lt;p&gt;The bottom line is that, even if we specify JSON-LD as a baseline serialization, defining the vocabulary in this way gives us quite a few options we previously did not have with regards to serialization.&lt;/p&gt;

&lt;p&gt;I&#39;ll stop here for now as I recognize that this is a lot of information to process.&lt;/p&gt;

- James</content><link rel='replies' type='application/atom+xml' href='http://chmod777self.blogspot.com/feeds/3681332445293418371/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://chmod777self.blogspot.com/2014/09/activity-and-actions-vocabulary-examples.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/7390223865029902668/posts/default/3681332445293418371'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/7390223865029902668/posts/default/3681332445293418371'/><link rel='alternate' type='text/html' href='http://chmod777self.blogspot.com/2014/09/activity-and-actions-vocabulary-examples.html' title='Activity and Actions Vocabulary Examples'/><author><name>jasnell</name><uri>http://www.blogger.com/profile/12993461992320512775</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='https://img1.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-7390223865029902668.post-5534210506895941166</id><published>2014-08-18T10:50:00.002-07:00</published><updated>2014-08-19T08:18:33.543-07:00</updated><title type='text'>JSON-LD Nits</title><content type='html'>&lt;p&gt;&lt;a href=&quot;http://www.w3.org/TR/json-ld/&quot;&gt;JSON-LD&lt;/a&gt; is quite a handy specification. But I do have a few nits.&lt;/p&gt;

&lt;p&gt;&lt;b&gt;Per-field @vocab or @base:&lt;/b&gt;&lt;/p&gt;

&lt;p&gt;Using a JSON-LD @context, it&#39;s possible to declare that the string value of any given field is itself a vocabulary term. In other words, if my JSON is something like:&lt;/p&gt;

&lt;pre&gt;&lt;code&gt;
{
  &quot;@context&quot;: {
    &quot;@vocab&quot;: &quot;http://example.org#&quot;,
    &quot;foo&quot;: {
      &quot;@type&quot;: &quot;@vocab&quot;
    }
  },
  &quot;foo&quot;: &quot;bar&quot;
}
&lt;/code&gt;&lt;/pre&gt;

&lt;p&gt;The normalized result would be:&lt;/p&gt; 

&lt;pre&gt;&lt;code&gt;
_:c14n0 &amp;lt;http://example.org#foo&gt; &amp;lt;http://example.org#bar&gt; .
&lt;/code&gt;&lt;/pre&gt;

&lt;p&gt;Note that &quot;bar&quot; is expanded into &quot;http://example.org#bar&quot;, using the in-scope @vocab. That&#39;s great, but what if the values (a) map to a different vocabulary and (b) are being migrated from a non-JSON-LD syntax (Activity Streams 1.0 for example)&lt;/p&gt;

&lt;p&gt;Consider, for example, the following Activity Streams 2.0 document. The &quot;verb&quot; property needs to map to &quot;http://activitystrea.ms/2.0/verb&quot;, while the &quot;add&quot; verb value itself should map to something different (the &quot;add&quot; verb is not actually defined as part of the Activity Streams 2.0 vocabulary). I don&#39;t want to modify the original JSON in order to interpret the &quot;verb&quot; properly.&lt;/p&gt;

&lt;pre&gt;&lt;code&gt;
{
  &quot;@context&quot;: {
    &quot;@vocab&quot;: &quot;http://activitystrea.ms/2.0/&quot;,
    &quot;verb&quot;: {
      &quot;@type&quot;: &quot;@vocab&quot;
    }
  },
  &quot;verb&quot;: &quot;add&quot;
}
&lt;/code&gt;&lt;/pre&gt;

&lt;p&gt;The normalized result of this is:&lt;/p&gt;

&lt;pre&gt;&lt;code&gt;
_:c14n0 &amp;lt;http://activitystrea.ms/2.0/verb&gt; &amp;lt;http://activitystrea.ms/2.0/add&gt; .
&lt;/code&gt;&lt;/pre&gt;

&lt;p&gt;That&#39;s obviously not what we want. Currently, the only way to solve this in JSON-LD 1.0 would be to modify the value in the original JSON. Or to map the &quot;add&quot; alias specifically in the @context like so:&lt;/p&gt;

&lt;pre&gt;&lt;code&gt;
{
  &quot;@context&quot;: {
    &quot;@vocab&quot;: &quot;http://activitystrea.ms/2.0/&quot;,
    &quot;verb&quot;: {
      &quot;@type&quot;: &quot;@vocab&quot;
    },
    &quot;add&quot;: &quot;http://example.org/add&quot;
  },
  &quot;verb&quot;: &quot;add&quot;
}
&lt;/code&gt;&lt;/pre&gt;

&lt;p&gt;While that works, it would require a @context that maps every possible simple verb. Which is annoying and sometimes impractical. What would be ideal is the ability to simply define a per-field @base or @vocab, like so:&lt;/p&gt;

&lt;pre&gt;&lt;code&gt;
{
  &quot;@context&quot;: {
    &quot;@vocab&quot;: &quot;http://activitystrea.ms/2.0/&quot;,
    &quot;verb&quot;: {
      &quot;@base&quot;: &quot;http://example.org/&quot;,
      &quot;@type&quot;: &quot;@vocab&quot;
    }
  },
  &quot;verb&quot;: &quot;add&quot;
}
&lt;/code&gt;&lt;/pre&gt;

&lt;p&gt;This would allow me to establish a default base URI for all simple verbs without having to map each one individually or clobbering the top-level @vocab/@base of the @context itself.&lt;/p&gt;

&lt;p&gt;&lt;b&gt;@sameAs:&lt;/b&gt;&lt;/p&gt;

&lt;p&gt;JSON-LD currently lacks a reliable way of performing reconciliation of object&#39;s. In order to mark an object as being the &quot;same as&quot; another object, implementers have to rely on other vocabularies. This is such a common use case that a new &quot;@sameAs&quot; JSON-LD property would be extremely useful. For instance:&lt;/p&gt;

&lt;pre&gt;&lt;code&gt;
{
  &quot;@id&quot;: &quot;http://example.org/foo&quot;,
  &quot;@sameAs&quot;: &quot;http://example.org/bar&quot;
}
&lt;/code&gt;&lt;/pre&gt;

&lt;p&gt;The interpretation of this is straightforward. This would come in very handy for vocabularies such as Activity Streams 2.0, which defines a &quot;duplicates&quot; property. Using the JSON-LD @context, I would simply be able to indicate that &quot;duplicates is an alias for &quot;@sameAs&quot;.&lt;/p&gt;

&lt;pre&gt;&lt;code&gt;
{
  &quot;@context&quot;: {
    &quot;@vocab&quot;: &quot;http://activitystrea.ms/2.0/&quot;,
    &quot;id&quot;: &quot;@id&quot;,
    &quot;duplicates&quot;: &quot;@sameAs&quot;
  },
  &quot;id&quot;: &quot;http://example.org/foo&quot;,
  &quot;duplicates&quot;: &quot;http://example.org/bar&quot;
}
&lt;/code&gt;&lt;/pre&gt;

&lt;p&gt;Yes, I know I can map duplicates to various properties in other specific vocabularies, but @sameAs is so generally useful that the ability really ought to be baked into JSON-LD directly... at least in my opinion.&lt;/p&gt;

&lt;p&gt;&lt;b&gt;@index Wonkyness:&lt;/b&gt;&lt;/p&gt;

&lt;p&gt;While I appreciate @index, it is a bit wonky when converting to a normalized triple representation. For instance, consider the following:&lt;/p&gt;

&lt;pre&gt;&lt;code&gt;
{
  &quot;@context&quot;: {
    &quot;actions&quot;: {
      &quot;@id&quot;: &quot;http://activitystrea.ms/2.0/actions&quot;,
      &quot;@container&quot;: &quot;@index&quot;
    }
  },
  &quot;actions&quot;: {
    &quot;foo&quot;: {
      &quot;@id&quot;: &quot;test&quot;
    },
    &quot;bar&quot;: {
      &quot;@id&quot;: &quot;bar&quot;
    }
  }
}
&lt;/code&gt;&lt;/pre&gt;

&lt;p&gt;When I pop this into the &lt;a href=&quot;http://goo.gl/05Q4TZ&quot;&gt;JSON-LD playground&lt;/a&gt;, the normalized N-Quads come out as:&lt;/p&gt;

&lt;pre&gt;&lt;code&gt;
_:c14n0 &amp;lt;http://activitystrea.ms/2.0/actions&gt; &amp;lt;http://json-ld.org/playground/bar&gt; .
_:c14n0 &amp;lt;http://activitystrea.ms/2.0/actions&gt; &amp;lt;http://json-ld.org/playground/test&gt; .
&lt;/code&gt;&lt;/pre&gt;

&lt;p&gt;Note that the &quot;foo&quot; and &quot;bar&quot; field names are simply lost. That&#39;s rather crappy. The only way to get what I want is to drop the &quot;@container&quot;:&quot;@index&quot; and use &quot;@type&quot;:&quot;@vocab&quot;, like so:&lt;/p&gt;

&lt;pre&gt;&lt;code&gt;
{
  &quot;@context&quot;: {
    &quot;actions&quot;: {
      &quot;@id&quot;: &quot;http://activitystrea.ms/2.0/actions&quot;,
      &quot;@type&quot;: &quot;@vocab&quot;
    },
    &quot;foo&quot;: &quot;http://example.org/foo&quot;,
    &quot;bar&quot;: &quot;http://example.org/bar&quot;
  },
  &quot;actions&quot;: {
    &quot;foo&quot;: {
      &quot;@id&quot;: &quot;test&quot;
    },
    &quot;bar&quot;: {
      &quot;@id&quot;: &quot;bar&quot;
    }
  }
}
&lt;/code&gt;&lt;/pre&gt;

&lt;p&gt;Which yields:&lt;/p&gt;

&lt;pre&gt;&lt;code&gt;
_:c14n0 &amp;lt;http://activitystrea.ms/2.0/actions&gt; _:c14n1 .
_:c14n1 &amp;lt;http://example.org/bar&gt; &amp;lt;http://json-ld.org/playground/bar&gt; .
_:c14n1 &amp;lt;http://example.org/foo&gt; &amp;lt;http://json-ld.org/playground/test&gt; .
&lt;/code&gt;&lt;/pre&gt;

&lt;p&gt;For this to work, however, I end up having to define each property that appears under actions or the JSON-LD processing will ignore it. That&#39;s not really what I want. Sure, I could define a default @vocab in the @context, but that could have some rather undesirable side effects elsewhere in the processing.&lt;/p&gt;

&lt;p&gt;What I want is something between &quot;@container&quot;:&quot;@index&quot; and &quot;@type&quot;:&quot;@vocab&quot;... that allows me to declare in the context that &quot;actions&quot; is an &quot;@index&quot; but I don&#39;t want it to ignore the indexed property names when it coverts to the normalized N-Quads.&lt;/p&gt;

&lt;p&gt;Something along the lines of:&lt;/p&gt;

&lt;pre&gt;&lt;code&gt;
&lt;pre&gt;&lt;code&gt;
{
  &quot;@context&quot;: {
    &quot;actions&quot;: {
      &quot;@id&quot;: &quot;http://activitystrea.ms/2.0/actions&quot;,
      &quot;@container&quot;: &quot;@vocab&quot;,
      &quot;@base&quot;: &quot;http://example.org/&quot;
    }
  },
  &quot;actions&quot;: {
    &quot;foo&quot;: {
      &quot;@id&quot;: &quot;test&quot;
    },
    &quot;bar&quot;: {
      &quot;@id&quot;: &quot;bar&quot;
    }
  }
}
&lt;/code&gt;&lt;/pre&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;p&gt;The interpretation of &quot;@container&quot;:&quot;@vocab&quot; is that the object is an @index of @vocab terms. If we combine this with the notion of per-field base URIs (see above), the resulting normalized N-Quads would look like the following (which is identical to the &quot;@type&quot;: &quot;@vocab&quot; results above but does not require me to define all the properties under actions in advance or clobber my @context with a default @vocab -- which can cause other significant undesirable side effects).&lt;/p&gt;

&lt;pre&gt;&lt;code&gt;
_:c14n0 &amp;lt;http://activitystrea.ms/2.0/actions&gt; _:c14n1 .
_:c14n1 &amp;lt;http://example.org/foo&gt; &amp;lt;http://example.org/test&gt; .
_:c14n1 &amp;lt;http://example.org/bar&gt; &amp;lt;http://example.org/bar&gt; .
&lt;/code&gt;&lt;/pre&gt;

&lt;p&gt;In other words, while there&#39;s a somewhat hackish way to accomplish this in JSON-LD today, the current method is not overly desirable. &quot;@container&quot;: &quot;@vocab&quot; and per-field @base/@vocab would provide a cleaner, more reliable solution.&lt;/p&gt;

&lt;p&gt;(edit: while reading back through this I noticed so many errors that I&#39;m convinced my brain was still in vacation mode. I need more coffee.)</content><link rel='replies' type='application/atom+xml' href='http://chmod777self.blogspot.com/feeds/5534210506895941166/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://chmod777self.blogspot.com/2014/08/json-ld-nits.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/7390223865029902668/posts/default/5534210506895941166'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/7390223865029902668/posts/default/5534210506895941166'/><link rel='alternate' type='text/html' href='http://chmod777self.blogspot.com/2014/08/json-ld-nits.html' title='JSON-LD Nits'/><author><name>jasnell</name><uri>http://www.blogger.com/profile/12993461992320512775</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='https://img1.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-7390223865029902668.post-3494799617286243323</id><published>2014-06-02T10:25:00.000-07:00</published><updated>2014-06-02T10:25:59.542-07:00</updated><title type='text'>HTML imports and XSS</title><content type='html'>&lt;p&gt;&lt;a href=&quot;http://lists.w3.org/Archives/Public/public-webapps/2014AprJun/0729.html&quot;&gt;This email thread&lt;/a&gt; raises a good point: If you&#39;re doing any content filtering to prevent XSS attacks, make sure you check for &amp;lt;link rel=&quot;import ...&amp;gt; tags and make sure you&#39;re looking at the content being imported. HTML Imports *shouldn&#39;t* be any more risky than arbitrary script tags but given that the HTML import can pull in script, stylesheets and markup, you need to be careful. Best advice: treat import links exactly as you would any untrusted executable content.&lt;/p&gt;</content><link rel='replies' type='application/atom+xml' href='http://chmod777self.blogspot.com/feeds/3494799617286243323/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://chmod777self.blogspot.com/2014/06/html-imports-and-xss.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/7390223865029902668/posts/default/3494799617286243323'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/7390223865029902668/posts/default/3494799617286243323'/><link rel='alternate' type='text/html' href='http://chmod777self.blogspot.com/2014/06/html-imports-and-xss.html' title='HTML imports and XSS'/><author><name>jasnell</name><uri>http://www.blogger.com/profile/12993461992320512775</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='https://img1.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-7390223865029902668.post-4993221268547991074</id><published>2014-05-20T11:48:00.001-07:00</published><updated>2014-05-20T11:48:06.504-07:00</updated><title type='text'>Activity Streams 2.0 and AppLinks</title><content type='html'>&lt;p&gt;Recently I was asked how Activity Streams 2.0 Action Handlers compare with &lt;a href=&quot;http://applinks.org/documentation/&quot;&gt;AppLinks&lt;/a&gt;.&lt;/p&gt;

&lt;p&gt;For those who are not familiar, AppLinks is an emerging convention for using metadata embedded in HTML to provide &quot;deep links&quot; into mobile applications. You can catch the snazzy overview video on their &lt;a href=&quot;http://applinks.org&quot;&gt;website&lt;/a&gt;. Below is an example taken from their documentation:&lt;/p&gt;

&lt;pre&gt;&lt;code&gt;
&amp;lt;html&gt;
&amp;lt;head&gt;
    &amp;lt;meta property=&quot;al:ios:url&quot; content=&quot;applinks://docs&quot; /&gt;
    &amp;lt;meta property=&quot;al:ios:app_store_id&quot; content=&quot;12345&quot; /&gt;
    &amp;lt;meta property=&quot;al:ios:app_name&quot; content=&quot;App Links&quot; /&gt;
    &amp;lt;meta property=&quot;al:android:url&quot; content=&quot;applinks://docs&quot; /&gt;
    &amp;lt;meta property=&quot;al:android:app_name&quot; content=&quot;App Links&quot; /&gt;
    &amp;lt;meta property=&quot;al:android:package&quot; content=&quot;org.applinks&quot; /&gt;
    &amp;lt;meta property=&quot;al:web:url&quot;
          content=&quot;http://applinks.org/documentation&quot; /&gt;
&amp;lt;/head&gt;
&amp;lt;body&gt;
Hello, world!
&amp;lt;/body&gt;
&amp;lt;/html&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;p&gt;The basic idea is: whenever you want to link from one app to another, the linking app would do an HTTP GET to fetch this bit of HTML, parse out the metadata, check to see if the native app exists, and if it does, invoke it directly using the provided information. If the app doesn&#39;t exist, however, the browser is launched as a fallback. Pretty simple.&lt;/p&gt;

&lt;p&gt;So how does this compare to Activity Streams 2.0 Actions? Well, that&#39;s pretty simple too: They are orthogonal to one another and completely compatible. We can actually take the AppLinks metadata elements and drop them directly into an Activity Streams 2.0 document. Following are two examples of this. I&#39;ve created a fictional &quot;AppLinks&quot; objectType for the sake of the example. In the first case, AppLinks metadata is specified as an Action Handler. How this works ought to be fairly straightforward. In the second case, we use an Activity Streams 2.0 Link Value to embed the AppLinks metadata directly. Applications that don&#39;t know anything about AppLinks can safely ignore the additional markup.&lt;/p&gt;

&lt;pre&gt;&lt;code&gt;
{
  &quot;objectType&quot;: &quot;note&quot;,
  &quot;content&quot;: &quot;This is a note&quot;,
  &quot;actions&quot;: {
    &quot;view&quot;: {
      &quot;objectType&quot;: &quot;AppLinks&quot;,
      &quot;al:ios:url&quot;: &quot;applinks://docs&quot;,
      &quot;al:ios:app_store_id&quot;: &quot;12345&quot;,
      &quot;al:ios:app_name&quot;: &quot;App Links&quot;,
      &quot;al:android:url&quot;: &quot;applinks://docs&quot;,
      &quot;al:android:app_name&quot;: &quot;App Links&quot;,
      &quot;al:android:package&quot;: &quot;org.applinks&quot;,
      &quot;al:web:url&quot;: &quot;http://applinks.org/documentation&quot;
    }
  }
}

{
  &quot;objectType&quot;: &quot;note&quot;,
  &quot;content&quot;: &quot;This is a note&quot;,
  &quot;url&quot;: {
    &quot;objectType&quot;: &quot;AppLinks&quot;,
    &quot;al:ios:url&quot;: &quot;applinks://docs&quot;,
    &quot;al:ios:app_store_id&quot;: &quot;12345&quot;,
    &quot;al:ios:app_name&quot;: &quot;App Links&quot;,
    &quot;al:android:url&quot;: &quot;applinks://docs&quot;,
    &quot;al:android:app_name&quot;: &quot;App Links&quot;,
    &quot;al:android:package&quot;: &quot;org.applinks&quot;,
    &quot;url&quot;: &quot;http://applinks.org/documentation&quot;   
  }
}
&lt;/code&gt;&lt;/pre&gt;

&lt;p&gt;Simple and elegant. The way it should be.&lt;/p&gt;</content><link rel='replies' type='application/atom+xml' href='http://chmod777self.blogspot.com/feeds/4993221268547991074/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://chmod777self.blogspot.com/2014/05/activity-streams-20-and-applinks.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/7390223865029902668/posts/default/4993221268547991074'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/7390223865029902668/posts/default/4993221268547991074'/><link rel='alternate' type='text/html' href='http://chmod777self.blogspot.com/2014/05/activity-streams-20-and-applinks.html' title='Activity Streams 2.0 and AppLinks'/><author><name>jasnell</name><uri>http://www.blogger.com/profile/12993461992320512775</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='https://img1.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-7390223865029902668.post-143533418274581410</id><published>2014-05-19T08:59:00.000-07:00</published><updated>2014-05-19T08:59:31.747-07:00</updated><title type='text'>Towards a &quot;default initial context&quot; for AS 2.0 + JSON-LD</title><content type='html'>&lt;p&gt;Just uploaded another iteration on the Activity Streams 2.0 JSON-LD @context. This takes a step towards establishing a default initial context for AS 2.0 that includes terms from the Dublin Core, FOAF, vCard, Org, Provenance, and Link Relations ontologies. While processing AS 2.0 as JSON-LD is entirely optional, this initial context ought to make it significantly easier to mix in these other vocabularies should you choose the JSON-LD approach. The updated @context is hosted here: &lt;a href=&quot;https://w3id.org/activity-streams/v2&quot;&gt;https://w3id.org/activity-streams/v2&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;For example, using this context you could do something like:&lt;/p&gt;

&lt;pre&gt;&lt;code&gt;
{
  &quot;@context&quot;: &quot;https://w3id.org/activity-streams/v2&quot;,
  &quot;objectType&quot;: {
    &quot;id&quot;: &quot;foaf:Person&quot;,
    &quot;displayName&quot;: &quot;Person&quot;
  },
  &quot;foaf:givenName&quot;: &quot;James&quot;,
  &quot;foaf:familyName&quot;: &quot;Snell&quot;,
  &quot;org:memberOf&quot;: &quot;http://ibm.com&quot;,
  &quot;prov:actingOnBehalfOf&quot;: &quot;http://ibm.com&quot;,
  &quot;about&quot;: &quot;http://www.chmod777self.com&quot;
}
&lt;/code&gt;&lt;/pre&gt;

&lt;p&gt;The N-Quads produced would be:&lt;/p&gt;

&lt;pre&gt;&lt;code&gt;
&amp;lt;http://xmlns.com/foaf/0.1/Person&gt; &amp;lt;http://activitystrea.ms/2.0/displayName&gt; &quot;Person&quot; .
_:b0 &amp;lt;http://activitystrea.ms/2.0/objectType&gt; &amp;lt;http://xmlns.com/foaf/0.1/Person&gt; .
_:b0 &amp;lt;http://www.iana.org/assignments/link-relations/about&gt; &amp;lt;http://www.chmod777self.com&gt; .
_:b0 &amp;lt;http://www.w3.org/ns/org#memberOf&gt; &amp;lt;http://ibm.com&gt; .
_:b0 &amp;lt;http://www.w3.org/ns/prov#actingOnBehalfOf&gt; &amp;lt;http://ibm.com&gt; .
_:b0 &amp;lt;http://xmlns.com/foaf/0.1/familyName&gt; &quot;Snell&quot; .
_:b0 &amp;lt;http://xmlns.com/foaf/0.1/givenName&gt; &quot;James&quot; .
&lt;/code&gt;&lt;/pre&gt;
</content><link rel='replies' type='application/atom+xml' href='http://chmod777self.blogspot.com/feeds/143533418274581410/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://chmod777self.blogspot.com/2014/05/towards-default-initial-context-for-as.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/7390223865029902668/posts/default/143533418274581410'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/7390223865029902668/posts/default/143533418274581410'/><link rel='alternate' type='text/html' href='http://chmod777self.blogspot.com/2014/05/towards-default-initial-context-for-as.html' title='Towards a &quot;default initial context&quot; for AS 2.0 + JSON-LD'/><author><name>jasnell</name><uri>http://www.blogger.com/profile/12993461992320512775</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='https://img1.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-7390223865029902668.post-417914761761340666</id><published>2014-05-16T12:52:00.000-07:00</published><updated>2014-05-16T12:52:40.711-07:00</updated><title type='text'>IANA Link Relations JSON-LD Context</title><content type='html'>&lt;p&gt;Useful new tool of the day: A simple Node app that generates a basic JSON-LD @context covering the current contents of the IANA Registry of Link Relations.&lt;/p&gt;

&lt;p&gt;URL: &lt;a href=&quot;http://linkrels.ng.bluemix.net/links&quot;&gt;http://linkrels.ng.bluemix.net/links&lt;/a&gt; (hosted on &lt;a href=&quot;https://ace.ng.bluemix.net/&quot;&gt;IBM&#39;s bluemix&lt;/a&gt;)&lt;/p&gt;

&lt;p&gt;IANA: &lt;a href=&quot;http://www.iana.org/assignments/link-relations/link-relations.xhtml&quot;&gt;http://www.iana.org/assignments/link-relations/link-relations.xhtml&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Source: &lt;a href=&quot;https://github.com/jasnell/linkrels&quot;&gt;https://github.com/jasnell/linkrels&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Example (view using the &lt;a href=&quot;http://tinyurl.com/m6sveef&quot;&gt;JSON-LD Playground&lt;/a&gt;:&lt;/p&gt;

&lt;pre&gt;&lt;code&gt;
{
  &quot;@context&quot;: &quot;http://linkrels.ng.bluemix.net/links&quot;,
  &quot;first&quot;: &quot;http://example.org/first&quot;,
  &quot;next&quot;: &quot;http://example.org/next&quot;,
  &quot;prev&quot;: &quot;http://example.org/prev&quot;,
  &quot;up&quot;: &quot;http://example.org/up&quot;
}
&lt;/code&gt;&lt;/pre&gt;

&lt;p&gt;Results in the following N-Quads:&lt;/p&gt;

&lt;pre&gt;&lt;code&gt;
_:b0 &amp;lt;http://www.iana.org/assignments/link-relations/first&gt; &amp;lt;http://example.org/first&gt; .
_:b0 &amp;lt;http://www.iana.org/assignments/link-relations/next&gt; &amp;lt;http://example.org/next&gt; .
_:b0 &amp;lt;http://www.iana.org/assignments/link-relations/prev&gt; &amp;lt;http://example.org/prev&gt; .
_:b0 &amp;lt;http://www.iana.org/assignments/link-relations/up&gt; &amp;lt;http://example.org/up&gt; .
&lt;/code&gt;&lt;/pre&gt;
</content><link rel='replies' type='application/atom+xml' href='http://chmod777self.blogspot.com/feeds/417914761761340666/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://chmod777self.blogspot.com/2014/05/iana-link-relations-json-ld-context.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/7390223865029902668/posts/default/417914761761340666'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/7390223865029902668/posts/default/417914761761340666'/><link rel='alternate' type='text/html' href='http://chmod777self.blogspot.com/2014/05/iana-link-relations-json-ld-context.html' title='IANA Link Relations JSON-LD Context'/><author><name>jasnell</name><uri>http://www.blogger.com/profile/12993461992320512775</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='https://img1.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-7390223865029902668.post-3631258215196116597</id><published>2014-05-13T17:28:00.000-07:00</published><updated>2014-05-13T17:28:11.207-07:00</updated><title type='text'>Activity Streams 2.0 Action Handlers, Draft -06</title><content type='html'>&lt;p&gt;A new draft of the &lt;a href=&quot;http://tools.ietf.org/html/draft-snell-activitystreams-actions-06&quot;&gt;Activity Streams 2.0 Action Handlers&lt;/a&gt; specification has been posted. This draft makes a number of important updates:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;It introduces a new ViewActionHandler and draws a clear differentiation between HttpActionHandlers, ViewActionHandlers and EmbedActionHandlers, linking each back to the concept of Browser Contexts in HTML5, specifically:
  &lt;ul&gt;
    &lt;li&gt;HttpActionHandler is used primarily for REST/HTTP API request/responses. Invoking an HttpActionHandler has no bearing on the navigation of any browser context.&lt;/li&gt;
    &lt;li&gt;ViewActionHandlers are used for navigation. If you want the invocation of the action handler to result in a new popup browser window, or a new tab (generally any case where an existing or new browser context is navigated to a new location), you&#39;d use ViewActionHandler.&lt;/li&gt;
    &lt;li&gt;EmbedActionHandlers are used for embedded content inline. That content could take the form of images, media files, a gadget, etc. A new subordinate browser context (i.e. an iframe) might be created.&lt;/li&gt;
  &lt;/ul&gt;
&lt;/li&gt;
&lt;li&gt;It adds an HTML5 &quot;sandbox&quot; attribute to both the ViewActionHandler and EmbedActionHandler. This operates in exactly the same way as the sandbox attribute on HTML5 iframes. Whenever sandbox is used on an EmbedActionHandler, a new browser context (iframe) is created.&lt;/li&gt;
&lt;li&gt;It defines how Action Handlers interact with the standard W3C Content Security Policy (CSP).&lt;/li&gt;
&lt;li&gt;It changes the default action handler from HttpActionHandler to ViewActionHandler to properly reflect the most common use case.&lt;/li&gt;
&lt;li&gt;It defines how the Base URI is established for Action Handlers as they relate to the Content Security Policy (i.e. how we determine the Origin of the Action Handler)&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;For example, suppose I have the following Activity Streams 2.0 object:&lt;/p&gt;

&lt;pre&gt;&lt;code&gt;
{
  &quot;objectType&quot;: &quot;note&quot;,
  &quot;content&quot;: &quot;Isn&#39;t this fun?&quot;,
  &quot;actions&quot;: {
    &quot;share&quot;: [
      {
        &quot;objectType&quot;: &quot;ViewActionHandler&quot;,
        &quot;displayName&quot;: &quot;Share Me!&quot;,
        &quot;url&quot;: &quot;http://example.org/share?id=123&quot;,
        &quot;target&quot;: &quot;_new&quot;
      },
      {
        &quot;objectType&quot;: &quot;HttpActionHandler&quot;,
        &quot;url&quot;: &quot;http://api.example.org/share?id=123&quot;,
        &quot;method&quot;: &quot;POST&quot;
      },
      {
        &quot;objectType&quot;: &quot;EmbedActionHandler&quot;,
        &quot;content&quot;: &quot;&amp;lt;div&gt;...&amp;lt;/div&gt;&quot;,
        &quot;mediaType&quot;: &quot;text/html&quot;,
        &quot;sandbox&quot;: &quot;allow-scripts&quot;
      }
    ]
  }
}
&lt;/code&gt;&lt;/pre&gt;

&lt;p&gt;Here we have a note with a &quot;share&quot; action that has three possible Action Handlers. The ViewActionHandler is equivalent to a link. One possible way to implement the handler would be to translate it into something like: &lt;code&gt;&amp;lt;a href=&quot;http://example.org/share?id=123&quot;&amp;gt;Share Me!&amp;lt;/a&gt;&lt;/code&gt;. The HttpActionHandler is equivalent to performing an XMLHttpRequest operation in the backend. The EmbedActionHandler would display the value of the content attribute in a sandboxed iframe that allows scripts to execute.&lt;/p&gt;

&lt;p&gt;As before, the Action Handlers specification is still a work in progress so things may continue to evolve. Feedback is always welcome!&lt;/p&gt;</content><link rel='replies' type='application/atom+xml' href='http://chmod777self.blogspot.com/feeds/3631258215196116597/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://chmod777self.blogspot.com/2014/05/activity-streams-20-action-handlers.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/7390223865029902668/posts/default/3631258215196116597'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/7390223865029902668/posts/default/3631258215196116597'/><link rel='alternate' type='text/html' href='http://chmod777self.blogspot.com/2014/05/activity-streams-20-action-handlers.html' title='Activity Streams 2.0 Action Handlers, Draft -06'/><author><name>jasnell</name><uri>http://www.blogger.com/profile/12993461992320512775</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='https://img1.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-7390223865029902668.post-4065893608856805777</id><published>2014-05-02T13:01:00.000-07:00</published><updated>2014-05-02T13:01:45.493-07:00</updated><title type='text'>More on Activity Streams 2.0 and schema.org/Actions</title><content type='html'>&lt;p&gt;In my previous note, I explored ways in which we could map the Activity Streams 2.0 model into the schema.org model... here I wanted to briefly talk about going the other direction.. that is, how can be map a schema.org/Action to Activity Streams 2.0. It&#39;s fairly trivial using a JSON-LD context like the following:&lt;/p&gt;

&lt;pre&gt;&lt;code&gt;
{
  &quot;@context&quot;: [
    {&quot;@vocab&quot;:&quot;http://schema.org/&quot;}, {
    &quot;as&quot;: &quot;http://activitystrea.ms/2.0/&quot;,
    &quot;actionStatus&quot;: {
      &quot;@id&quot;: &quot;as:status&quot;,
      &quot;@type&quot;: &quot;@vocab&quot;
    },
    &quot;agent&quot;: {
      &quot;@id&quot;: &quot;as:actor&quot;,
      &quot;@type&quot;: &quot;@id&quot;,
      &quot;@container&quot;: &quot;@set&quot;
    },
    &quot;instrument&quot;: {
      &quot;@id&quot;: &quot;as:instrument&quot;,
      &quot;@type&quot;: &quot;@id&quot;,
      &quot;@container&quot;: &quot;@set&quot;
    },
    &quot;location&quot;: {
      &quot;@id&quot;: &quot;as:location&quot;,
      &quot;@type&quot;: &quot;@id&quot;,
      &quot;@container&quot;: &quot;@set&quot;
    },
    &quot;object&quot;: {
      &quot;@id&quot;: &quot;as:object&quot;,
      &quot;@type&quot;: &quot;@id&quot;,
      &quot;@container&quot;: &quot;@set&quot;
    },
    &quot;participant&quot;: {
      &quot;@id&quot;: &quot;as:participant&quot;,
      &quot;@type&quot;: &quot;@id&quot;,
      &quot;@container&quot;: &quot;@set&quot;
    },
    &quot;result&quot;: {
      &quot;@id&quot;: &quot;as:result&quot;,
      &quot;@type&quot;: &quot;@id&quot;,
      &quot;@container&quot;: &quot;@set&quot;
    },
    &quot;image&quot;: {
      &quot;@id&quot;: &quot;as:image&quot;,
      &quot;@type&quot;: &quot;@id&quot;,
      &quot;@container&quot;: &quot;@set&quot;
    },
    &quot;sameAs&quot;: {
      &quot;@id&quot;: &quot;as:duplicates&quot;,
      &quot;@type&quot;: &quot;@id&quot;,
      &quot;@container&quot;: &quot;@set&quot;
    },
    &quot;url&quot;: {
      &quot;@id&quot;: &quot;as:url&quot;,
      &quot;@type&quot;: &quot;@id&quot;,
      &quot;@container&quot;: &quot;@set&quot;
    },
    &quot;name&quot;: {
      &quot;@id&quot;: &quot;as:displayName&quot;,
      &quot;@container&quot;: &quot;@language&quot;
    },
    &quot;description&quot;: {
      &quot;@id&quot;: &quot;as:summary&quot;,
      &quot;@container&quot;: &quot;@language&quot;
    },
    &quot;endTime&quot;: &quot;as:endTime&quot;,
    &quot;startTime&quot;: &quot;as:startTime&quot;,
    &quot;CompletedActionStatus&quot;: {
      &quot;@id&quot;: &quot;as:CompletedStatus&quot;
    },
    &quot;ActiveActionStatus&quot;: {
      &quot;@id&quot;: &quot;as:ActiveStatus&quot;
    },
    &quot;PotentialActionStatus&quot;: {
      &quot;@id&quot;: &quot;as:TentativeStatus&quot;
    }
  }]
}
&lt;/code&gt;&lt;/pre&gt;

&lt;p&gt;Given this context, the following bit of schema.org compliant JSON-LD:&lt;/p&gt;

&lt;pre&gt;&lt;code&gt;
{
  &quot;@type&quot;: &quot;WatchAction&quot;,
  &quot;agent&quot;: {
    &quot;@type&quot;: &quot;Person&quot;,
    &quot;name&quot;: &quot;Sally&quot;
  },
  &quot;object&quot;: {
    &quot;@type&quot;: &quot;Movie&quot;,
    &quot;name&quot;: &quot;A Bug&#39;s Life&quot;
  }
}
&lt;/code&gt;&lt;/pre&gt;

&lt;p&gt;Yields the N-Quads:&lt;/p&gt;

&lt;pre&gt;&lt;code&gt;
_:c14n0 &amp;lt;http://activitystrea.ms/2.0/displayName&gt; &quot;Sally&quot; .
_:c14n0 &amp;lt;http://www.w3.org/1999/02/22-rdf-syntax-ns#type&gt; &amp;lt;http://schema.org/Person&gt; .
_:c14n1 &amp;lt;http://activitystrea.ms/2.0/actor&gt; _:c14n0 .
_:c14n1 &amp;lt;http://activitystrea.ms/2.0/object&gt; _:c14n2 .
_:c14n1 &amp;lt;http://www.w3.org/1999/02/22-rdf-syntax-ns#type&gt; &amp;lt;http://schema.org/WatchAction&gt; .
_:c14n2 &amp;lt;http://activitystrea.ms/2.0/displayName&gt; &quot;A Bug&#39;s Life&quot; .
_:c14n2 &amp;lt;http://www.w3.org/1999/02/22-rdf-syntax-ns#type&gt; &amp;lt;http://schema.org/Movie&gt; .
&lt;/code&gt;&lt;/pre&gt;

&lt;p&gt;The compacted JSON-LD form becomes:&lt;/p&gt;

&lt;pre&gt;&lt;code&gt;
{
  &quot;@type&quot;: &quot;http://schema.org/WatchAction&quot;,
  &quot;http://activitystrea.ms/2.0/actor&quot;: {
    &quot;@type&quot;: &quot;http://schema.org/Person&quot;,
    &quot;http://activitystrea.ms/2.0/displayName&quot;: &quot;Sally&quot;
  },
  &quot;http://activitystrea.ms/2.0/object&quot;: {
    &quot;@type&quot;: &quot;http://schema.org/Movie&quot;,
    &quot;http://activitystrea.ms/2.0/displayName&quot;: &quot;A Bug&#39;s Life&quot;
  }
}
&lt;/code&gt;&lt;/pre&gt;

&lt;p&gt;Which is easily translatable into the regular Activity Streams 2.0 syntax by walking backwards using the AS 2.0 JSON-LD context definition. The result, of course, is:&lt;/p&gt;

&lt;pre&gt;&lt;code&gt;
{
  &quot;objectType&quot;: &quot;http://schema.org/WatchAction&quot;,
  &quot;actor&quot;: {
    &quot;objectType&quot;: &quot;http://schema.org/Person&quot;,
    &quot;displayName&quot;: &quot;Sally&quot;
  },
  &quot;object&quot;: {
    &quot;objectType&quot;: &quot;http://schema.org/Movie&quot;,
    &quot;displayName&quot;: &quot;A Bug&#39;s Life&quot;
  }
}
&lt;/code&gt;&lt;/pre&gt;</content><link rel='replies' type='application/atom+xml' href='http://chmod777self.blogspot.com/feeds/4065893608856805777/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://chmod777self.blogspot.com/2014/05/more-on-activity-streams-20-and.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/7390223865029902668/posts/default/4065893608856805777'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/7390223865029902668/posts/default/4065893608856805777'/><link rel='alternate' type='text/html' href='http://chmod777self.blogspot.com/2014/05/more-on-activity-streams-20-and.html' title='More on Activity Streams 2.0 and schema.org/Actions'/><author><name>jasnell</name><uri>http://www.blogger.com/profile/12993461992320512775</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='https://img1.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-7390223865029902668.post-7572477471496784515</id><published>2014-04-30T13:56:00.002-07:00</published><updated>2014-04-30T13:58:22.060-07:00</updated><title type='text'>Activity Streams 2.0 and schema.org/Actions</title><content type='html'>&lt;p&gt;Recently it was announced that &quot;&lt;a href=&quot;https://www.w3.org/wiki/images/1/10/PotentialActionsApril11.pdf&quot;&gt;potential actions&lt;/a&gt;&quot; have been introduced into the schema.org mix. A potential action is simply an Activity that hasn&#39;t yet occurred. Here&#39;s an example borrowed from the potential actions overview document:&lt;/p&gt;

&lt;pre&gt;&lt;code&gt;
{ 
 &quot;@context&quot;: &quot;http://schema.org&quot;, 
 &quot;@type&quot;: &quot;WatchAction&quot;, 
 &quot;actionStatus&quot;: &quot;CompletedActionStatus&quot;, 
 &quot;agent&quot; : { 
   &quot;@type&quot;: &quot;Person&quot;, 
   &quot;name&quot;: &quot;Kevin Bacon&quot; 
 }, 
 &quot;object&quot; : { 
   &quot;@type&quot;: &quot;Movie&quot;, 
   &quot;name&quot;: &quot;Footloose&quot; 
 }, 
 &quot;startTime&quot; : &quot;2014-03-01&quot; 
}
&lt;/code&gt;&lt;/pre&gt;

&lt;p&gt;The first thing that ought to catch your attention is how strikingly familiar this example is to the basic Activity Streams format. Why it was decided to use different labels to express the same content, I have no idea, but since everything leverages JSON-LD, we can easily express the exact same bit of information using the Activity Streams 2.0 format and a little JSON-LD magic:&lt;/p&gt;

&lt;pre&gt;&lt;code&gt;
{
  &quot;verb&quot;: &quot;http://schema.org/WatchAction&quot;,  
  &quot;actor&quot; : { 
    &quot;objectType&quot;: &quot;http://schema.org/Person&quot;, 
    &quot;displayName&quot;: &quot;Kevin Bacon&quot; 
  }, 
  &quot;object&quot; : { 
    &quot;objectType&quot;: &quot;http://schema.org/Movie&quot;, 
    &quot;displayName&quot;: &quot;Footloose&quot; 
  }, 
  &quot;startTime&quot; : &quot;2014-03-01&quot;,
  &quot;status&quot;: &quot;completed&quot;,
  &quot;@context&quot;: {
    &quot;verb&quot;: &quot;@type&quot;,
    &quot;s&quot;: &quot;http://schema.org/&quot;,
    &quot;actor&quot;: &quot;s:agent&quot;,
    &quot;object&quot;: &quot;s:object&quot;,
    &quot;startTime&quot;: &quot;s:startTime&quot;,
    &quot;objectType&quot;: &quot;@type&quot;,
    &quot;displayName&quot;: &quot;s:name&quot;,
    &quot;status&quot;: {
      &quot;@id&quot;:&quot;s:actionStatus&quot;,
      &quot;@type&quot;: &quot;@vocab&quot;
    },
    &quot;completed&quot;: &quot;s:CompletedActionStatus&quot;
  }
}
&lt;/code&gt;&lt;/pre&gt;

&lt;p&gt;This yields the N-Quads:&lt;/p&gt;

&lt;pre&gt;&lt;code&gt;
_:c14n0 &amp;lt;http://schema.org/actionStatus&gt; &amp;lt;http://schema.org/CompletedActionStatus&gt; .
_:c14n0 &amp;lt;http://schema.org/agent&gt; _:c14n2 .
_:c14n0 &amp;lt;http://schema.org/object&gt; _:c14n1 .
_:c14n0 &amp;lt;http://schema.org/startTime&gt; &quot;2014-03-01&quot; .
_:c14n0 &amp;lt;http://www.w3.org/1999/02/22-rdf-syntax-ns#type&gt; &amp;lt;http://schema.org/WatchAction&gt; .
_:c14n1 &amp;lt;http://schema.org/name&gt; &quot;Footloose&quot; .
_:c14n1 &amp;lt;http://www.w3.org/1999/02/22-rdf-syntax-ns#type&gt; &amp;lt;http://schema.org/Movie&gt; .
_:c14n2 &amp;lt;http://schema.org/name&gt; &quot;Kevin Bacon&quot; .
_:c14n2 &amp;lt;http://www.w3.org/1999/02/22-rdf-syntax-ns#type&gt; &amp;lt;http://schema.org/Person&gt; .
&lt;/code&gt;&lt;/pre&gt;

&lt;p&gt;Notice that, in this example, I did not pull in the experimental Activity Streams 2.0 context definition. That&#39;s because I want to interpret the fields as http://schema.org/* properties and not http://activitystrea.ms/2.0/* properties. It&#39;s an important distinction to make. I could easily mix the two vocabularies by including both context descriptions but we just don&#39;t need it for our purposes here.&lt;/p&gt;

&lt;p&gt;Here&#39;s a more complex example taken from the potential actions overview:&lt;/p&gt;

&lt;pre&gt;&lt;code&gt;
{ 
  &quot;@context&quot;: &quot;http://schema.org&quot;, 
  &quot;@type&quot;: &quot;Restaurant&quot;, 
  &quot;name&quot;: &quot;Tartine Bakery&quot;, 
  &quot;potentialAction&quot;: { 
    &quot;@type&quot;: &quot;ViewAction&quot;, 
    &quot;target&quot;: [ 
      &quot;http://www.urbanspoon.com/r/6/92204&quot;, 
      { 
        &quot;@type&quot;: &quot;EntryPoint&quot;, 
        &quot;urlTemplate&quot;: &quot;http://api.urbanspoon.com/r/6/92204&quot;, 
        &quot;contentType&quot;: &quot;application/json+ld&quot; 
      }, 
      &quot;android-app://com.urbanspoon/http/www.urbanspoon.com/r/6/92204&quot;, 
      { 
        &quot;@type&quot;: &quot;EntryPoint&quot;, 
        &quot;urlTemplate&quot;: &quot;urbanspoon://r/6/92204&quot;, 
        &quot;application&quot;: { 
          &quot;@type&quot;: &quot;SoftwareApplication&quot;, 
          &quot;@id&quot;: &quot;284708449&quot;, 
          &quot;name&quot;: &quot;Urbanspoon iPhone &amp;amp; iPad App&quot;, 
          &quot;operatingSystem&quot;: &quot;iOS&quot;
        }
      },
      { 
        &quot;@type&quot;: &quot;EntryPoint&quot;, 
        &quot;urlTemplate&quot;: &quot;urbanspoon://r/6/92204&quot;, 
        &quot;application&quot;: { 
          &quot;@type&quot;: &quot;SoftwareApplication&quot;, 
          &quot;@id&quot;: &quot;5b23b738-bb64-4829-9296-5bcb59bb0d2d&quot;, 
          &quot;name&quot;: &quot;Windows Phone App&quot;, 
          &quot;operatingSystem&quot;: &quot;Windows Phone 8&quot; 
       } 
      } 
    ] 
  } 
} 
&lt;/code&gt;&lt;/pre&gt;

&lt;p&gt;In Activity Streams 2.0, we have the &quot;actions&quot; property which serves the same basic role as the new Schema.org &quot;potentialAction&quot;. Unfortunately, however, there are enough differences in the model that we can&#39;t simply mask over them using a cleverly designed @context definition. But we have a few options.&lt;/p&gt;

&lt;p&gt;The first option, of course, is to simply use &quot;potentialAction&quot; directly...&lt;/p&gt;

&lt;pre&gt;&lt;code&gt;
{ 
  &quot;@context&quot;: {
    &quot;s&quot;: &quot;http://schema.org/&quot;,
    &quot;objectType&quot;: &quot;@type&quot;,
    &quot;displayName&quot;: &quot;s:name&quot;,
    &quot;potentialAction&quot;: &quot;s:potentialAction&quot;
  }, 
  &quot;objectType&quot;: &quot;http://schema.org/Restaurant&quot;, 
  &quot;displayName&quot;: &quot;Tartine Bakery&quot;, 
  &quot;potentialAction&quot;: { 
    &quot;@type&quot;: &quot;ViewAction&quot;, 
    &quot;target&quot;: [ 
      &quot;http://www.urbanspoon.com/r/6/92204&quot;, 
      { 
        &quot;@type&quot;: &quot;EntryPoint&quot;, 
        &quot;urlTemplate&quot;: &quot;http://api.urbanspoon.com/r/6/92204&quot;, 
        &quot;contentType&quot;: &quot;application/json+ld&quot; 
      }, 
      &quot;android-app://com.urbanspoon/http/www.urbanspoon.com/r/6/92204&quot;, 
      { 
        &quot;@type&quot;: &quot;EntryPoint&quot;, 
        &quot;urlTemplate&quot;: &quot;urbanspoon://r/6/92204&quot;, 
        &quot;application&quot;: { 
          &quot;@type&quot;: &quot;SoftwareApplication&quot;, 
          &quot;@id&quot;: &quot;284708449&quot;, 
          &quot;name&quot;: &quot;Urbanspoon iPhone &amp;amp; iPad App&quot;, 
          &quot;operatingSystem&quot;: &quot;iOS&quot;
        }
      },
      { 
        &quot;@type&quot;: &quot;EntryPoint&quot;, 
        &quot;urlTemplate&quot;: &quot;urbanspoon://r/6/92204&quot;, 
        &quot;application&quot;: { 
          &quot;@type&quot;: &quot;SoftwareApplication&quot;, 
          &quot;@id&quot;: &quot;5b23b738-bb64-4829-9296-5bcb59bb0d2d&quot;, 
          &quot;name&quot;: &quot;Windows Phone App&quot;, 
          &quot;operatingSystem&quot;: &quot;Windows Phone 8&quot; 
       } 
      } 
    ] 
  } 
} 
&lt;/code&gt;&lt;/pre&gt;

&lt;p&gt;This gives us a mix of AS 2.0 and Schema.org syntax. The AS 2.0 objectType and displayName properties map cleanly and things Just Work.&lt;/p&gt;

&lt;p&gt;Using purely Activity Streams 2.0 syntax, we can&#39;t exactly duplicate the same model but we can get close and express all the same information (and with a more concise JSON syntax).&lt;/p&gt;

&lt;pre&gt;&lt;code&gt;
{  
  &quot;objectType&quot;: &quot;http://schema.org/Restaurant&quot;, 
  &quot;displayName&quot;: &quot;Tartine Bakery&quot;, 
  &quot;actions&quot;: {
    &quot;view&quot;: [
      &quot;http://www.urbanspoon.com/r/6/92204&quot;,
      &quot;android-app://com.urbanspoon/http/www.urbanspoon.com/r/6/92204&quot;,
      { 
        &quot;objectType&quot;: &quot;HttpActionHandler&quot;, 
        &quot;url&quot;: &quot;http://api.urbanspoon.com/r/6/92204&quot;, 
        &quot;mediaType&quot;: &quot;application/json+ld&quot; 
      },
      { 
        &quot;objectType&quot;: &quot;application&quot;, 
        &quot;url&quot;: &quot;urbanspoon://r/6/92204&quot;,
        &quot;id&quot;: &quot;284708449&quot;,
        &quot;displayName&quot;: &quot;Urbanspoon iPhone &amp;amp; iPad App&quot;,
        &quot;operatingSystem&quot;: &quot;iOS&quot;
      },
       { 
        &quot;objectType&quot;: &quot;application&quot;, 
        &quot;url&quot;: &quot;urbanspoon://r/6/92204&quot;,
        &quot;id&quot;: &quot;5b23b738-bb64-4829-9296-5bcb59bb0d2d&quot;,
        &quot;displayName&quot;: &quot;Window Phone App&quot;,
        &quot;operatingSystem&quot;: &quot;Windows Phone 8&quot;
      }
    ]
  },
  &quot;@context&quot;: {
    &quot;s&quot;: &quot;http://schema.org/&quot;,
    &quot;objectType&quot;: &quot;@type&quot;,
    &quot;displayName&quot;: &quot;s:name&quot;,
    &quot;potentialAction&quot;: &quot;s:potentialAction&quot;,
    &quot;actions&quot;: &quot;s:potentialAction&quot;,
    &quot;view&quot;: {
      &quot;@type&quot;: &quot;@vocab&quot;,
      &quot;@id&quot;: &quot;s:ViewAction&quot;
    },
    &quot;application&quot;: &quot;s:SoftwareApplication&quot;,
    &quot;HttpActionHandler&quot;: &quot;s:EntryPoint&quot;,
    &quot;template&quot;: &quot;s:urlTemplate&quot;,
    &quot;mediaType&quot;: &quot;s:contentType&quot;,
    &quot;url&quot;: &quot;s:urlTemplate&quot;,
    &quot;operatingSystem&quot;: &quot;s:operatingSystem&quot;
  }
} 
&lt;/code&gt;&lt;/pre&gt;

&lt;p&gt;This yields the following N-Quads:&lt;/p&gt;

&lt;pre&gt;&lt;code&gt;
_:c14n0 &amp;lt;http://schema.org/name&gt; &quot;Urbanspoon iPhone &amp;amp; iPad App&quot; .
_:c14n0 &amp;lt;http://schema.org/operatingSystem&gt; &quot;iOS&quot; .
_:c14n0 &amp;lt;http://schema.org/urlTemplate&gt; &quot;urbanspoon://r/6/92204&quot; .
_:c14n0 &amp;lt;http://www.w3.org/1999/02/22-rdf-syntax-ns#type&gt; &amp;lt;http://schema.org/SoftwareApplication&gt; .
_:c14n1 &amp;lt;http://schema.org/name&gt; &quot;Tartine Bakery&quot; .
_:c14n1 &amp;lt;http://schema.org/potentialAction&gt; _:c14n4 .
_:c14n1 &amp;lt;http://www.w3.org/1999/02/22-rdf-syntax-ns#type&gt; &amp;lt;http://schema.org/Restaurant&gt; .
_:c14n2 &amp;lt;http://schema.org/name&gt; &quot;Window Phone App&quot; .
_:c14n2 &amp;lt;http://schema.org/operatingSystem&gt; &quot;Windows Phone 8&quot; .
_:c14n2 &amp;lt;http://schema.org/urlTemplate&gt; &quot;urbanspoon://r/6/92204&quot; .
_:c14n2 &amp;lt;http://www.w3.org/1999/02/22-rdf-syntax-ns#type&gt; &amp;lt;http://schema.org/SoftwareApplication&gt; .
_:c14n3 &amp;lt;http://schema.org/contentType&gt; &quot;application/json+ld&quot; .
_:c14n3 &amp;lt;http://schema.org/urlTemplate&gt; &quot;http://api.urbanspoon.com/r/6/92204&quot; .
_:c14n3 &amp;lt;http://www.w3.org/1999/02/22-rdf-syntax-ns#type&gt; &amp;lt;http://schema.org/EntryPoint&gt; .
_:c14n4 &amp;lt;http://schema.org/ViewAction&gt; &amp;lt;android-app://com.urbanspoon/http/www.urbanspoon.com/r/6/92204&gt; .
_:c14n4 &amp;lt;http://schema.org/ViewAction&gt; &amp;lt;http://www.urbanspoon.com/r/6/92204&gt; .
_:c14n4 &amp;lt;http://schema.org/ViewAction&gt; _:c14n0 .
_:c14n4 &amp;lt;http://schema.org/ViewAction&gt; _:c14n2 .
_:c14n4 &amp;lt;http://schema.org/ViewAction&gt; _:c14n3 .
&lt;/code&gt;&lt;/pre&gt;

&lt;p&gt;Breaking this down, this tells us that the &quot;actions&quot; property is equivalent to &quot;http://schema.org/potentialAction&quot;, and that our &quot;potentialAction&quot; has five possible Actions. How these come across in the N-Quads is different relative to the pure schema.org alternative but it really is the same information.&lt;/p&gt;

&lt;p&gt;One last example... The potential actions overview document includes the following:&lt;/p&gt;

&lt;pre&gt;&lt;code&gt;
{ 
 &quot;@context&quot;: &quot;http://schema.org&quot;, 
 &quot;@type&quot;: &quot;WebSite&quot;, 
 &quot;name&quot;: &quot;Example.com&quot;, 
 &quot;potentialAction&quot;: { 
 &quot;@type&quot;: &quot;SearchAction&quot;, 
 &quot;target&quot;: &quot;http://example.com/search?q={q}&quot;, 
 &quot;query-input&quot;: &quot;required maxlength=100 name=q&quot; 
 } 
} 

&lt;/code&gt;&lt;/pre&gt;

&lt;p&gt;I have to say, that &quot;query-input&quot; element is just nasty. Here&#39;s the equivalent Activity Streams 2.0 Actions syntax (without the @context to keep things simple):&lt;/p&gt;

&lt;pre&gt;&lt;code&gt;
{
  &quot;objectType&quot;: &quot;http://schema.org/WebSite&quot;,
  &quot;displayName&quot;: &quot;Example.com&quot;,
  &quot;actions&quot;: {
    &quot;search&quot;: {
      &quot;objectType&quot;: &quot;UrlTemplate&quot;,
      &quot;template&quot;: &quot;http://example.com/search?q={q}&quot;,
      &quot;parameters&quot;: {
        &quot;q&quot;: {
          &quot;required&quot;: true,
          &quot;maxlength&quot;: 100
        }
      }
    }
  }
}
&lt;/code&gt;&lt;/pre&gt;

&lt;p&gt;The former is less verbose but the latter will be easier to process given that it does not require any micro-syntax parsing.&lt;/p&gt;
</content><link rel='replies' type='application/atom+xml' href='http://chmod777self.blogspot.com/feeds/7572477471496784515/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://chmod777self.blogspot.com/2014/04/activity-streams-20-and-schemaorgactions.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/7390223865029902668/posts/default/7572477471496784515'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/7390223865029902668/posts/default/7572477471496784515'/><link rel='alternate' type='text/html' href='http://chmod777self.blogspot.com/2014/04/activity-streams-20-and-schemaorgactions.html' title='Activity Streams 2.0 and schema.org/Actions'/><author><name>jasnell</name><uri>http://www.blogger.com/profile/12993461992320512775</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='https://img1.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-7390223865029902668.post-8568436547404251443</id><published>2014-04-29T21:21:00.003-07:00</published><updated>2014-04-30T12:12:44.518-07:00</updated><title type='text'>Activity Streams 2.0 + JSON-LD</title><content type='html'>&lt;p&gt;For those who like to process their Activity Streams 2.0 using JSON-LD, &lt;a href=&quot;https://github.com/jasnell/activitystreams.jsonld&quot;&gt;this&lt;/a&gt; may be useful: It&#39;s an experimental JSON-LD Context Definition for Activity Streams 2.0. For the time being, I am hosting a working copy of the context definition here: &lt;strike&gt;&lt;a href=&quot;http://asjsonld.ng.bluemix.net&quot;&gt;http://asjsonld.ng.bluemix.net&lt;/a&gt;&lt;/strike&gt; &lt;b&gt;Update:&lt;/b&gt; Use &lt;a href=&quot;https://w3id.org/activity-streams/v2&quot;&gt;https://w3id.org/activity-streams/v2&lt;/a&gt; to reference (&lt;a href=&quot;https://plus.google.com/+JamesSnell/posts/BMRJ1NkyU6i&quot;&gt;thanks Manu!&lt;/a&gt;)&lt;/p&gt;

&lt;p&gt;For example, given the following simple bit of AS 2.0 markup with an included @context property:&lt;/p&gt;

&lt;p&gt;&lt;b&gt;Updated:&lt;/b&gt;&lt;/p&gt;

&lt;pre&gt;&lt;code&gt;
{
  &quot;@context&quot;: &quot;https://w3id.org/activity-streams/v2&quot;,
  &quot;verb&quot;: &quot;post&quot;,
  &quot;actor&quot;: &quot;acct:joe@example.org&quot;,
  &quot;object&quot;: &quot;http://example.org/posts/1&quot;,
  &quot;updated&quot;: &quot;2014-12-12T12:12:12.123Z&quot;
}
&lt;/code&gt;&lt;/pre&gt;

&lt;p&gt;We can derive the following Expanded JSON-LD view:&lt;/p&gt;

&lt;pre&gt;&lt;code&gt;
[
  {
    &quot;http://activitystrea.ms/2.0/actor&quot;: [
      {
        &quot;@id&quot;: &quot;acct:joe@example.org&quot;
      }
    ],
    &quot;http://activitystrea.ms/2.0/object&quot;: [
      {
        &quot;@id&quot;: &quot;http://example.org/posts/1&quot;
      }
    ],
    &quot;http://activitystrea.ms/2.0/updated&quot;: [
      {
        &quot;@type&quot;: &quot;xsd:dateTime&quot;,
        &quot;@value&quot;: &quot;2014-12-12T12:12:12.123Z&quot;
      }
    ],
    &quot;http://activitystrea.ms/2.0/verb&quot;: [
      {
        &quot;@value&quot;: &quot;post&quot;
      }
    ]
  }
]
&lt;/code&gt;&lt;/pre&gt;

&lt;p&gt;Processed further, this yields the N-Quads:&lt;/p&gt;

&lt;pre&gt;&lt;code&gt;
_:b0 &amp;lt;http://activitystrea.ms/2.0/actor&gt; &amp;lt;acct:joe@example.org&gt; .
_:b0 &amp;lt;http://activitystrea.ms/2.0/object&gt; &amp;lt;http://example.org/posts/1&gt; .
_:b0 &amp;lt;http://activitystrea.ms/2.0/updated&gt; &quot;2014-12-12T12:12:12.123Z&quot;^^&amp;lt;xsd:dateTime&gt; .
_:b0 &amp;lt;http://activitystrea.ms/2.0/verb&gt; &quot;post&quot; .
&lt;/code&gt;&lt;/pre&gt;

&lt;p&gt;This is just a &lt;strike&gt;first&lt;/strike&gt; &lt;i&gt;second&lt;/i&gt; pass on the context, so some of the details may change. The &lt;a href=&quot;https://github.com/jasnell/activitystreams.jsonld&quot;&gt;project&lt;/a&gt; is hosted on my github account. Feel free to set pull requests. All contributions will be assumed licensed RF under the Apache v2 license.&lt;/p&gt;

&lt;p&gt;&lt;b&gt;Update:&lt;/b&gt; A detailed example that pulls from multiple JSON-LD vocabularies (derived from an example given on the &lt;a href=&quot;http://json-ld.org/playground/&quot;&gt;JSON-LD Playground&lt;/a&gt;):&lt;/p&gt;

&lt;pre&gt;&lt;code&gt;
{
  &quot;@context&quot;: &quot;https://w3id.org/activity-streams/v2&quot;,
  &quot;actor&quot;: {
    &quot;objectType&quot;: &quot;person&quot;,
    &quot;displayName&quot;: &quot;Joe&quot;
  },
  &quot;verb&quot;: &quot;post&quot;,
  &quot;object&quot;: {
    &quot;id&quot;: &quot;http://example.org/cars/for-sale#tesla&quot;,
    &quot;objectType&quot;: &quot;http://purl.org/goodrelations/v1#&quot;,
    &quot;displayName&quot;: &quot;Used Tesla Roadster&quot;,
    &quot;content&quot;: &quot;Need to sell fast and furiously&quot;,
    &quot;gr:hasBusinessFunction&quot;: &quot;gr:Sell&quot;,
    &quot;gr:acceptedPaymentMethods&quot;: &quot;gr:Cash&quot;,
    &quot;gr:hasPriceSpecification&quot;: {
      &quot;gr:hasCurrencyValue&quot;: &quot;85000&quot;,
      &quot;gr:hasCurrency&quot;: &quot;USD&quot;
    },
    &quot;gr:includes&quot;: {
      &quot;@type&quot;: [
        &quot;gr:Individual&quot;,
        &quot;pto:Vehicle&quot;
      ],
      &quot;gr:name&quot;: &quot;Tesla Roadster&quot;,
      &quot;foaf:page&quot;: &quot;http://www.teslamotors.com/roadster&quot;
    },
    &quot;@context&quot;: {
      &quot;gr&quot;: &quot;http://purl.org/goodrelations/v1#&quot;,
      &quot;pto&quot;: &quot;http://www.productontology.org/id/&quot;,
      &quot;foaf&quot;: &quot;http://xmlns.com/foaf/0.1/&quot;,
      &quot;xsd&quot;: &quot;http://www.w3.org/2001/XMLSchema#&quot;,
      &quot;foaf:page&quot;: {
        &quot;@type&quot;: &quot;@id&quot;
      },
      &quot;gr:acceptedPaymentMethods&quot;: {
        &quot;@type&quot;: &quot;@id&quot;
      },
      &quot;gr:hasBusinessFunction&quot;: {
        &quot;@type&quot;: &quot;@id&quot;
      },
      &quot;gr:hasCurrencyValue&quot;: {
        &quot;@type&quot;: &quot;xsd:float&quot;
      },      
      &quot;displayName&quot;: &quot;gr:name&quot;,
      &quot;content&quot;: &quot;gr:description&quot;,
      &quot;objectType&quot;: &quot;@type&quot;
    }
  }
}
&lt;/code&gt;&lt;/pre&gt;

&lt;p&gt;This yields the following N-Quads:&lt;/p&gt;

&lt;pre&gt;&lt;code&gt;
&amp;lt;http://example.org/cars/for-sale#tesla&gt; &amp;lt;http://purl.org/goodrelations/v1#acceptedPaymentMethods&gt; &amp;lt;http://purl.org/goodrelations/v1#Cash&gt; .
&amp;lt;http://example.org/cars/for-sale#tesla&gt; &amp;lt;http://purl.org/goodrelations/v1#description&gt; &quot;Need to sell fast and furiously&quot; .
&amp;lt;http://example.org/cars/for-sale#tesla&gt; &amp;lt;http://purl.org/goodrelations/v1#hasBusinessFunction&gt; &amp;lt;http://purl.org/goodrelations/v1#Sell&gt; .
&amp;lt;http://example.org/cars/for-sale#tesla&gt; &amp;lt;http://purl.org/goodrelations/v1#hasPriceSpecification&gt; _:b2 .
&amp;lt;http://example.org/cars/for-sale#tesla&gt; &amp;lt;http://purl.org/goodrelations/v1#includes&gt; _:b3 .
&amp;lt;http://example.org/cars/for-sale#tesla&gt; &amp;lt;http://purl.org/goodrelations/v1#name&gt; &quot;Used Tesla Roadster&quot; .
&amp;lt;http://example.org/cars/for-sale#tesla&gt; &amp;lt;http://www.w3.org/1999/02/22-rdf-syntax-ns#type&gt; &amp;lt;http://purl.org/goodrelations/v1#&gt; .
_:b0 &amp;lt;http://activitystrea.ms/2.0/actor&gt; _:b1 .
_:b0 &amp;lt;http://activitystrea.ms/2.0/object&gt; &amp;lt;http://example.org/cars/for-sale#tesla&gt; .
_:b0 &amp;lt;http://activitystrea.ms/2.0/verb&gt; &quot;post&quot; .
_:b1 &amp;lt;http://activitystrea.ms/2.0/displayName&gt; &quot;Joe&quot; .
_:b1 &amp;lt;http://activitystrea.ms/2.0/objectType&gt; &quot;person&quot; .
_:b2 &amp;lt;http://purl.org/goodrelations/v1#hasCurrency&gt; &quot;USD&quot; .
_:b2 &amp;lt;http://purl.org/goodrelations/v1#hasCurrencyValue&gt; &quot;85000&quot;^^&amp;lt;http://www.w3.org/2001/XMLSchema#float&gt; .
_:b3 &amp;lt;http://purl.org/goodrelations/v1#name&gt; &quot;Tesla Roadster&quot; .
_:b3 &amp;lt;http://www.w3.org/1999/02/22-rdf-syntax-ns#type&gt; &amp;lt;http://purl.org/goodrelations/v1#Individual&gt; .
_:b3 &amp;lt;http://www.w3.org/1999/02/22-rdf-syntax-ns#type&gt; &amp;lt;http://www.productontology.org/id/Vehicle&gt; .
_:b3 &amp;lt;http://xmlns.com/foaf/0.1/page&gt; &amp;lt;http://www.teslamotors.com/roadster&gt; .
&lt;/code&gt;&lt;/pre&gt;</content><link rel='replies' type='application/atom+xml' href='http://chmod777self.blogspot.com/feeds/8568436547404251443/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://chmod777self.blogspot.com/2014/04/activity-streams-20-json-ld.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/7390223865029902668/posts/default/8568436547404251443'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/7390223865029902668/posts/default/8568436547404251443'/><link rel='alternate' type='text/html' href='http://chmod777self.blogspot.com/2014/04/activity-streams-20-json-ld.html' title='Activity Streams 2.0 + JSON-LD'/><author><name>jasnell</name><uri>http://www.blogger.com/profile/12993461992320512775</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='https://img1.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-7390223865029902668.post-1504125035295871582</id><published>2014-04-28T08:43:00.001-07:00</published><updated>2014-04-28T08:43:44.472-07:00</updated><title type='text'>Incremental extension verb and objectType discovery</title><content type='html'>&lt;p&gt;Late last week I checked in the initial implementation of a new experimental module for &lt;a href=&quot;https://github.com/OpenSocial/activitystreams/tree/master/typext&quot;&gt;Type Value extensions&lt;/a&gt; in the Activity Streams 2.0 Java Reference Implementation. This module does two things:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Adds &quot;verb&quot; and &quot;objectType&quot; objectType support for defining, obviously, new verb and objectType identifiers.&lt;/li&gt;
&lt;li&gt;Adds a TypeValueRegistry that will attempt to resolve simple Type Values into expanded Object forms.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;For review, go back and read &lt;a href=&quot;http://www.chmod777self.com/2014/03/verbs-and-nouns-in-activity-streams.html&quot;&gt;my previous post&lt;/a&gt; covering Type Value extensions. The short version is this: In Activity Streams 2.0, the &quot;verb&quot; and &quot;objectType&quot; properties have evolved into &quot;Type Values&quot;. A &quot;Type Value&quot; can be represented either as a simple String containing either a token or an absolute IRI or it can be represented as an object in it&#39;s own right. Below are examples of all three choices:&lt;/p&gt;

&lt;pre&gt;&lt;code&gt;
  {
    &quot;actor&quot;: &quot;acct:sally@example.org&quot;,
    &lt;b&gt;&quot;verb&quot;: &quot;post&quot;,&lt;/b&gt;
    &quot;object&quot;: &quot;http://example.org/foo/bar&quot;
  }

  {
    &quot;actor&quot;: &quot;acct:sally@example.org&quot;,
    &lt;b&gt;&quot;verb&quot;: &quot;http://example.org/verbs/foo&quot;,&lt;/b&gt;
    &quot;object&quot;: &quot;http://example.org/foo/bar&quot;
  }

  {
    &quot;actor&quot;: &quot;acct:sally@example.org&quot;,
    &lt;b&gt;&quot;verb&quot;: {
      &quot;id&quot;: &quot;http://example.org/verbs/foo&quot;,
      &quot;displayName&quot;: &quot;Foo&quot;
    },&lt;/b&gt;
    &quot;object&quot;: &quot;http://example.org/foo/bar&quot;
  }
&lt;/code&gt;&lt;/pre&gt;

&lt;p&gt;The first two forms are carry overs from the original Activity Streams 1.0 specification. One of the key downsides of using extension verbs and objectTypes in Activity Streams 1.0 is that the syntax offered absolutely no means of allowing implementations to learn about the new identifiers. This meant that systems had to implemented with static dictionaries of objectTypes and verbs. With 2.0, the ability to represent these values as objects gives us a way of providing rich metadata about extension type values.&lt;/p&gt;

&lt;p&gt;So how would this work? There are two basic approaches:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Include the type value object definition directly in your activity stream document (as in the third example above), or&lt;/li&gt;
&lt;li&gt;Reference the type value object definition by URL and allow an implementation to dynamically resolve it at runtime.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;The new TypeValueRegistry takes the second approach.&lt;/p&gt;

&lt;p&gt;Let&#39;s suppose your Activity Streams server implementation receives the following Activity statement from a client:&lt;/p&gt;

&lt;pre&gt;&lt;code&gt;
  {
    &quot;actor&quot;: &quot;acct:sally@example.org&quot;,
    &quot;verb&quot;: &quot;http://example.org/verbs/foo&quot;,
    &quot;object&quot;: &quot;http://example.org/foo/bar&quot;
  }
&lt;/code&gt;&lt;/pre&gt;

&lt;p&gt;Now let&#39;s suppose that your implementation has never encountered the &quot;http://example.org/verbs/foo&quot; verb before. The fact that your system does not understand the semantics of the extension verb will make it far more difficult to do anything intelligent with it. Sure, there is some basic level of processing you can do, but try to render an intelligent UI representation of the activity statement and you&#39;re pretty much up the proverbial creek.&lt;/p&gt;

&lt;p&gt;The first step, then, is to see if there&#39;s someway you can learn about this new verb. The most logical approach is to simply do an HTTP GET request against the HTTP URL given by the verb identifier... that&#39;s exactly what the new TypeValueRegistry implementation does:&lt;/p&gt;

&lt;pre&gt;&lt;code&gt;
  TypeValueRegistry tvr = 
    TypeValueRegistry
      .makeDefaultSilent(io);
    
  Future&amp;lt;TypeValue&gt; tvf = 
    tvr.resolve(&quot;http://example.org/verbs/foo&quot;);

  TypeValue tv = tvf.get();

  if (tv.valueType() == ValueType.OBJECT) {
    ASObject obj = (ASObject)tv;
    //... 
  }
&lt;/code&gt;&lt;/pre&gt;

&lt;p&gt;By default, the TypeValueRegistry uses a local in-memory Google Guava cache to store resolved extension type value objects in memory. When you call the TypeValueRegistry.resolve method, it does and checks that cache to see if the type has already been resolved. If it&#39;s not found, an HTTP GET request is attempted to the URI given. If that request returns a 2xx response, it attempts to parse the resulting data as a JSON Activity Streams 2.0 document. If parsing is successful, the resulting document is scanned for information pertaining to the given identifier. If the identifier is found, the associated object data is loaded into the cache and returned to the caller. All of this happens asynchronously using an ExecutorService (that you can configure).&lt;/p&gt;

&lt;p&gt;The TypeValueRegistry can be preloaded when the object is created by dropping typeValues.json files into your local Java classpath. You can drop as many into the classpath as you&#39;d like. The files MUST be Activity Streams 2.0 Collection Documents. (It&#39;s also possible to drop in Java serialized instances of the com.ibm.common.activitystreams.Collection object... I&#39;ll document that more in the official project docs tho).&lt;/p&gt;

&lt;p&gt;By default, items in the cache are only kept around for about ten minutes after they&#39;re last used. I&#39;m going to be fixing that so that the preloaded cache items never expire but that&#39;ll likely not happen until later this week or next.&lt;/p&gt;

&lt;p&gt;There are still plenty of details that need to be worked out and the TypeValueRegistry only provides a partial solution to the extensibility problem. As I discussed in my previous &lt;a href=&quot;http://www.chmod777self.com/2014/03/verbs-and-nouns-in-activity-streams.html&quot;&gt;post&lt;/a&gt;, there are a range of semantic and linguistic properties that also need to be addressed in order to make working with extension verbs and objectTypes much more fluid and natural. I should be able to fill in most of those details in the coming weeks but it&#39;ll take quite a bit of experimentation to get it done properly.&lt;/p&gt;</content><link rel='replies' type='application/atom+xml' href='http://chmod777self.blogspot.com/feeds/1504125035295871582/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://chmod777self.blogspot.com/2014/04/incremental-extension-verb-and.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/7390223865029902668/posts/default/1504125035295871582'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/7390223865029902668/posts/default/1504125035295871582'/><link rel='alternate' type='text/html' href='http://chmod777self.blogspot.com/2014/04/incremental-extension-verb-and.html' title='Incremental extension verb and objectType discovery'/><author><name>jasnell</name><uri>http://www.blogger.com/profile/12993461992320512775</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='https://img1.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-7390223865029902668.post-8527979350533355144</id><published>2014-04-22T09:28:00.002-07:00</published><updated>2014-04-22T09:29:23.961-07:00</updated><title type='text'>Now on Github: Activity Streams 2.0 Reference Implementation</title><content type='html'>&lt;p&gt;I am quite happy to report that IBM gave me the green light to open source Activity Streams 2.0 Reference implementations for Java and JavaScript. The projects are out on Github and have been contributed as part of the OpenSocial Incubator:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;&lt;a href=&quot;https://github.com/OpenSocial/activitystreams&quot;&gt;Activity Streams 2.0 - Java&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href=&quot;https://github.com/OpenSocial/activitystreams.js&quot;&gt;Activity Streams 2.0 - JavaScript&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href=&quot;https://github.com/OpenSocial/incubator&quot;&gt;OpenSocial Incubator&lt;/a&gt;&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Along with this, I have also pushed a minor update to the base Activity Streams 2.0 draft spec that includes some new advice on the creation of new extension verbs and objectTypes along with a few other minor bits and pieces. The updated draft can be found here: &lt;a href=&quot;http://tools.ietf.org/html/draft-snell-activitystreams-07&quot;&gt;http://tools.ietf.org/html/draft-snell-activitystreams-07&lt;/a&gt;.&lt;/p&gt;

&lt;p&gt;First, let&#39;s look at the &lt;a href=&quot;https://github.com/OpenSocial/activitystreams&quot;&gt;Java reference implementation&lt;/a&gt;.&lt;/p&gt;

&lt;h3&gt;Java:&lt;/h3&gt;

&lt;p&gt;Because the code currently is considered a pre-release snapshot, we&#39;re not currently pushing artifacts to a maven repository, so to grab the code and make use of it, clone from git and do a local maven install:&lt;/p&gt;

&lt;pre&gt;&lt;code&gt;
git clone https://github.com/OpenSocial/activitystreams.git
cd activitystreams
mvn install
&lt;/code&gt;&lt;/pre&gt;

&lt;p&gt;(To generate the Javadocs for the project, do an additional &lt;code&gt;mvn javadoc:javadoc&lt;/code&gt; call. The javadocs for each module will be located in each modules target directory)&lt;/p&gt;

&lt;p&gt;The maven project consists of a single core package and three extension modules. The mvn install command will build each of the modules and install the artifacts into your local maven repository. Once complete, you can use the core and extension modules by adding the following to your maven pom.xml files:&lt;/p&gt;

&lt;pre&gt;&lt;code&gt;
  &amp;lt;dependency&gt;
    &amp;lt;groupId&gt;com.ibm.common&amp;lt;/groupId&gt;
    &amp;lt;artifactId&gt;activitystreams&amp;lt;/artifactId&gt;
    &amp;lt;version&gt;0.0.1-SNAPSHOT&amp;lt;/version&gt;
  &amp;lt;/dependency&gt;

  &amp;lt;dependency&gt;
    &amp;lt;groupId&gt;com.ibm.common&amp;lt;/groupId&gt;
    &amp;lt;artifactId&gt;activitystreams-actions&amp;lt;/artifactId&gt;
    &amp;lt;version&gt;0.0.1-SNAPSHOT&amp;lt;/version&gt;
  &amp;lt;/dependency&gt;

  &amp;lt;dependency&gt;
    &amp;lt;groupId&gt;com.ibm.common&amp;lt;/groupId&gt;
    &amp;lt;artifactId&gt;activitystreams-geo&amp;lt;/artifactId&gt;
    &amp;lt;version&gt;0.0.1-SNAPSHOT&amp;lt;/version&gt;
  &amp;lt;/dependency&gt;

  &amp;lt;dependency&gt;
    &amp;lt;groupId&gt;com.ibm.common&amp;lt;/groupId&gt;
    &amp;lt;artifactId&gt;activitystreams-legacy&amp;lt;/artifactId&gt;
    &amp;lt;version&gt;0.0.1-SNAPSHOT&amp;lt;/version&gt;
  &amp;lt;/dependency&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;p&gt;(note: the package names on the java implementation will be changing to org.opensocial.activitystreams.* sometime before the 1.0 release occurs)&lt;/p&gt;

&lt;p&gt;The core module depends on three other common open source projects:&lt;/p&gt;

&lt;ul&gt;
  &lt;li&gt;&lt;a href=&quot;https://code.google.com/p/guava-libraries/&quot;&gt;Guava Library 16.0.1&lt;/a&gt;&lt;/li&gt;
  &lt;li&gt;&lt;a href=&quot;http://www.joda.org/joda-time/&quot;&gt;Joda-Time 2.3&lt;/a&gt;&lt;/li&gt;
  &lt;li&gt;&lt;a href=&quot;https://code.google.com/p/google-gson/&quot;&gt;GSON 2.2.4&lt;/a&gt;&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;If you&#39;re not a maven user, you&#39;ll need to make sure each of these are in your classpath to make use of the reference implementation.&lt;/p&gt;

&lt;p&gt;Once you&#39;ve got the dependencies worked out, you can use the reference implementation to easily produce and consume Activity Streams 2.0 data structures:&lt;/p&gt;

&lt;pre&gt;&lt;code&gt;
import static com.ibm.common.activitystreams.Makers.activity;
import static com.ibm.common.activitystreams.Makers.object;

public class Example {

  public static void main(String... args) {

    Activity activity = 
     activity()
       .actor(object(&quot;person&quot;).id(&quot;acct:joe@example.org&quot;))
       .object(object(&quot;note&quot;).content(&quot;my note&quot;))
       .verb(&quot;post&quot;)
       .get();

    activity.writeTo(System.out);

  }

}
&lt;/code&gt;&lt;/pre&gt;

&lt;p&gt;The reference implementation uses a fluent generator API pattern throughout. Builder&#39;s are used to construct instances of specific object types. Those instances, once created, are immutable. The Builder APIs are designed to allow methods to be chained.&lt;/p&gt;

&lt;p&gt;In the example above, the &lt;code&gt;com.ibm.common.activitystreams.Makers.activity&lt;/code&gt; creates and returns a new instance of the &lt;code&gt;com.ibm.common.activitystreams.Activity.Builder&lt;/code&gt; class. Calling the &lt;code&gt;actor&lt;/code&gt;, &lt;code&gt;object&lt;/code&gt; and &lt;code&gt;verb&lt;/code&gt; methods on that builder set the corresponding properties on the underlying JSON element. The &lt;code&gt;get&lt;/code&gt; method returns the constructed, immutable Activity object.&lt;/p&gt;

&lt;p&gt;Looking at the call to &lt;code&gt;actor&lt;/code&gt; above, the actor property is being set as an object with objectType &quot;person&quot; and an id of &quot;acct:joe@example.org&quot;. The call to &lt;code&gt;object(&quot;person&quot;)&lt;/code&gt; creates and returns a &lt;code&gt;com.ibm.common.activitystreams.ASObject.Builder&lt;/code&gt; instance with the objectType property pre-set.&lt;/p&gt;

&lt;p&gt;The call to &lt;code&gt;activity.writeTo(System.out)&lt;/code&gt; serializes the Activity object out to stdout using the default options.&lt;/p&gt;

&lt;p&gt;While this API is a significant departure from the traditional Java POJO getter/setter pattern, it allows developers to write clear, concise code that naturally follows the Activity Streams 2.0 data model.&lt;/p&gt;

&lt;p&gt;The &lt;code&gt;com.ibm.common.activitystreams.IO&lt;/code&gt; object is used to read Activity Stream objects from raw JSON. For instance:&lt;/p&gt;

&lt;pre&gt;&lt;code&gt;

  private final static IO io = IO.makeDefault();
  //...

  InputStream in = ...;

  Activity activity = io.readAsActivity(in);

  TypeValue tv = activity.verb();
  System.out.println(tv.id()); // &quot;post&quot;

  ASObject actor = activity.firstActor();
  System.out.println(actor.id()); // &quot;acct:joe@example.org&quot;

  for (ASObject object : activity.object())
    System.out.println(object.objectType().id()) // &quot;note&quot;

  // iterate all properties
  for (String key : activity)
    System.out.println(activity.get(key));
&lt;/code&gt;&lt;/pre&gt;

&lt;p&gt;The IO object is the interface primarily responsible for serializing and deserializing the JSON Activity Stream objects. Instances of the IO object are immutable and threadsafe. Typically, you&#39;ll want to just create one instance and set it as a static constant. Once created, you can use of several &lt;code&gt;read*&lt;/code&gt; methods to parse an InputStream, Reader or raw input String.&lt;/p&gt;

&lt;p&gt;Again, the API exposed by the reference implementation is not a traditional getter/setter pattern. The objects are immutable and instead of calling a method like &quot;getVerb()&quot; to get the verb (for instance), you&#39;d just call &quot;verb()&quot;. Refer to the Javadocs for complete details on all of the various methods on the objects.&lt;/p&gt;

&lt;p&gt;You can find a few more examples on how to use the core API &lt;a href=&quot;https://github.com/OpenSocial/activitystreams/tree/master/core/src/examples/com/ibm/common/activitystreams/examples&quot;&gt;here&lt;/a&gt;.

&lt;p&gt;(One quick sidenote... even though the objects do not follow the traditional Java POJO model and are immutable, they do implement java.io.Serializable.)&lt;/p&gt;

&lt;p&gt;The core project includes complete support for the primary Activity Streams 2.0 vocabulary. It is possible to extend the capabilities of the core project through the use of modules. The reference implementation comes with three such modules out of the box:&lt;/p&gt;

&lt;ul&gt;
  &lt;li&gt;Activity Streams 2.0 Actions (see http://tools.ietf.org/html/draft-snell-activitystreams-actions-03),&lt;/li&gt;
  &lt;li&gt;GeoJSON (see http://geojson.org/), and&lt;/li&gt;
  &lt;li&gt;Legacy objectTypes (see https://github.com/activitystreams/activity-schema/blob/master/activity-schema.md)&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;The Actions module provides &lt;i&gt;currently experimental&lt;/i&gt; support for the data structures defined by the draft &lt;a href=&quot;http://tools.ietf.org/html/draft-snell-activitystreams-actions-03&quot;&gt;Activity Streams 2.0 Action Handlers&lt;/a&gt; specification. Action Handlers are something that I&#39;ve discussed before on this blog so I won&#39;t go into too much detail here just yet. Take a look &lt;a href=&quot;https://github.com/OpenSocial/activitystreams/blob/master/actions/src/examples/com/ibm/common/activitystreams/actions/example/Actions.java&quot;&gt;here&lt;/a&gt; for a detailed example of how the Actions module is used to produce and consume Action Handler markup.&lt;/p&gt;

&lt;p&gt;The GeoJSON module provides an implementation of the &lt;a href=&quot;http://geojson.org/geojson-spec.html&quot;&gt;GeoJSON specification&lt;/a&gt; and adds the ability to include GeoJSON objects in an Activity Streams 2.0 document.&lt;/p&gt;

&lt;p&gt;The Legacy module provides an implementation of many of the older Activity Streams 1.0 core objectTypes defined in the original &quot;&lt;a href=&quot;https://github.com/activitystreams/activity-schema/blob/master/activity-schema.md&quot;&gt;Activity Streams Base Schema&lt;/a&gt;&quot;.&lt;/p&gt;

&lt;p&gt;Refer to the documentation for details on how to enable and use each of the modules.&lt;p&gt;

&lt;h3&gt;JavaScript:&lt;/h3&gt;

&lt;p&gt;The JavaScript reference implementation provides a thin wrapper around ordinary JavaScript objects that allows easy and consistent handling as &quot;Activity Stream Objects&quot;. (Note that, currently, the implementation makes use of several newer features of the JavaScript language that may not be implemented in older Web browsers). You can use the JavaScript library both on the browser and within Node (the node module is not yet registered with npm but that will be coming very soon).&lt;/p&gt;

&lt;p&gt;You&#39;ll need the &lt;a href=&quot;http://yeoman.io/&quot;&gt;Yeoman&lt;/a&gt; toolchain to build:&lt;/p&gt;

&lt;pre&gt;&lt;code&gt;
git co https://github.com/OpenSocial/activitystreams.js.git
cd activitystreams.js
grunt
&lt;/code&gt;&lt;/pre&gt;

&lt;p&gt;Once built, you simply drop the javascript library into your app and use:&lt;/p&gt;

&lt;p&gt;HTML:&lt;/p&gt;
&lt;pre&gt;&lt;code&gt;
&amp;lt;html&gt;
&amp;lt;head&gt;
  &amp;lt;script src=&quot;js/activitystreams.min.js&quot;&gt;&amp;lt;/script&gt;
  &amp;lt;script&gt;
    var activity = asms.Activity({
      verb: &#39;post&#39;,
      actor: {
        displayName: &#39;Joe&#39;,
        id: &#39;acct:joe@example.org&#39;
      },
      object: {
        objectType: &#39;note&#39;,
        content: &#39;This is a short note&#39;
      },
      updated: new Date()
    });

    console.log(activity.verb.id);
    console.log(activity.actor.displayName);
    console.log(activity.object.objectType.id);
    console.log(activity.object.content[&#39;*&#39;]);

    console.log(activity.toString()); // output json
  &amp;lt;/script&gt;
&amp;lt;/head&gt;
&amp;lt;/html&gt;
&lt;/pre&gt;&lt;/code&gt;

&lt;p&gt;Node.js:&lt;/p&gt;
&lt;pre&gt;&lt;code&gt;
var asms = require(&#39;activitystreams&#39;);
var activity = asms.Activity({
  verb: &#39;post&#39;,
  actor: {
    displayName: &#39;Joe&#39;,
    id: &#39;acct:joe@example.org&#39;
  },
  object: {
    objectType: &#39;note&#39;,
    content: &#39;This is a short note&#39;
  },
  updated: new Date()
});

console.log(activity.verb.id);
console.log(activity.actor.displayName);
console.log(activity.object.objectType.id);
console.log(activity.object.content[&#39;*&#39;]);

console.log(activity.toString()); // output json
&lt;/code&gt;&lt;/pre&gt;

&lt;p&gt;In each of the two examples above, we create an ordinary JavaScript object and pass it as an argument to the &lt;code&gt;asms.Activity()&lt;/code&gt; method. This method wraps the JavaScript object within an wrapper that enforces the Activity Streams data format. &lt;/p&gt;

&lt;p&gt;Refer to the documentation &lt;a href=&quot;https://github.com/OpenSocial/activitystreams.js&quot;&gt;here&lt;/a&gt; for more details. Also, the grunt build will generate jsdocs for the library.&lt;/p&gt;

&lt;h3&gt;Contributions Welcome...&lt;/h3&gt;

&lt;p&gt;The Java and JavaScript reference implementations have been contributed by IBM to the OpenSocial Incubator. To contribute, refer to the &quot;&lt;a href=&quot;https://github.com/OpenSocial/activitystreams/blob/master/CONTRIBUTING.md&quot;&gt;CONTRIBUTING&lt;/a&gt;&quot; document in each of the projects. It&#39;s fairly painless... there&#39;s a Contributor License Agreement to sign, then fork the repo, make your changes and submit pull requests. Issues can be tracked &lt;a href=&quot;https://github.com/OpenSocial/activitystreams/issues&quot;&gt;here&lt;/a&gt; and &lt;a href=&quot;https://github.com/OpenSocial/activitystreams.js/issues&quot;&gt;here&lt;/a&gt;.&lt;/p&gt;

&lt;p&gt;I will be looking to get the first official 1.0 release ready by the end of May 2014.&lt;/p&gt;</content><link rel='replies' type='application/atom+xml' href='http://chmod777self.blogspot.com/feeds/8527979350533355144/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://chmod777self.blogspot.com/2014/04/now-on-github-activity-streams-20.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/7390223865029902668/posts/default/8527979350533355144'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/7390223865029902668/posts/default/8527979350533355144'/><link rel='alternate' type='text/html' href='http://chmod777self.blogspot.com/2014/04/now-on-github-activity-streams-20.html' title='Now on Github: Activity Streams 2.0 Reference Implementation'/><author><name>jasnell</name><uri>http://www.blogger.com/profile/12993461992320512775</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='https://img1.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-7390223865029902668.post-6543246215431261089</id><published>2014-03-10T12:44:00.000-07:00</published><updated>2014-03-10T12:44:00.231-07:00</updated><title type='text'>Verbs and Nouns in Activity Streams</title><content type='html'>&lt;p&gt;While the &lt;a href=&quot;http://tools.ietf.org/html/draft-snell-activitystreams-05&quot;&gt;Activity Streams data format&lt;/a&gt; is generally intended to provide machine readable descriptions of past, present or future events, those of use who use the format often have the need to translate those machine readable statements into human readable ones. For example, the following:&lt;/p&gt;

&lt;pre&gt;&lt;code&gt;
{
  &quot;actor&quot;: {
    &quot;displayName&quot;: &quot;Joe&quot;
  },
  &quot;verb&quot;: &quot;give&quot;,
  &quot;object&quot;: {
    &quot;objectType&quot;: &quot;book&quot;,
    &quot;id&quot;: &quot;http://example.org/books/123&quot;,
    &quot;displayName&quot;: &quot;Moby Dick&quot;
  },
  &quot;target&quot;: {
    &quot;displayName&quot;: &quot;Sally&quot;
  }
}
&lt;/code&gt;&lt;/pre&gt;

&lt;p&gt;Can be translated into the English sentence, &quot;Joe gave Sally the book &#39;Moby Dick&#39;&quot;; or, more generally, &quot;Joe gave Sally a book&quot;. As we all know, there are several alternative forms that all express the same idea (some clearly less desirable than others): &quot;Joe gave a book to Sally&quot;, &quot;The book, &#39;Moby Dick&#39; was given to Sally by Joe&quot;, &quot;Sally received a book from Joe&quot;, and so on.&lt;/p&gt;

&lt;p&gt;Exactly &lt;i&gt;how&lt;/i&gt; an Activity Statement is translated into English depends entirely on the characteristics of the statement, the object types used and the verb. The Activity Streams vocabulary and structure has been intentionally left wide open to allow for a great deal of flexibility in how it is used. Unfortunately, this flexibility causes a great deal of ambiguity and difficulty when summarizing statements using natural language. This difficulty is increased significantly when we take extension verbs and objectTypes into consideration. To help deal with these ambiguities, I have been kicking around the notion of introducing formal linguistic characteristics to the &quot;verb&quot; and &quot;objectType&quot; definitions in Activity Streams 2.0.&lt;/p&gt;

&lt;p&gt;If you look at the current AS 2.0 specification draft, you&#39;ll see that the &quot;verb&quot; and &quot;objectType&quot; properties have been reimagined as &quot;Type Values&quot;. A &quot;Type Value&quot; is represented as either an implicit or explicit object. Implicit object type values are represented as Strings that contain either a simple token (e.g. &quot;post&quot;) or an absolute IRI (e.g. &quot;http://example.org/verbs/post&quot;). Explicit object types values are represented directly as JSON objects.&lt;/p&gt;

&lt;p&gt;For example:&lt;/p&gt;

&lt;pre&gt;&lt;code&gt;
  {
    ...,
    &quot;verb&quot;: &quot;post&quot;,
    ...
  }
&lt;/code&gt;&lt;/pre&gt;

&lt;p&gt;Here, the verb &quot;post&quot; is semantically equivalent* to: &lt;/p&gt;

&lt;pre&gt;&lt;code&gt;
  {
    &quot;verb&quot;: {
      &quot;id&quot;: &quot;post&quot;
    }
  }
&lt;/code&gt;&lt;/pre&gt;

&lt;p&gt;(* there is a caveat here in that &lt;i&gt;simple token&lt;/i&gt; verbs such as &quot;post&quot; MUST always be represented in String form... so while &quot;verb&quot;:&quot;post&quot; is equivalent to &quot;verb&quot;:{&quot;id&quot;:&quot;post&quot;}, only the former can be used within an Activity Streams 2.0 document. This is because the &quot;id&quot; property value is always required to be an absolute IRI.)&lt;/p&gt;

&lt;p&gt;What this essentially means is that all verbs (and objectType&#39;s) are first class objects within Activity Streams and can have their own properties and characteristics. For example, a verb can have a &quot;displayName&quot;:&lt;/p&gt;

&lt;pre&gt;&lt;code&gt;
  {
    &quot;verb&quot;: {
      &quot;id&quot;: &quot;http://example.org/verbs/foo&quot;,
      &quot;displayName&quot;: &quot;Foo&quot;
    }
  }
&lt;/code&gt;&lt;/pre&gt;

&lt;p&gt;A Type Value&#39;s characteristics can help an implementation figure out what exactly the type value means and how to use it. This, for instance, comes in handy when we want to associate an extension objectType with an existing semantic model:&lt;/p&gt;

&lt;pre&gt;&lt;code&gt;
  {
    &quot;objectType&quot;: &quot;objectType&quot;,
    &quot;id&quot;: &quot;http://example.org/foo&quot;,
    &quot;@type&quot;: &quot;http://schema.org/Person&quot;
  }
&lt;/code&gt;&lt;/pre&gt;

&lt;p&gt;In this case, we are using the Activity Streams 2.0 JSON-LD alignment (the &quot;@type&quot; property) to indicate that extension objectType &quot;http://example.org/foo&quot; is a realization of the Schema.org Person type.&lt;/p&gt;

&lt;p&gt;The &quot;Linguistic Characteristics&quot; of a verb and objectType are the collection of properties that describe how those objects are used within a natural language. For verbs, these characteristics include things like valency, conjugation regularity, tense, aspect and modality. For objectTypes, they include concepts such as countability, gender, collectiveness and animation. By understanding these characteristics, we can better interpret (and express) exactly what information is conveyed within an Activity Statement.&lt;/p&gt;

&lt;p&gt;Let&#39;s start with verbs.&lt;/p&gt;

&lt;p&gt;While the specific form and conjugation of verbs vary greatly from one language to the next, the type and function of verbs is generally universal. There are, for instance, Intransitive Verbs (verbs that only require a subject, such as &quot;I walk&quot;, &quot;He is walking&quot;, &quot;You walked&quot;, etc), Transitive Verbs (those that have both a subject and a direct object, such as &quot;Joe read the newspaper&quot;, and Ditransitive Verbs (those that have a subject, direct object and indirect object, such as &quot;Joe gave the money to Sally&quot;). There are also Linking Verbs (&quot;Joe became worried&quot;) and Existential verbs (&quot;Joe is alive&quot;, &quot;Mike was here&quot;, etc).&lt;/p&gt;

&lt;p&gt;Within the Activity Streams format, we are primarily concerned with Intransitive, Transitive, Ditransitive and Existential verb forms that may or may not be expressed in terms of tense or aspect. In other words, using Activity Streams 2.0, we can express concepts such as &quot;Joe lives&quot;, &quot;Joe is running&quot;, &quot;Joe wrote a letter&quot;, and &quot;Joe gave a book to Sally&quot; but generally not statements such as &quot;Joe became worried&quot;. (Note that, in very rare cases, it is possible for an Activity Statement to convey avalent verbs, that is verbs with no actor, object or target. I&#39;ll discuss these cases later.)&lt;/p&gt;

&lt;p&gt;In order make it easier to comprehend the use of verbs within an Activity Stream document, I am exploring the ability to explicitly mark the linguistic characteristics of verbs within the Type Value definition. For instance:&lt;/p&gt;

&lt;pre&gt;&lt;code&gt;
  {
    &quot;objectType&quot;: &quot;verb&quot;,
    &quot;id&quot;: &quot;http://example.org/verbs/sneeze&quot;,
    &quot;displayName&quot;: &quot;sneeze&quot;, 
    &quot;linguistic&quot;: {
      &quot;en&quot;: {
        &quot;infinitive&quot;: &quot;sneeze&quot;,
        &quot;category&quot;: &quot;semelfactive&quot;,
        &quot;flags&quot;: [&quot;intransitive&quot;]
      }
    }
  }
&lt;/code&gt;&lt;/pre&gt;

&lt;p&gt;Here, the verb identified as &quot;http://example.org/verbs/sneeze&quot; is assigned the infinitive English-language root &quot;sneeze&quot;. It is defined as a semelfactive verb with the intransitive characteristic. This essentially means that Activity Statements using this verb will not contain an &quot;object&quot; property, and that the &quot;startTime&quot;/&quot;endTime&quot; properties (if present) will be the same (the event was instantaneous).&lt;/p&gt;

&lt;pre&gt;&lt;code&gt;
  {
    &quot;actor&quot;: {
      &quot;displayName&quot;: &quot;Joe&quot;
    },
    &quot;verb&quot;: &quot;http://example.org/verbs/sneeze&quot;,
    &quot;startTime&quot;: &quot;2014-12-12T12:12:12Z&quot;,
    &quot;endTime&quot;: &quot;2014-12-12T12:12:12Z&quot;
  }
&lt;/code&gt;&lt;/pre&gt;

&lt;p&gt;It is possible for intransitive verbs to have an indirect object (the &quot;target&quot; of the action). For instance:&lt;/p&gt;

&lt;pre&gt;&lt;code&gt;
  {
    &quot;objectType&quot;: &quot;verb&quot;,
    &quot;id&quot;: &quot;http://example.org/verbs/sit&quot;,
    &quot;displayName&quot;: &quot;sit&quot;,
    &quot;linguistic&quot;: {
      &quot;en&quot;: {
        &quot;infinitive&quot;: &quot;sit&quot;,
        &quot;category&quot;: &quot;activity&quot;,
        &quot;flags&quot;: [&quot;intransitive&quot;]
      }
    }
  }
&lt;/code&gt;&lt;/pre&gt;

&lt;pre&gt;&lt;code&gt;
  {
    &quot;actor&quot;: {
      &quot;displayName&quot;: &quot;Joe&quot;
    },
    &quot;verb&quot;: &quot;http://example.org/verbs/sit&quot;, 
    &quot;target&quot;: {
      &quot;objectType&quot;: &quot;chair&quot;
    },
    &quot;startTime&quot;: &quot;2014-01-01T12:00:00Z&quot;
  }
&lt;/code&gt;&lt;/pre&gt;

&lt;p&gt;Note that in this example, there is a startTime but no endTime. Because the &quot;sit&quot; verb is defined as belonging to the &quot;activity&quot; linguistic category, it is assumed to be durative (occurring over time) without having a natural end point. In other words, the above statement indicates that Joe is &lt;i&gt;currently sitting&lt;/i&gt; on a chair (the target).&lt;/p&gt;

&lt;p&gt;In most cases, verbs used in Activity Statements will be &quot;transitive&quot; (actor+object) and/or &quot;ditransitive&quot; (actor+object+target).&lt;/p&gt;

&lt;pre&gt;&lt;code&gt;
  {
    &quot;objectType&quot;: &quot;verb&quot;,
    &quot;id&quot;: &quot;http://example.org/verbs/approve&quot;,
    &quot;displayName&quot;: &quot;approve&quot;,
    &quot;linguistic&quot;: {
      &quot;en&quot;: {
        &quot;infinitive&quot;: &quot;approve&quot;,
        &quot;category&quot;: &quot;semelfactive&quot;,
        &quot;flags&quot;: [&quot;transitive&quot;]
      }
    }
  }

  {
    &quot;objectType&quot;: &quot;verb&quot;,
    &quot;id&quot;: &quot;http://example.org/verbs/upload&quot;,
    &quot;displayName&quot;: &quot;upload&quot;,
    &quot;linguistic&quot;: {
      &quot;en&quot;: {
        &quot;infinitive&quot;: &quot;upload&quot;,
        &quot;category&quot;: &quot;accomplishment&quot;,
        &quot;flags&quot;: [&quot;transitive&quot;,&quot;ditransitive&quot;]
      }
    }
  }
&lt;/code&gt;&lt;/pre&gt;

&lt;p&gt;&quot;Joe approved the proposal&quot;:&lt;/p&gt;
&lt;code&gt;&lt;pre&gt;
  {
    &quot;actor&quot;: {
      &quot;displayName&quot;: &quot;Joe&quot;
    },
    &quot;verb&quot;: &quot;http://example.org/verbs/approve&quot;,
    &quot;object&quot;: {
      &quot;objectType&quot;: &quot;proposal&quot;
    } 
  }
&lt;/pre&gt;&lt;/code&gt;

&lt;p&gt;&quot;Joe uploaded the proposal to the server&quot;:&lt;/p&gt;
&lt;code&gt;&lt;pre&gt;
  {
    &quot;actor&quot;: {
      &quot;displayName&quot;: &quot;Joe&quot;
    },
    &quot;verb&quot;: &quot;http://example.org/verbs/upload&quot;,
    &quot;object&quot;: {
      &quot;objectType&quot;: &quot;proposal&quot;
    },
    &quot;target&quot;: {
      &quot;objectType&quot;: &quot;server&quot;
    }
  }
&lt;/pre&gt;&lt;/code&gt;

&lt;p&gt;While it is perfectly legal to use these verbs in an intransitive sense (&quot;The file uploaded&quot;, &quot;The proposal was approved&quot;), doing so using the Activity Streams format is generally not going to be all that useful.&lt;/p&gt;

&lt;p&gt;Note that the &quot;linguistic&quot; property examples below are all scoped to the &quot;en&quot; language tag (English). This allows us to specify distinct handling of verbs depending on specific language context -- that is, while a specific verb infinitive might use regular conjugation in one language, it may be irregular in another. If you end up needing to define some characteristics globally independent of language, but still define language specific characteristics, the special &quot;*&quot; language can be used:&lt;/p&gt;

&lt;pre&gt;&lt;code&gt;
  {
    &quot;objectType&quot;: &quot;verb&quot;,
    &quot;id&quot;: &quot;http://example.org/verbs/bake&quot;,
    &quot;displayName&quot;: &quot;bake&quot;,
    &quot;linguistic&quot;: {
      &quot;*&quot;: {
        &quot;category&quot;: &quot;accomplishment&quot;,
        &quot;flags&quot;: [&quot;transitive&quot;]
      },
      &quot;en&quot;: {
        &quot;infinitive&quot;: &quot;bake&quot;
      },
      &quot;de&quot;: {
        &quot;infinitive&quot;: &quot;backen&quot;,
        &quot;present&quot;: &quot;backt&quot;,
        &quot;perfect&quot;: &quot;gebacken&quot;,
        &quot;passive&quot;: &quot;gebacken&quot;,
        &quot;imperfect&quot;: &quot;backte&quot;,
        &quot;flags&quot;: [&quot;irregular&quot;]
      }
    }
  }
&lt;/code&gt;&lt;/pre&gt;

&lt;p&gt;In this case, when dealing with an English language context, we can determine that the verb &quot;http://example.org/verbs/bake&quot; is a regularly conjugated, transitive accomplishment (i.e. &quot;baked&quot;, &quot;baking&quot;, &quot;have baked&quot;, &quot;will bake&quot;, etc). However, when dealing with a German language context, the verb is handled as irregular with specific conjugations given.&lt;/p&gt;

&lt;p&gt;Within the linguistic property, the possible values for &quot;category&quot; are:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;activity&lt;/li&gt;
&lt;li&gt;accomplishment&lt;/li&gt;
&lt;li&gt;state&lt;/li&gt;
&lt;li&gt;achievement&lt;/li&gt;
&lt;li&gt;semelfactive&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;These correlate to the generally accepted Lexical Aspects of all verbs (that is, they describe how the verb relates to time).&lt;/p&gt;

&lt;p&gt;The &quot;flags&quot; property value is an array containing one or more of:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;intransitive&lt;/li&gt;
&lt;li&gt;transitive&lt;/li&gt;
&lt;li&gt;ditransitive&lt;/li&gt;
&lt;li&gt;irregular&lt;/li&gt;
&lt;li&gt;idiomatic&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;The flags are cumulative. For instance, a verb marked as being &quot;intransitive&quot; and &quot;transitive&quot; can be used with or without an &quot;object&quot; property in the Activity statement.&lt;/p&gt;

&lt;p&gt;The &quot;irregular&quot; flag indicates that the verb forms are &quot;irregular&quot; in respect to default language-specific conjugation rules. Depending on the language context, additional properties may be specified that detail the specific conjugations.&lt;/p&gt;

&lt;p&gt;The &quot;idiomatic&quot; flag indicates that the verb form is idiomatic. A common example of this is the verb &quot;flag-as-inappropriate&quot;. Such verb forms do not have specific infinitives in the traditional sense, but are rather expressed in terms of a &quot;verb phrase&quot;, i.e. &quot;Joe flagged the post as inappropriate&quot;.&lt;/p&gt;

&lt;p&gt;The &quot;infinitive&quot; property is used express the base form of the verb in any given language. This is also referred to as the &quot;dictionary form&quot;. Verbs marked as being &quot;idiomatic&quot; will not typically include the &quot;infinitive&quot; property.&lt;/p&gt;

&lt;p&gt;Verbs are only part of the equation, however. The nouns (objectTypes) are equally as important. For those, I propose an equivalent linguistic definition that capture characteristic such as countability, rationality, collectiveness and gender:&lt;/p&gt;

&lt;pre&gt;&lt;code&gt;
  {
    &quot;objectType&quot;: &quot;objectType&quot;,
    &quot;id&quot;: &quot;http://example.org/nouns/woman&quot;,
    &quot;displayName&quot;: &quot;woman&quot;,
    &quot;@type&quot;: &quot;http://schema.org/Person&quot;,
    &quot;linguistic&quot;: {
      &quot;*&quot;: {
        &quot;flags&quot;: [&quot;feminine&quot;,&quot;countable&quot;,&quot;rational&quot;]
      },
      &quot;en&quot;: {
        &quot;root&quot;: &quot;woman&quot;,
        &quot;collective&quot;: &quot;women&quot;,
        &quot;flags&quot;: [&quot;irregular&quot;]
      }
    }
  }

  {
    &quot;objectType&quot;: &quot;objectType&quot;,
    &quot;id&quot;: &quot;http://example.org/nouns/man&quot;,
    &quot;displayName&quot;: &quot;man&quot;,
    &quot;@type&quot;: &quot;http://schema.org/Person&quot;,
    &quot;linguistic&quot;: {
      &quot;*&quot;: {
        &quot;flags&quot;: [&quot;masculine&quot;,&quot;countable&quot;,&quot;rational&quot;]
      }, 
      &quot;en&quot;: {
        &quot;root&quot;: &quot;man&quot;,
        &quot;collective&quot;: &quot;men&quot;,
        &quot;flags&quot;: [&quot;irregular&quot;]
      }
    }
  }
&lt;/code&gt;&lt;/pre&gt;

&lt;p&gt;To a native English speaker, the notion of gender specific treatment of nouns and verbs is a bit odd, as there are very few gender specific nouns in modern use (pronouns are a different story, of course). But in many languages, Russian for instance, nouns can be assigned specific gender qualities. The gender of a noun changes the structure of the natural language sentence that uses the noun. So if I have the existential Activity Statement:&lt;/p&gt;

&lt;pre&gt;&lt;code&gt;
  {
    &quot;actor&quot;: {&quot;displayName&quot;: &quot;Mary&quot;},
    &quot;verb&quot;: &quot;is&quot;,
    &quot;object&quot;: {
      &quot;objectType&quot;: &quot;leader&quot;
    }
  }
&lt;/code&gt;&lt;/pre&gt;

&lt;p&gt;Absent any gender specific clues, I&#39;d likely end up with a grammatically correct but semantically incorrect Russian translation: &quot;Мария &lt;b&gt;был&lt;/b&gt; лидером&quot;. If, however, we introduce the ability to specify gender clues, we can derive a proper feminine form translation: &quot;Мария &lt;b&gt;была&lt;/b&gt; лидером&quot;&lt;/p&gt;

&lt;pre&gt;&lt;code&gt;
  {
    &quot;actor&quot;: {
      &quot;displayName&quot;: &quot;Mary&quot;,
      &quot;objectType&quot;: &quot;http://example.org/noun/woman&quot;
    },
    &quot;verb&quot;: &quot;is&quot;,
    &quot;object&quot;: {
      &quot;objectType&quot;: &quot;leader&quot;
    }
  }
&lt;/code&gt;&lt;/pre&gt;

&lt;p&gt;The &quot;flags&quot; for objectTypes currently include:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;irregular - nouns that are irregular in respect to language default plurality&lt;/li&gt;
&lt;li&gt;feminimne - feminine gender&lt;/li&gt;
&lt;li&gt;masculine - masculine gender&lt;/li&gt;
&lt;li&gt;neutral - neutral gender&lt;/li&gt;
&lt;li&gt;countable - nouns that have a plural form&lt;/li&gt;
&lt;li&gt;uncountable - nouns that do not have a natural plural form&lt;/li&gt;
&lt;li&gt;collective - nouns that have a collective aspect&lt;/li&gt;
&lt;li&gt;rational - nouns that represent rational (sentient, animated, etc) constructs&lt;/li&gt;
&lt;li&gt;abstract - nouns that represent abstract concepts&lt;/li&gt;
&lt;li&gt;concrete - nouns that represent concrete concepts&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;As with verbs, the flags are cumulative. A noun that specifies generally mutually exclusive flags (e.g. &quot;countable&quot; and &quot;uncountable&quot;) indicates that the noun can be used in both ways.&lt;/p&gt;

&lt;p&gt;The &quot;root&quot; property is used to specify the root dictionary form of the noun. For irregular nouns, the &quot;collective&quot; property defines the specific plural form.&lt;/p&gt;

&lt;p&gt;Now, there&#39;s a natural question here: if I&#39;m using extension verbs, am I supposed to include this linguistic detail *EVERY* time I use the verb or objectType? The answer, of course, is: You can, but you don&#39;t have to.&lt;/p&gt;

&lt;p&gt;By convention, one approach is to ensure that all of your extension verb and objectType identifiers use HTTP dereferencable URIs. For instance:&lt;/p&gt;

&lt;pre&gt;&lt;code&gt;
  {
    &quot;actor&quot;: {
      &quot;objectType&quot;: &quot;http://example.org/nouns#woman&quot;,
      &quot;displayName&quot;: &quot;Sally&quot;
    }
  }
&lt;/code&gt;&lt;/pre&gt; 

&lt;p&gt;If I&#39;ve never encountered the &quot;http://example.org/nouns/woman&quot; objectType before, I have several options: 1) I can fallback to some default behavior specific to my implementation, 2) I can ignore it or 3) I could send an HTTP GET request to &quot;http://example.org/nouns/woman&quot; in an attempt to retrieve some information about that objectType. Something like:&lt;/p&gt;

&lt;pre&gt;&lt;code&gt;
GET /nouns HTTP/1.1
Host: example.org

HTTP/1.1 200 OK
Content-Type: application/activity+json

{
  &quot;items&quot;: [
  {
    &quot;objectType&quot;: &quot;objectType&quot;,
    &quot;id&quot;: &quot;http://example.org/nouns#woman&quot;,
    &quot;displayName&quot;: &quot;woman&quot;,
    &quot;@type&quot;: &quot;http://schema.org/Person&quot;,
    &quot;linguistic&quot;: {
      &quot;*&quot;: {
        &quot;flags&quot;: [&quot;feminine&quot;,&quot;countable&quot;,&quot;rational&quot;]
      },
      &quot;en&quot;: {
        &quot;root&quot;: &quot;woman&quot;,
        &quot;collective&quot;: &quot;women&quot;,
        &quot;flags&quot;: [&quot;irregular&quot;]
      }
    }
  },
  {
    &quot;objectType&quot;: &quot;objectType&quot;,
    &quot;id&quot;: &quot;http://example.org/nouns#man&quot;,
    &quot;displayName&quot;: &quot;man&quot;,
    &quot;@type&quot;: &quot;http://schema.org/Person&quot;,
    &quot;linguistic&quot;: {
      &quot;*&quot;: {
        &quot;flags&quot;: [&quot;masculine&quot;,&quot;countable&quot;,&quot;rational&quot;]
      }, 
      &quot;en&quot;: {
        &quot;root&quot;: &quot;man&quot;,
        &quot;collective&quot;: &quot;men&quot;,
        &quot;flags&quot;: [&quot;irregular&quot;]
      }
    }
  } 
  ]
}
&lt;/code&gt;&lt;/pre&gt;

&lt;p&gt;This approach allows implementers who are publishing new extension verb and objectType values to define those as reusable libraries that are incrementally discoverable by consuming applications without inflating the verboseness of the actual Activity Statements being passed around. The discovery step can happen asynchronously to the actual processing of the statement. And the result returned is durable and cacheable.&lt;/p&gt;

&lt;p&gt;For now, that is all. Keep in mind that this is all just something that I&#39;ve been kicking around. It&#39;s not yet a part of the core Activity Streams spec (I&#39;ll probably write it up as an extension draft). Any comments/feedback is welcomed and appreciated. There is a lot of work that would need to go into solidifying this idea.&lt;/p&gt;</content><link rel='replies' type='application/atom+xml' href='http://chmod777self.blogspot.com/feeds/6543246215431261089/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://chmod777self.blogspot.com/2014/03/verbs-and-nouns-in-activity-streams.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/7390223865029902668/posts/default/6543246215431261089'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/7390223865029902668/posts/default/6543246215431261089'/><link rel='alternate' type='text/html' href='http://chmod777self.blogspot.com/2014/03/verbs-and-nouns-in-activity-streams.html' title='Verbs and Nouns in Activity Streams'/><author><name>jasnell</name><uri>http://www.blogger.com/profile/12993461992320512775</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='https://img1.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-7390223865029902668.post-8336724759259437896</id><published>2014-01-24T12:36:00.000-08:00</published><updated>2014-01-24T12:36:38.453-08:00</updated><title type='text'>JSON id references</title><content type='html'>&lt;p&gt;The &lt;a href=&quot;http://tools.ietf.org/html/rfc6901&quot;&gt;JSON Pointer&lt;/a&gt; spec provides a great bit of functionality for referencing into the structure of a JSON document. For instance, if I have a bit of JSON like &lt;code&gt;{&quot;a&quot;:{&quot;b&quot;:{&quot;c&quot;:1}}}&lt;/code&gt;, I can create a JSON Pointer like &lt;code&gt;&quot;/a/b/c&quot;&lt;/code&gt; to reference the value of &quot;c&quot;. That&#39;s really a critical piece of functionality when referencing into a JSON document structure.&lt;/p&gt;

&lt;p&gt;However, there is one important bit of functionality that JSON Pointer is missing, however: referencing JSON objects by ID the way we can in HTML and XML. The challenge, of course, is that JSON documents do not have a standardized &quot;ID&quot; attribute the way HTML and XML have. So let&#39;s define one.&lt;/p&gt;

&lt;p&gt;Suppose we have the following JSON document at &lt;code&gt;http://example.org/foo.json&lt;/code&gt;&lt;/p&gt;

&lt;pre&gt;&lt;code&gt;
{
  &quot;items&quot;: [
    {
      &quot;id&quot;: &quot;a&quot;,
      &quot;title&quot;: &quot;foo&quot;,
      &quot;child&quot;: {
        &quot;id&quot;: &quot;b&quot;,
        &quot;title&quot;: &quot;bar&quot;
      }
    },
    {
      &quot;id&quot;: &quot;c&quot;,
      &quot;title&quot;: &quot;baz&quot;
    }
  ]
}
&lt;/code&gt;&lt;/pre&gt;

&lt;p&gt;The URL &lt;code&gt;http://example.org/foo.json#$b&lt;/code&gt; denotes a reference to the object that contains &lt;code&gt;&quot;id&quot;: &quot;b&quot;&lt;/code&gt;, regardless of where it appears within the overall document. To keep things simple, there are no parent/child/ancestor types of relationships. If there happens to be more than one object with &lt;code&gt;&quot;id&quot;: &quot;b&quot;&lt;/code&gt; in the document, the reference will be to all matching objects. Obviously, this reference syntax only allows referencing JSON objects.&lt;/p&gt;

&lt;p&gt;The same approach works if the value of &quot;id&quot; is a number rather than a string:&lt;/p&gt;

&lt;pre&gt;&lt;code&gt;
{
  &quot;items&quot;: [
    {
      &quot;id&quot;: 1,
      &quot;title&quot;: &quot;foo&quot;,
      &quot;child&quot;: {
        &quot;id&quot;: 2,
        &quot;title&quot;: &quot;bar&quot;
      }
    },
    {
      &quot;id&quot;: 3,
      &quot;title&quot;: &quot;baz&quot;
    }
  ]
}
&lt;/code&gt;&lt;/pre&gt;

&lt;p&gt;The URL &lt;code&gt;http://example.org/foo.json#$2&lt;/code&gt; still just works.&lt;/p&gt;

&lt;p&gt;But what if the value of &quot;id&quot; is not a JSON string or number? Well, then we just ignore it and assume we can&#39;t reference it.&lt;/p&gt;

&lt;p&gt;But what if we&#39;re using a JSON variant like &lt;a href=&quot;http://www.w3.org/TR/2014/REC-json-ld-20140116/#syntax-tokens-and-keywords&quot;&gt;JSON-LD&lt;/a&gt; that uses it&#39;s own variation on &quot;id&quot; (JSON-LD uses &quot;@id&quot;). Well, in such cases, we can go ahead and assert that &quot;id&quot; and &quot;@id&quot; are equivalent as far as resolution is concerned. So if I happen to have:&lt;/p&gt;

&lt;pre&gt;&lt;code&gt;
{
  &quot;items&quot;: [
    {
      &quot;@id&quot;: &quot;a&quot;,
      &quot;title&quot;: &quot;foo&quot;,
      &quot;child&quot;: {
        &quot;@id&quot;: &quot;b&quot;,
        &quot;title&quot;: &quot;bar&quot;
      }
    },
    {
      &quot;@id&quot;: &quot;c&quot;,
      &quot;title&quot;: &quot;baz&quot;
    }
  ]
}
&lt;/code&gt;&lt;/pre&gt;

&lt;p&gt;Then &lt;code&gt;http://example.org/foo.json#$b&lt;/code&gt; still Just Works as expected.&lt;/p&gt;

&lt;p&gt;Ok so that looks fine, but hold on a sec: In many JSON vocabularies that use &quot;id&quot; and &quot;@id&quot;, the value of the identifier is a fully qualified URI in it&#39;s own right. It would suck if we always had to drop a full URL in as the value of a document fragment identifier. So for these cases, an alternative &quot;anchor&quot; attribute could be adopted. For instance:&lt;/p&gt;

&lt;pre&gt;&lt;code&gt;
{
  &quot;items&quot;: [
    {
      &quot;id&quot;: &quot;http://example.org/Item/1A2B3C&quot;,
      &quot;anchor&quot;: &quot;a&quot;,
      &quot;title&quot;: &quot;foo&quot;,
      &quot;child&quot;: {
        &quot;id&quot;: &quot;http://example.org/Item/123ABC&quot;,
        &quot;anchor&quot;: &quot;b&quot;,
        &quot;title&quot;: &quot;bar&quot;
      }
    },
    {
      &quot;id&quot;: &quot;http://example.org/Item/ABC123&quot;,
      &quot;anchor&quot;: &quot;c&quot;,
      &quot;title&quot;: &quot;baz&quot;
    }
  ]
}
&lt;/code&gt;&lt;/pre&gt;

&lt;p&gt;To reference an object by it&#39;s anchor value, we&#39;d use a slightly different syntax: &quot;&lt;code&gt;http://example.org/foo.json#@b&lt;/code&gt;&quot;. In the example above this reference is equivalent to &quot;&lt;code&gt;http://example.org/foo.json#$http://example.org/Item/123ABC&lt;/code&gt;&quot;. For consistency with JSON-LD, we could say that &quot;anchor&quot; and &quot;@anchor&quot; are equivalent.&lt;/p&gt;

&lt;p&gt;Ok, so let&#39;s look at a practical example of this in action. Let&#39;s suppose I&#39;ve got an Activity Stream that uses a new extension verb and object type. I want to make it possible to discover new and interesting things about the new verb and objectType. First, I would publish a JSON document that contains my verb and objectType definitions. Let&#39;s put this at &lt;code&gt;http://example.org/types&lt;/code&gt;:&lt;/p&gt;

&lt;pre&gt;&lt;code&gt;
{
  &quot;title&quot;: &quot;My Activity Extensions&quot;,
  &quot;items&quot;: [
    {
      &quot;objectType&quot;: &quot;verb&quot;,
      &quot;id&quot;: &quot;http://example.org/types#@plusone&quot;,
      &quot;anchor&quot;: &quot;plusone&quot;,
      &quot;displayName&quot;: &quot;+1&quot;,
      &quot;alias&quot;: &quot;like&quot; 
    },
    {
      &quot;objectType&quot;: &quot;objectType&quot;,
      &quot;id&quot;: &quot;http://example.org/types#@article&quot;,
      &quot;anchor&quot;: &quot;article&quot;,
      &quot;displayName&quot;: &quot;An Article!&quot;
    }
  ]
}
&lt;/code&gt;&lt;/pre&gt;

&lt;p&gt;Then in my Activity statement, I could do:&lt;/p&gt;

&lt;pre&gt;&lt;code&gt;
{
  &quot;verb&quot;: &quot;http://example.org/types#@plusone&quot;,
  &quot;actor&quot;: &quot;acct:joe@example.com&quot;,
  &quot;object&quot;: {
    &quot;objectType&quot;: &quot;http://example.org/types#@article&quot;,
    &quot;displayName&quot;: &quot;Thoughts&quot;,
    &quot;id&quot;: &quot;http://example.org/articles/1&quot;
  }
}
&lt;/code&gt;&lt;/pre&gt;

&lt;p&gt;When processing this Activity Statement, if the processor has never encountered the &quot;http://example.org/types#@plusone&quot; verb and &quot;http://example.org/types#@article&quot; objectType before, it could deference the URI, resolve the anchor and find out anything it needs to know from the reference.&lt;/p&gt;

&lt;p&gt;Any thoughts?&lt;/p&gt;</content><link rel='replies' type='application/atom+xml' href='http://chmod777self.blogspot.com/feeds/8336724759259437896/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://chmod777self.blogspot.com/2014/01/json-id-references.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/7390223865029902668/posts/default/8336724759259437896'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/7390223865029902668/posts/default/8336724759259437896'/><link rel='alternate' type='text/html' href='http://chmod777self.blogspot.com/2014/01/json-id-references.html' title='JSON id references'/><author><name>jasnell</name><uri>http://www.blogger.com/profile/12993461992320512775</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='https://img1.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-7390223865029902668.post-5959109865503914719</id><published>2013-12-16T10:15:00.001-08:00</published><updated>2013-12-16T10:15:30.347-08:00</updated><title type='text'>Activity Streams 2.0 Action Handlers</title><content type='html'>&lt;p&gt;For review: &lt;a href=&quot;http://www.ietf.org/id/draft-snell-activitystreams-actions-02.txt&quot;&gt;Activity Streams 2.0 Action Handlers&lt;/a&gt;.&lt;/p&gt;

&lt;p&gt;Co-authored with my friend and former IBM colleague &lt;a href=&quot;https://plus.google.com/101343751874009808760&quot;&gt;Matthew Marum&lt;/a&gt; (now with SugarCRM), this draft introduces a number of new Activity Streams 2.0 &quot;Action Handler&quot; object types for use with the new &lt;a href=&quot;http://www.chmod777self.com/2013/09/actions-in-activity-streams-20.html&quot;&gt;Actions&lt;/a&gt; mechanism included in &lt;a href=&quot;http://tools.ietf.org/html/draft-snell-activitystreams-05#section-3.6.1&quot;&gt;Activity Streams 2.0&lt;/a&gt;. These are essentially an evolution of several concepts including OpenSocial &lt;a href=&quot;http://opensocial.github.io/spec/2.5.1/Core-Gadget.xml#Embedded-Experiences&quot;&gt;Embedded Experiences&lt;/a&gt;, Google&#39;s &quot;&lt;a href=&quot;https://developers.google.com/gmail/actions/actions/actions-overview&quot;&gt;Actions in the Inbox&lt;/a&gt;&quot;, the recent Schema.org &lt;a href=&quot;http://www.w3.org/wiki/images/b/b9/Actionsinschema.org.pdf&quot;&gt;&quot;Actions&quot; proposal&lt;/a&gt;, WebIntents, etc.&lt;/p&gt;

&lt;p&gt;The best way to describe how this works is just to jump right into an example:&lt;/p&gt;

&lt;pre&gt;&lt;code&gt;
     {
       &quot;objectType&quot;: &quot;video&quot;,
       &quot;displayName&quot;: &quot;A Movie!&quot;,
       ...,
       &quot;actions&quot;: {
         &quot;watch&quot;: [
           {
             &quot;objectType&quot;: &quot;EmbedActionHandler&quot;,
             &quot;displayName&quot;: &quot;HD&quot;,
             &quot;mediaType&quot;: &quot;video/mpeg&quot;,
             &quot;url&quot;: &quot;http://cdn.example.org?id=123amp;fmt=HD&quot;,
           },
           {
             &quot;objectType&quot;: &quot;EmbedActionHandler&quot;,
             &quot;displayName&quot;: &quot;SD&quot;,
             &quot;mediaType&quot;: &quot;video/mpeg&quot;,
             &quot;url&quot;: &quot;http://cdn.example.org?id=123&amp;fmt=SD&quot;,
           },
           {
             &quot;objectType&quot;: &quot;application&quot;,
             &quot;displayName&quot;: &quot;Watch on Netflix&quot;,
             &quot;url&quot;: &quot;http://netflix.com...&quot;
           }
         ],
         &quot;like&quot;: {
           &quot;objectType&quot;: &quot;EmbedActionHandler&quot;,
           &quot;mediaType&quot;: &quot;text/html&quot;,
           &quot;url&quot;: &quot;http://www.facebook.com/plugins/like.php...&quot;,
           &quot;style&quot;: {
             &quot;width&quot;: &quot;150px&quot;,
             &quot;height&quot;: &quot;50px&quot;
           }
         },
         &quot;share&quot;: [
           {
             &quot;objectType&quot;: &quot;HttpActionHandler&quot;,
             &quot;displayName&quot;: &quot;Twitter&quot;,
             &quot;url&quot;: &quot;https://twitter.com/share?url=...&quot;,
             &quot;target&quot;: &quot;DIALOG&quot;
           },
           {
             &quot;objectType&quot;: &quot;HttpActionHandler&quot;,
             &quot;displayName&quot;: &quot;Facebook&quot;,
             &quot;url&quot;: &quot;https://www.facebook.com/sharer/sharer.php?u=...&quot;,
             &quot;target&quot;: &quot;DIALOG&quot;
           }
         ],
         &quot;save&quot;: [
           {
             &quot;objectType&quot;: &quot;service&quot;,
             &quot;id&quot;: &quot;http://getpocket.com&quot;,
             &quot;displayName&quot;: &quot;Pocket&quot;,
             &quot;context&quot;: {
               &quot;url&quot;: &quot;http://example.org/movie?id=123&quot;,
               &quot;title&quot;: &quot;A Movie!&quot;,
               &quot;tags&quot;: &quot;foo, bar, baz&quot;
             }
           },
           {
             &quot;objectType&quot;: &quot;service&quot;,
             &quot;id&quot;: &quot;http://instapaper.com&quot;,
             &quot;displayName&quot;: &quot;Instapaper&quot;,
             &quot;context&quot;: {
               &quot;url&quot;: &quot;http://example.org/movie?id=123&quot;,
               &quot;title&quot;: &quot;A Movie!&quot;,
               &quot;selection&quot;: &quot;An action movie!&quot;
             }
           }
         ],
         &quot;review&quot;: {
           &quot;objectType&quot;: &quot;HttpActionHandler&quot;,
           &quot;displayName&quot;: &quot;Rate this movie!&quot;,
           &quot;url&quot;: &quot;http://review.example.org/movie?id=123&quot;,
           &quot;method&quot;: &quot;POST&quot;,
           &quot;expects&quot;: {
             &quot;objectType&quot;: &quot;HtmlForm&quot;,
             &quot;mediaType&quot;: &quot;application/x-www-form-urlencoded&quot;,
             &quot;parameters&quot;: {
               &quot;rating&quot;: {
                 &quot;id&quot;: &quot;http://schema.org/ratingValue&quot;,
                 &quot;bestRating&quot;: 5,
                 &quot;worstRating&quot;: 0,
                 &quot;displayName&quot;: &quot;Rating&quot;,
                 &quot;required&quot;: true
               },
               &quot;comments&quot;: {
                 &quot;id&quot;: &quot;http://schema.org/commentText&quot;,
                 &quot;displayName&quot;: &quot;Comments&quot;,
                 &quot;required&quot;: &quot;false&quot;
               }
             }
           }
         }
       }
     }
&lt;/code&gt;&lt;/pre&gt;

&lt;p&gt;Here, we have a simple &quot;video&quot; object with five specified &quot;actions&quot;: &quot;watch&quot;, &quot;like&quot;, &quot;share&quot;, &quot;save&quot; and &quot;review&quot;. Each action is associated with one or more &quot;action handlers&quot;. The handlers that have &quot;objectType&quot;: &quot;HttpActionHandler&quot; describe HTTP request/response flows; the handlers that have &quot;objectType&quot;: &quot;EmbedActionHandler&quot; describe embeddable content (e.g. embedding a video, or an OpenSocial gadget, etc). The handlers that have &quot;objectType&quot;: &quot;service&quot; reference third party specific services (in this case Pocket and Instapaper, both of which have specific REST APIs that require customer keys, etc).&lt;/p&gt;

&lt;p&gt;This is definitely still a work in progress that is far from being complete. As such, feedback and comments are definitely very welcome. Please direct any input you may have to the &lt;a href=&quot;http://activitystrea.ms&quot;&gt;Activity Streams mailing list&lt;/a&gt;.&lt;/p&gt;</content><link rel='replies' type='application/atom+xml' href='http://chmod777self.blogspot.com/feeds/5959109865503914719/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://chmod777self.blogspot.com/2013/12/activity-streams-20-action-handlers.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/7390223865029902668/posts/default/5959109865503914719'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/7390223865029902668/posts/default/5959109865503914719'/><link rel='alternate' type='text/html' href='http://chmod777self.blogspot.com/2013/12/activity-streams-20-action-handlers.html' title='Activity Streams 2.0 Action Handlers'/><author><name>jasnell</name><uri>http://www.blogger.com/profile/12993461992320512775</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='https://img1.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-7390223865029902668.post-5712761511655350886</id><published>2013-11-06T13:45:00.000-08:00</published><updated>2013-11-06T13:45:06.358-08:00</updated><title type='text'>Update to LINK/UNLINK Internet-Draft</title><content type='html'>&lt;p&gt;I posted a fairly significant update to the &lt;a href=&quot;http://www.ietf.org/id/draft-snell-link-method-07.txt&quot;&gt;LINK/UNLINK&lt;/a&gt; draft based on feedback received from &lt;a href=&quot;http://www.julian-reschke.de/&quot;&gt;Julian Reschke&lt;/a&gt;. There are several important changes.&lt;/p&gt;

&lt;p&gt;One, in previous versions, link uniqueness was based on the tuple (context IRI, link relation, target IRI). In the current version, this is expanded to include all target attributes.&lt;/p&gt;

&lt;p&gt;Two, previous versions of the Link draft did not adequately address the use of the Link header field&#39;s anchor attribute and the determination of the Context IRI. In the current draft, the Context IRI is resolved in accordance to Section 5.2 of RFC 5988. This allows the anchor attribute to be used to override the default context IRI.&lt;/p&gt;

&lt;p&gt;This draft also deals with ambiguities in IRI comparison, 2xx response codes and conditional requests (well, I added the parts about condition requests in the previous iteration but had not specifically called those out as a change yet).&lt;/p&gt;

&lt;p&gt;As always, feedback is requested and very welcomed.&lt;/p&gt;</content><link rel='replies' type='application/atom+xml' href='http://chmod777self.blogspot.com/feeds/5712761511655350886/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://chmod777self.blogspot.com/2013/11/update-to-linkunlink-internet-draft.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/7390223865029902668/posts/default/5712761511655350886'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/7390223865029902668/posts/default/5712761511655350886'/><link rel='alternate' type='text/html' href='http://chmod777self.blogspot.com/2013/11/update-to-linkunlink-internet-draft.html' title='Update to LINK/UNLINK Internet-Draft'/><author><name>jasnell</name><uri>http://www.blogger.com/profile/12993461992320512775</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='https://img1.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-7390223865029902668.post-5259969646056379504</id><published>2013-11-04T12:39:00.002-08:00</published><updated>2013-11-04T12:40:22.125-08:00</updated><title type='text'>Evolving the urn:social Namespace</title><content type='html'>&lt;p&gt;I&#39;ve posted another update to the &lt;i&gt;very&lt;/i&gt; draft &lt;a href=&quot;http://www.ietf.org/id/draft-snell-more-link-relations-03.txt&quot;&gt;&quot;urn:social&quot;&lt;/a&gt; Namespace definition. This fixes a few spec bugs but also expands the definition of the &quot;urn:social:common&quot; URN to allow for listing of specific common attribute dimensions. For instance, to reference the subset of a population sharing the same gender and approximate age, you could do something like &quot;urn:social:common:gender;age&quot;. Or, to reference a subset sharing a history of similar activities, you could do something like &quot;urn:social:common:history&quot;. The actual dimension tokens themselves are undefined. It would be up to implementations to define what those tokens are, what they mean and how they are to be used.&lt;/p&gt;

&lt;p&gt;For a practical idea on how this would be used, consider sharing an article with members of a social network who are approximately the same age as you:&lt;/p&gt;

&lt;pre&gt;&lt;code&gt;
  POST /articles/joys-of-being-a-middle-aged-dad HTTP/1.1
  Host: example.org
  Link: &amp;lt;urn:social:common:age&amp;gt;; rel=&quot;to&quot;

  ...
&lt;/code&gt;&lt;/pre&gt;

&lt;p&gt;For the next iteration of the draft, I am considering the possibility of accommodating additional social network dimensions and relationship ties. Specifically:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;urn:social:tie:evaluation:{dimension}  --&amp;gt; refers to the subset evaluated by the context entity. For example:
  &lt;ul&gt;
    &lt;li&gt;urn:social:tie:evaluation:liked    --&amp;gt; the subset of the population &quot;liked&quot; by the context entity&lt;/li&gt;
    &lt;li&gt;urn:social:tie:evaluation:disliked --&amp;gt; the subset of the population &quot;disliked&quot; by the context entity&lt;/li&gt;
    &lt;li&gt;urn:social:tie:evaluation:respect  --&amp;gt; the subset of the population &quot;respected&quot; by the context entity&lt;/li&gt;  
  &lt;/ul&gt;
&lt;/li&gt;
&lt;li&gt;urn:social:tie:transaction:{role}      --&amp;gt; refers to the subset sharing a specific transactional role with the context entity. For example:
  &lt;ul&gt;
    &lt;li&gt;urn:social:tie:transaction:customer --&amp;gt; the subset of the population considered to be a customer of the context entity&lt;/li&gt;
    &lt;li&gt;urn:social:tie:transaction:lender --&amp;gt; the subset of the population considered to be a lender to the context entity&lt;/li&gt;
  &lt;/ul&gt;
&lt;/li&gt;
&lt;li&gt;urn:social:tie:affiliation:{dimension} --&amp;gt; refers to the subset sharing a common affiliation with the context entity. For example:
  &lt;ul&gt;
    &lt;li&gt;urn:social:tie:affiliation:employment --&amp;gt; refers to the subset affiliated by employment with the context entity (possible alternative: urn:social:common:employment)&lt;/li&gt;
    &lt;li&gt;urn:social:tie:affiliation:belief --&amp;gt; refers to the subset affiliated by belief system with the context entity (possible alternative: urn:social:common:belief)&lt;/li&gt;
  &lt;/ul&gt;
&lt;/li&gt;
&lt;li&gt;urn:social:tie:interaction:{mode}      --&amp;gt; refers to the subset that has interacted with the context entity. For example:
  &lt;ul&gt;
    &lt;li&gt;urn:social:tie:interaction --&amp;gt; refers to the subset that has interacted with the context entity in any mode.&lt;/li&gt;
    &lt;li&gt;urn:social:tie:interaction:chat --&amp;gt; refers to the subset that has &quot;chatted&quot; with the context entity.&lt;/li&gt;
    &lt;li&gt;urn:social:tie:interaction:email --&amp;gt; refers to the subset that has emailed the context entity.&lt;/li&gt;
  &lt;/ul&gt;
&lt;/li&gt;
&lt;li&gt;urn:social:tie:familial:{role}         --&amp;gt; refers to the subset sharing a familial relationship with the context entity. For example:
  &lt;ul&gt;
    &lt;li&gt;urn:social:tie:familial:spouse --&amp;gt; refers to the spouse/partner of the context entity.&lt;/li&gt;
    &lt;li&gt;urn:social:tie:familial:parent --&amp;gt; refers to the parent of the context entity.&lt;/li&gt;
  &lt;/ul&gt;
&lt;/li&gt;
&lt;/ul&gt; 

&lt;p&gt;These URNs would, quite admittedly, be very specialized. For instance, imagine sharing a post within a social network only with acknowledged members of your immediate and extended family, but only showing a notification to your parents and siblings.&lt;/p&gt;

&lt;pre&gt;&lt;code&gt;
  POST /images/pictures-of-my-son HTTP/1.1
  Host: example.org
  Link: &amp;lt;urn:social:tie:familial&amp;gt;; rel=&quot;scope&quot; 
  Link: &amp;lt;urn:social:tie:familial:parent;sibling&amp;gt;; rel=&quot;to&quot;
&lt;/code&gt;&lt;/pre&gt;

&lt;p&gt;Or, sending an offer only to members of the community who have previously purchased items from you before, with specific notification given only to those who have &quot;opted-in&quot;.&lt;/p&gt;

&lt;pre&gt;&lt;code&gt;
  POST /offers/1 HTTP/1.1
  Host: example.org
  Link: &amp;lt;urn:social:tie:transaction:customer&amp;gt;; rel=&quot;scope&quot;
  Link: &amp;lt;urn:social:tie:interaction:opt-in&amp;gt;; rel=&quot;to&quot;
&lt;/code&gt;&lt;/pre&gt;

&lt;p&gt;Again, I&#39;m just kicking these around and experimenting thus far, but it would be great to receive feedback on the overall direction. I know there&#39;s already a very rich history of work in the semantic web area around family history and structure, but the goal here is quite distinct from documenting the structure of a graph. Comments are more than welcome.&lt;/p&gt;
</content><link rel='replies' type='application/atom+xml' href='http://chmod777self.blogspot.com/feeds/5259969646056379504/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://chmod777self.blogspot.com/2013/11/evolving-urnsocial-namespace.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/7390223865029902668/posts/default/5259969646056379504'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/7390223865029902668/posts/default/5259969646056379504'/><link rel='alternate' type='text/html' href='http://chmod777self.blogspot.com/2013/11/evolving-urnsocial-namespace.html' title='Evolving the urn:social Namespace'/><author><name>jasnell</name><uri>http://www.blogger.com/profile/12993461992320512775</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='https://img1.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-7390223865029902668.post-4032327378332953567</id><published>2013-11-04T08:13:00.001-08:00</published><updated>2013-11-04T08:13:21.013-08:00</updated><title type='text'>W3C Social Web Working Group</title><content type='html'>&lt;p&gt;Introducing the &lt;a href=&quot;http://www.w3.org/2013/socialweb/social-wg-charter.html&quot;&gt;W3C Social Web Working Group&lt;/a&gt;.&lt;/p&gt;

&lt;blockquote&gt;&lt;i&gt;
&lt;p&gt;The Social Web Working Group will develop a Recommendation-track data-format to allow the transfer of social information, such as status updates, across differing social systems. This data format will be based on ActivityStreams and JSON in order to promote interoperability with Web Applications.&lt;/p&gt;

&lt;p&gt;The Social Web Working Group may develop a Recommendation-track document that defines an API, based on OpenSocial, that lets developers embed of third party information with bidirectional communication inside Web applications. The focus will be on enabling the secure capabilities needed by social applications, which is necessary to bring areas such as social business to their full potential and avoid fragmentation.&lt;/p&gt;

&lt;p&gt;The Social Web Working Group may develop a Recommendation-track Web protocol to allow the federation of status updates and other data, such as profile information, between heterogeneous Web-based social networking systems. This work will be based work on a federated social web explored both in HTTP (using Pubsubhububub) and XMPP.&lt;/p&gt;
&lt;/i&gt;&lt;/blockquote&gt;

&lt;p&gt;The primary starting point of this WG will be the &lt;a href=&quot;http://tools.ietf.org/html/draft-snell-activitystreams&quot;&gt;Activity Streams 2.0&lt;/a&gt; draft... which will soon switch from being an Independently-Submitted IETF Internet-Draft to a W3C Note and eventual Recommendation. I have volunteered to continue serving as the editor for that specification. I will be posting weekly status updates (as much as possible at least) to both the Activity Streams mailing list and to this blog.&lt;/p&gt;</content><link rel='replies' type='application/atom+xml' href='http://chmod777self.blogspot.com/feeds/4032327378332953567/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://chmod777self.blogspot.com/2013/11/w3c-social-web-working-group.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/7390223865029902668/posts/default/4032327378332953567'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/7390223865029902668/posts/default/4032327378332953567'/><link rel='alternate' type='text/html' href='http://chmod777self.blogspot.com/2013/11/w3c-social-web-working-group.html' title='W3C Social Web Working Group'/><author><name>jasnell</name><uri>http://www.blogger.com/profile/12993461992320512775</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='https://img1.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-7390223865029902668.post-2960756158491739352</id><published>2013-11-01T11:13:00.000-07:00</published><updated>2013-11-01T11:13:09.034-07:00</updated><title type='text'>Social Gestures and Link Relations</title><content type='html'>&lt;p&gt;In the Activity Streams 2.0 spec work that I&#39;ve been pursuing, I&#39;ve been playing around with ways of bringing social gesturing together with first class links... blurring the lines between &quot;verbs&quot; and &quot;link relations&quot;. One of the ideas I&#39;ve been kicking around are a new collection of &quot;Social Gesture Link Relations&quot;.&lt;/p&gt;

&lt;dl&gt;
&lt;dt&gt;mentioned-by&lt;/dt&gt;    
&lt;dd&gt;-- refers to a resource mentioning the context&lt;/dd&gt;
&lt;dt&gt;endorsed-by&lt;/dt&gt;    
&lt;dd&gt;-- refers to a resource that has positively endorsed the context&lt;/dd&gt;
&lt;dt&gt;referred-by&lt;/dt&gt;    
&lt;dd&gt;-- refers to a resource referring to the context&lt;/dd&gt;
&lt;dt&gt;liked-by&lt;/dt&gt;    
&lt;dd&gt;-- refers to a resource that has indicated a positive reaction to the context&lt;/dd&gt;
&lt;dt&gt;disliked-by&lt;/dt&gt;    
&lt;dd&gt;-- refers to a resource that has indicated a negative reaction to the context&lt;/dd&gt;
&lt;dt&gt;followed-by&lt;/dt&gt;    
&lt;dd&gt;-- refers to a resource that is following the activity of the context&lt;/dd&gt;
&lt;dt&gt;saved-by&lt;/dt&gt;    
&lt;dd&gt;-- refers to a resource that has saved/pinned the context&lt;/dd&gt;
&lt;dt&gt;shared-by&lt;/dt&gt;    
&lt;dd&gt;-- refers to a resource that has shared the context &lt;/dd&gt;
&lt;dt&gt;reviewed-by&lt;/dt&gt;    
&lt;dd&gt;-- refers to a resource that has reviewed the context&lt;/dd&gt;
&lt;dt&gt;purchased-by&lt;/dt&gt;    
&lt;dd&gt;-- refers to a resource that has purchased the context&lt;/dd&gt;
&lt;dt&gt;owned-by&lt;/dt&gt;    
&lt;dd&gt;-- refers to a resource that owns the context&lt;/dd&gt;
&lt;dt&gt;sold-by&lt;/dt&gt;    
&lt;dd&gt;-- refers to a resource that sold the context&lt;/dd&gt;
&lt;dt&gt;shared-with&lt;/dt&gt;    
&lt;dd&gt;-- refers to a resource with whom the the context has been shared&lt;/dd&gt;
&lt;dt&gt;endorsed-for&lt;/dt&gt;    
&lt;dd&gt;-- refers to a resource identifying a characteristic for which the context has been endorsed&lt;/dd&gt;
&lt;dt&gt;visited-by&lt;/dt&gt;    
&lt;dd&gt;-- refers to a resource that has visited the context (example: social check-in)&lt;/dd&gt;
&lt;dt&gt;earned&lt;/dt&gt;    
&lt;dd&gt;-- refers to an achievement earned by the context&lt;/dd&gt;
&lt;dt&gt;earned-by&lt;/dt&gt;    
&lt;dd&gt;-- refers to a resource that has earned the context&lt;/dd&gt;
&lt;dt&gt;issued-by&lt;/dt&gt;    
&lt;dd&gt;-- refers to the resource that awards the context to another&lt;/dd&gt;
&lt;dt&gt;issued-for&lt;/dt&gt;    
&lt;dd&gt;-- refers to a resource identifying some action for which the context was issued&lt;/dd&gt;
&lt;dt&gt;earned-for&lt;/dt&gt;    
&lt;dd&gt;-- refers to a resource identifying some action for which the context is earned&lt;/dd&gt;
&lt;/dl&gt;

&lt;p&gt;The use of these link relations ought to be fairly straight forward.&lt;/p&gt;

&lt;p&gt;For example, suppose I want to list everyone who has endorsed a user for a variety of skills:&lt;/p&gt;

&lt;pre&gt;&lt;code&gt;
&amp;lt;html&amp;gt;
&amp;lt;body&amp;gt;
  ...
  &amp;lt;ul class=&quot;endorsements&quot; &amp;gt;
    &amp;lt;li&amp;gt;&amp;lt;a href=&quot;profile?id=1&quot; rel=&quot;endorsed-by&quot;&amp;gt;John Doe&amp;lt;/a&amp;gt;: for
      &amp;lt;a href=&quot;skills?id=1&quot; rel=&quot;endorsed-for&quot;&amp;gt;Java&amp;lt;/a&amp;gt;, 
      &amp;lt;a href=&quot;skills?id=2&quot; rel=&quot;endorsed-for&quot;&amp;gt;Ruby&amp;lt;/a&amp;gt;,
      &amp;lt;a href=&quot;skills?id=3&quot; rel=&quot;endorsed-for&quot;&amp;gt;Python&amp;lt;/a&amp;gt; 
    &amp;lt;/li&amp;gt;
    &amp;lt;li&amp;gt;&amp;lt;a href=&quot;profile?id=2&quot; rel=&quot;endorsed-by&quot;&amp;gt;Jane Doe&amp;lt;/a&amp;gt;: for
      &amp;lt;a href=&quot;skills?id=1&quot; rel=&quot;endorsed-for&quot;&amp;gt;Java&amp;lt;/a&amp;gt;
    &amp;lt;/li&amp;gt;
  &amp;lt;ul&amp;gt;
  ...
&amp;lt;/body&amp;gt;
&amp;lt;/html&amp;gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;p&gt;In Activity Streams 2.0, we can reuse the same link relations:&lt;/p&gt;

&lt;pre&gt;&lt;code&gt;
{
  &quot;objectType&quot;: &quot;person&quot;,
  ...,
  &quot;endorsements&quot;: {
    &quot;totalItems&quot;: 2,
    &quot;items&quot;: [
      {
        &quot;objectType&quot;: &quot;endorsement&quot;,
        &quot;endorsed-by&quot;: {
          &quot;url&quot;: &quot;http://example.org/profile?id=1&quot;,
          &quot;displayName&quot;: &quot;John Doe&quot;},
        &quot;endorsed-for&quot;: [ 
          {
            &quot;url&quot;:&quot;http://example.org/skills?id=1&quot;,
            &quot;displayName&quot;: &quot;Java&quot;
          },
          {
            &quot;url&quot;:&quot;http://example.org/skills?id=2&quot;,
            &quot;displayName&quot;: &quot;Ruby&quot;
          },
          {
            &quot;url&quot;:&quot;http://example.org/skills?id=3&quot;,
            &quot;displayName&quot;: &quot;Python&quot;
          }
        ]
      },
      {
        &quot;objectType&quot;: &quot;endorsement&quot;,
        &quot;endorsed-by&quot;: {
          &quot;url&quot;: &quot;http://example.org/profile?id=2&quot;,
          &quot;displayName&quot;: &quot;Jane Doe&quot;},
        &quot;endorsed-for&quot;: [ 
          {
            &quot;url&quot;:&quot;http://example.org/skills?id=1&quot;,
            &quot;displayName&quot;: &quot;Java&quot;
          }
        ]
      },
    ]
  }
}
&lt;/code&gt;&lt;/pre&gt;

&lt;p&gt;Another basic example: We have a resource that represents an achievement of some sort (a &quot;badge&quot; for instance). We want to be able to describe who the badge is issued by, what it&#39;s issued for, and who it&#39;s been issued to:&lt;/p&gt;

&lt;pre&gt;&lt;code&gt;
{
  &quot;objectType&quot;: &quot;badge&quot;,
  ...
  &quot;issued-by&quot;: &quot;http://example.org/my-service&quot;,
  &quot;issued-for&quot;: [
    &quot;http://example.org/achievements?id=1&quot;,
    &quot;http://example.org/achievements?id=2&quot;
  ],
  &quot;earned-by&quot;: [
    &quot;acct:john.doe@example.org&quot;,
    &quot;acct:jane.doe@example.org&quot;
  ]
}
&lt;/code&gt;&lt;/pre&gt;

&lt;p&gt;(Note: this is just a strawman.. for badges and achievements, some kind of alignment with stuff like &lt;a href=&quot;https://wiki.mozilla.org/Badges&quot;&gt;Mozilla&#39;s &quot;OpenBadges&quot; project&lt;/a&gt; would be ideal.)&lt;/p&gt;

&lt;p&gt;The remaining link relations ought to be fairly self-explanatory without needing to draw out examples of each.&lt;/p&gt;</content><link rel='replies' type='application/atom+xml' href='http://chmod777self.blogspot.com/feeds/2960756158491739352/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://chmod777self.blogspot.com/2013/11/social-gestures-and-link-relations.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/7390223865029902668/posts/default/2960756158491739352'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/7390223865029902668/posts/default/2960756158491739352'/><link rel='alternate' type='text/html' href='http://chmod777self.blogspot.com/2013/11/social-gestures-and-link-relations.html' title='Social Gestures and Link Relations'/><author><name>jasnell</name><uri>http://www.blogger.com/profile/12993461992320512775</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='https://img1.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-7390223865029902668.post-7076390585591684289</id><published>2013-10-29T10:10:00.000-07:00</published><updated>2013-10-29T10:10:41.900-07:00</updated><title type='text'>Expanding Conditional HTTP Methods...</title><content type='html'>&lt;p&gt;In a few discussions that have come up recently, the notion of expanding the use of conditional HTTP requests has come up. I&#39;ve been kicking around a few ideas...&lt;/p&gt;

&lt;p&gt;As a quick review, HTTP currently allows requests to be made conditional by including specific If-* headers in the request. For instance, the If-Match header specifies one or more Entity Tag values that MUST match the current Entity tag of the target resource in order for the request to be considered successful. The If-Unmodified-Since header specifies that the target resource MUST NOT have been modified since the specified date and time.&lt;/p&gt;

&lt;p&gt;Thus far, HTTP has provided only five conditional headers: If-Match, If-None-Match, If-Modified-Since, If-Unmodified-Since and If-Range. My question is whether or not a more generalized mechanism could be useful as well.&lt;/p&gt;

&lt;h2&gt;The &quot;If-True&quot; and &quot;If-False&quot; Predicate Request Headers&lt;/h2&gt;

&lt;p&gt;I&#39;ve been kicking around the notion of introducing two new conditional HTTP request header fields: If-True and If-False. Each would specify a predicate condition that must be evaluated relative to the target resource in order for the request to be considered successful.&lt;/p&gt;

&lt;pre&gt;&lt;code&gt;
  If-True: &amp;lt;testable-property&amp;gt;;&amp;lt;predicate&amp;gt;;&amp;lt;condition&amp;gt;
  If-False: &amp;lt;testable-property&amp;gt;;&amp;lt;predicate&amp;gt;;&amp;lt;condition&amp;gt; 
&lt;/code&gt;&lt;/pre&gt;

&lt;p&gt;Breaking these down, we have:&lt;/p&gt;

&lt;ul&gt;
  &lt;li&gt;The &lt;i&gt;testable-property&lt;/i&gt; is some property of the target resource that can be evaluated. What I imagine is that this will either be some globally recognized (IANA registered) value or a locally specific value. Either way, it&#39;s up to the server to interpret whether or not the property applies to the target resource.&lt;/li&gt;
  &lt;li&gt;The &lt;i&gt;predicate&lt;/i&gt; is the operation we will use to test the &lt;i&gt;testable-property&lt;/i&gt;. This could draw from a fixed, simplified vocabulary such as &quot;eq&quot; (equal), &quot;lt&quot; (less-than), &quot;ge&quot; (greater-than-or-equal), etc... or from an extensible vocabulary (think something like &lt;a href=&quot;https://dvcs.w3.org/hg/rdf/raw-file/187f33366805/rdf-turtle/index.html&quot;&gt;Turtle&lt;/a&gt;).&lt;/li&gt;
  &lt;li&gt;The &lt;i&gt;condition&lt;/i&gt; is the value we are evaluating the &lt;i&gt;testable-property&lt;/i&gt; against. This would be optional based on the &lt;i&gt;predicate&lt;/i&gt; selected, and has a value that depends entirely on the &lt;i&gt;testable-property&lt;/i&gt; and &lt;i&gt;predicate&lt;/i&gt;. It&#39;s posible that there may be multiple &lt;i&gt;conditions&lt;/i&gt;.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;So, for example, let&#39;s suppose that our target resource has a resource-specific property called &quot;owner&quot; and we only want to update it if the &quot;owner&quot; property is equal to &quot;john.doe@example.net&quot;:&lt;/p&gt;

&lt;pre&gt;&lt;code&gt;
  POST /my/resource HTTP/1.1
  Host: example.net
  If-True: &amp;lt;owner&amp;gt;;&amp;lt;eq&amp;gt;;&amp;lt;john.doe@example.net&amp;gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;p&gt;Or, let&#39;s suppose that our target resource has a resource-specific propety called &quot;linkCount&quot; and we only want to delete it if it&#39;s link count is less than 10:&lt;/p&gt;

&lt;pre&gt;&lt;code&gt;
  POST /my/resource HTTP/1.1
  Host: example.net
  If-True: &amp;lt;linkCount&amp;gt;;&amp;lt;lt&amp;gt;;&amp;lt;10&amp;gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;p&gt;We can get a bit more creative.. for instance: creating a monitor link only if the target resource &quot;mentions&quot; the target resource (this is hypothetical of course).&lt;/p&gt;

&lt;pre&gt;&lt;code&gt;
  LINK /my/resource HTTP/1.1
  Host: example.net
  Link: &amp;lt;http://example.net/post/1&amp;gt;;rel=&quot;monitor&quot;
  If-True: &amp;lt;&amp;gt;;&amp;lt;http://example.org/predicates#mentions&amp;gt;;&amp;lt;http://example.net/post/1&amp;gt;
&lt;/pre&gt;&lt;/code&gt;

&lt;p&gt;The If-False request header would simply be the inverse of the If-True.&lt;/p&gt;

&lt;p&gt;If multiple If-True/If-False headers are included in the request, they would all need to successfully evaluate in order for the conditions of the request to be met. If the conditions are not met, the standard 412 Precondition Failed response would be returned.&lt;/p&gt;

&lt;p&gt;That&#39;s the basic idea, at least. Whether or not this type of mechanism would be useful is still definitely an open question. As always, thoughts and feedback are helpful and requested.&lt;/p&gt;

</content><link rel='replies' type='application/atom+xml' href='http://chmod777self.blogspot.com/feeds/7076390585591684289/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://chmod777self.blogspot.com/2013/10/expanding-conditional-http-methods.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/7390223865029902668/posts/default/7076390585591684289'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/7390223865029902668/posts/default/7076390585591684289'/><link rel='alternate' type='text/html' href='http://chmod777self.blogspot.com/2013/10/expanding-conditional-http-methods.html' title='Expanding Conditional HTTP Methods...'/><author><name>jasnell</name><uri>http://www.blogger.com/profile/12993461992320512775</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='https://img1.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry></feed>