Re: Fwd: objects and arrays

The basic rule is that unless the property is marked as "functional" in the
vocabulary document, it can have one or more values. As an artifact of the
JSON-LD serialization, if there is a single value, it will not be wrapped
in an Array. Also keep in mind that for object properties, the value
*could* be a string with a URI value.

The following, then, are equivalent:

{ "@type": "Note", "attachment": "http://example.org/abc123" }
{ "@type": "Note", "attachment": {"@id": "http://example.org/abc123"}}
{ "@type": "Note": "attachment": [{"@id": "http://example.org/abc123"}]}
{ "@type": "Note": "attachment": ["http://example.org/abc123"]}



- James Snell
   jasnell@us.ibm.com
   Technology & Partnerships
   IBM Open Technologies Architect - Node.js, Mobile Backend & Cloud
   (559) 707-6331 (mobile)



From:	Tim Williams <williamstw@gmail.com>
To:	public-socialweb@w3.org
Date:	08/14/2015 12:13 PM
Subject:	Fwd: objects and arrays



Sorry if this is a repeat but it doesn't look like my first one arrived...

Hi all,
Should a consumer of AS expect an array of object's for any property
of an Object type?  I notice examples[0] where the type is Link|Object
but the example has an array.  In some cases (e.g attributedTo) it
hints to multiple in the Notes but others (e.g. attachment) the Note
implies singular. Sorry for such an elementary question, I'm happy to
accept a link to where I've missed it in the docs:)

I also notice an error in Example 700[1] where it starts as an array
"[" but ends as an object "}".

Thanks,
--tim

[0] - http://www.w3.org/TR/activitystreams-vocabulary/#dfn-attributedto
[1] - http://www.w3.org/TR/activitystreams-vocabulary/#dfn-title




--1__BBF432DFF9D8158f9e8a93df938690918c8FBBF432DFF9D815
Content-Transfer-Encoding: quoted-printable
Content-type: text/html; charset=US-ASCII
Content-Disposition: inline

<html><body><p>The basic rule is that unless the property is marked as &quot;functional&quot; in the vocabulary document, it can have one or more values. As an artifact of the JSON-LD serialization, if there is a single value, it will not be wrapped in an Array. Also keep in mind that for object properties, the value *could* be a string with a URI value.<br><br>The following, then, are equivalent:<br><br>{ &quot;@type&quot;: &quot;Note&quot;, &quot;attachment&quot;: &quot;<a href="http://example.org/abc123">http://example.org/abc123</a>&quot; }<br>{ &quot;@type&quot;: &quot;Note&quot;, &quot;attachment&quot;: {&quot;@id&quot;: &quot;<a href="http://example.org/abc123">http://example.org/abc123</a>&quot;}}<br>{ &quot;@type&quot;: &quot;Note&quot;: &quot;attachment&quot;: [{&quot;@id&quot;: &quot;<a href="http://example.org/abc123">http://example.org/abc123</a>&quot;}]}<br>{ &quot;@type&quot;: &quot;Note&quot;: &quot;attachment&quot;: [&quot;<a href="http://example.org/abc123">http://example.org/abc123</a>&quot;]}<br><br><br><br>- James Snell<br>   jasnell@us.ibm.com<br>   Technology &amp; Partnerships<br>   IBM Open Technologies Architect - Node.js, Mobile Backend &amp; Cloud<br>   (559) 707-6331 (mobile)<br><br><img width="16" height="16" src="cid:1__=8FBBF432DFF9D8158f9e8a93df938690918c8FB@" border="0" alt="Inactive hide details for Tim Williams ---08/14/2015 12:13:24 PM---Sorry if this is a repeat but it doesn't look like my first "><font color="#424282">Tim Williams ---08/14/2015 12:13:24 PM---Sorry if this is a repeat but it doesn't look like my first one arrived... Hi all,</font><br><br><font size="2" color="#5F5F5F">From:        </font><font size="2">Tim Williams &lt;williamstw@gmail.com&gt;</font><br><font size="2" color="#5F5F5F">To:        </font><font size="2">public-socialweb@w3.org</font><br><font size="2" color="#5F5F5F">Date:        </font><font size="2">08/14/2015 12:13 PM</font><br><font size="2" color="#5F5F5F">Subject:        </font><font size="2">Fwd: objects and arrays</font><br><hr width="100%" size="2" align="left" noshade style="color:#8091A5; "><br><br><br><tt>Sorry if this is a repeat but it doesn't look like my first one arrived...<br><br>Hi all,<br>Should a consumer of AS expect an array of object's for any property<br>of an Object type? &nbsp;I notice examples[0] where the type is Link|Object<br>but the example has an array. &nbsp;In some cases (e.g attributedTo) it<br>hints to multiple in the Notes but others (e.g. attachment) the Note<br>implies singular. Sorry for such an elementary question, I'm happy to<br>accept a link to where I've missed it in the docs:)<br><br>I also notice an error in Example 700[1] where it starts as an array<br>&quot;[&quot; but ends as an object &quot;}&quot;.<br><br>Thanks,<br>--tim<br><br>[0] - </tt><tt><a href="http://www.w3.org/TR/activitystreams-vocabulary/#dfn-attributedto">http://www.w3.org/TR/activitystreams-vocabulary/#dfn-attributedto</a></tt><tt><br>[1] - </tt><tt><a href="http://www.w3.org/TR/activitystreams-vocabulary/#dfn-title">http://www.w3.org/TR/activitystreams-vocabulary/#dfn-title</a></tt><tt><br><br><br></tt><br><BR>
</body></html>

--1__BBF432DFF9D8158f9e8a93df938690918c8FBBF432DFF9D815--


--0__BBF432DFF9D8158f9e8a93df938690918c8FBBF432DFF9D815
Content-type: image/gif; 
	name="graycol.gif"
Content-Disposition: inline; filename="graycol.gif"
Content-ID: <1__BBF432DFF9D8158f9e8a93df938690918c8FB@>
Content-Transfer-Encoding: base64

R0lGODlhEAAQAKECAMzMzAAAAP///wAAACH5BAEAAAIALAAAAAAQABAAAAIXlI+py+0PopwxUbpu
ZRfKZ2zgSJbmSRYAIf4fT3B0aW1pemVkIGJ5IFVsZWFkIFNtYXJ0U2F2ZXIhAAA7


--0__BBF432DFF9D8158f9e8a93df938690918c8FBBF432DFF9D815--

Received on Friday, 14 August 2015 19:28:58 UTC