Re: Fwd: objects and arrays

Thanks for the explanation James... I also highlighted an error in the
example, not sure if you saw that or not?

Thanks,
--tim

On Fri, Aug 14, 2015 at 7:27 PM, James M Snell <jasnell@us.ibm.com> wrote:

> 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)
>
> [image: 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]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,
>
> 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
>
>
>
>
>

Received on Tuesday, 18 August 2015 13:18:46 UTC