Activity Streams/Primer/Vocabulary conflicts
< Activity Streams | Primer
Users of AS2 may incorporate other vocabularies that have terms that conflict with the AS2 terms.
When this happens, there are a few possibilities for disambiguating the terms.
Use namespaces
One way to disambiguate is to provide namespace prefixes for the two vocabularies, and use those prefixes within the document. For example:
{ "@context": { "as": "https://www.w3.org/ns/activitystreams", "ex": "https://example.com/ns/vocabulary#" }, "as:type": "Object", "ex:type": "Integer", }
Define your property within the document's @context
If there is not an URI for the external vocabulary, you can define the property within the AS2 document's @context, and use a prefix for the AS2 property:
{ "@context": { "as": "https://www.w3.org/ns/activitystreams", "type": { "@type": "@value" } }, "as:type": "Object", "type": "Integer", }
Use an alias
If using namespace prefixes is inconvenient, it is possible to define an alias within the document. For example:
{ "@context": { "as": "https://www.w3.org/ns/activitystreams", "ex": "https://example.com/ns/vocabulary#", "myType": "ex:type", }, "type": "Object", "myType": "Integer", }
Alternately, we can define an alias for the AS2 term instead:
{ "@context": { "https://example.com/ns/vocabulary#", "as": "https://www.w3.org/ns/activitystreams", "asType": "as:type", }, "asType": "Object", "type": "Integer", }