Re: Federated/Distributed @mentions

While I'm sympathetic to the HTML-markup approach being "the most
flexible" option, I definitely question whether it's the right answer
in all cases. For instance, if I'm sending a JSON-formatted push
notification to a native mobile application, why would I force the
application to use an HTML parser to extract the necessary metadata
from a short snippet of text when a regex would do just fine? Second,
it can become extremely verbose. Yes, I'll grant that when the
@mention is actually rendered to the user in HTML it ought to be
converted to a microdata/microformat type structure, but it should be
possible to do in "plain text" also.

Perhaps, then, we define things so that they can be represented both
ways, with a simple translation between them:

Mentions:

In plain-text:
  @[http://www.twitter.com/jasnell|jasnell]

In HTML:
  <span itemscope itemtype="http://www.w3.org/ns/activitystreams#Mention">
    <a itemprop="href" href="http://www.twitter.com/jasnell">
      <span itemprop="displayName">jasnell</span>
    </a>
  </span>

  (or)

  <span vocab="http://www.w3.org/ns/activitystreams#" typeof="Mention">
    <a property="href" href="http://www.twitter.com/jasnell">
      <span property="displayName">jasnell</span>
    </a>
  </span>

In JSON-LD:

{
  "@context": "http://www.w3.org/ns/activitystreams",
  "@type": "Mention",
  "href": "http://www.twitter.com/jasnell",
  "displayName": "jasnell"
}

Hashtags:

In plain-text:
  #[http://www.twitter.com/hashtags/socialwg|socialwg]

In HTML:
  <span itemscope itemtype="http://www.w3.org/ns/activitystreams#Tag">
    <a itemprop="href" href="http://www.twitter.com/hashtags/socialwg">
      <span itemprop="displayName">socialwg</span>
    </a>
  </span>

  (or)

  <span vocab="http://www.w3.org/ns/activitystreams#" typeof="Tag">
    <a property="href" href="http://www.twitter.com/hashtags/socialwg">
      <span property="displayName">socialwg</span>
    </a>
  </span>

In JSON-LD:

{
  "@context": "http://www.w3.org/ns/activitystreams",
  "@type": "Tag",
  "href": "http://www.twitter.com/hashtags/socialwg",
  "displayName": "socialwg"
}

- James

On Thu, Dec 4, 2014 at 4:21 AM, Ben Werdmüller <ben@withknown.com> wrote:
>
> We've been considering various options for this in Known. I strongly
> disagree with using Markdown or similar syntax for human-readable content,
> because that creates a burden to support a wholly different notation in
> applications that are almost certainly web-based at some level. I do think
> HTML with embedded microformats / microdata is the most flexible option for
> this scenario. (It also doesn't tie applications into Twitter-style @-syntax
> - there's no need to let them dictate the convention.)
>
> Dave's approach for structured data also makes sense to me. You include the
> bare content, and then metadata that allows you to apply your own markup,
> rather than including some other microsyntax in bare text. That again gives
> application developers the most flexibility, although I would go so far as
> to change "username" to "@foo" in his example, to also allow different
> notations. It then becomes a simple search and replace, with a strong
> suggestion that usernames are prefixed with some notation to prevent
> accidents with greedy searches.
>
> On Wed, Dec 3, 2014 at 7:36 PM, Dave Wilkinson <wilkie@xomb.org> wrote:
>>
>> How does this work when people put HTML as the content? Does this get
>> parsed before or after entities are parsed? What happens when agents that
>> see this as html don't parse them out?
>>
>> You'd have to really lock down how to parse the content field and what
>> is/isn't acceptable there and what to do to remove ambiguity when you
>> actually want some of that syntax to be untouched.
>>
>> I'd assume this isn't about routing. We have solutions for that. You just
>> tag the object with who is mentioned, who it is going to, what it is in
>> reply to, etc.
>>
>> This is just about marking up the content, which can currently be in any
>> form? Right now, you'd just have "@foo" in your content, and the object
>> would have an array of mentions which you would use to map the username to a
>> domain and you would just mark it up as you need to. The convention is to
>> look for an @ sign, although we don't (nobody does) specify the valid
>> characters for a handle.
>>
>> The only better way I can think of is not to enforce some new markup
>> language semantics within already arbitrary markup, but rather to just
>> simply place in that mentions array the position and length of the substring
>> in the content that represents the handle. Then I'd just replace that
>> substring with my markup, whatever that is for my purpose, or if I don't
>> care, I just display the content with whatever the publisher cared to use
>> ("<a></a>" tag, @foo, +foo, etc) and it would already be presentable. Sooooo
>> simple.
>>
>> My basic thesis: it's not content, it's metadata. while the html
>> microformat folks can get away with it, it seems very out of place here.
>>
>> (I admit I am not able to write AS2 just from memory)
>>
>> {
>>   "content": "Hello @foo",
>>   "mentions": [{
>>     "type": "person",
>>     "url": "http://example.com/foo
>>     "displayName": "Foo Bar"
>>     "username": "foo",
>>     "mentionedAt": [6, 4]
>>   }]
>> }
>>
>> I can then turn that into "Hello <a href='http://example.com/foo'>Foo
>> Bar</a>" or "Hello @<a href='http://example.com/foo'>foo</a>" or "Hello +<a
>> href='http://example.com/foo'>foo</a>" or whatever. Conversely, if it is
>> html in the content, the substring would be the entire anchor tag, maybe. It
>> would be very obvious that it would always indicate the position in the
>> content before any processing is done.
>>
>> On Wed, Dec 3, 2014 at 2:14 PM, Matthew Marum <vp-projects@opensocial.org>
>> wrote:
>>>
>>> The use of @[id|label].
>>>
>>> Matt
>>>
>>> On 12/3/14, 12:48 PM, "James M Snell" <jasnell@gmail.com> wrote:
>>>
>>> >On Wed, Dec 3, 2014 at 9:25 AM, Matthew Marum
>>> ><vp-projects@opensocial.org> wrote:
>>> >[snip]
>>> >>
>>> >> "@[Users:seed_paul_id:Paul] can you please help with this
>>> >> opportunity?"
>>> >>
>>> >>
>>> >> The first two parts form a unique identifier within a Sugar instance
>>> >> and
>>> >> the final part is the display label.  Frankly, I’m not sure why we
>>> >> wouldn’t use the precedent that Twitter API has established here in
>>> >>terms
>>> >> of syntax.  I’ll leave any potential legal concerns to the lawyers.
>>> >>
>>> >
>>> >Which syntax specifically from the Twitter API?
>>> >
>>> >- James
>>>
>>>
>>>
>>
>
>
>
> --
> Ben Werdmuller
> CEO & co-founder, Known
> withknown.com | werd.io
> +1 (312) 488-9373
>
> Known, Inc | 421 Bryant St | San Francisco, CA 94107

Received on Thursday, 4 December 2014 16:54:04 UTC