gen_doc.go (3752B)
1 // Code generated by astool. DO NOT EDIT. 2 3 // Package vocab contains the interfaces for the JSONLD vocabulary. All 4 // applications are strongly encouraged to use these interface types instead 5 // of the concrete definitions contained in the implementation subpackage. 6 // These interfaces allow applications to consume only the types and 7 // properties needed and be independent of the go-fed implementation if 8 // another alternative implementation is created. This package is 9 // code-generated and subject to the same license as the go-fed tool used to 10 // generate it. 11 // 12 // Type interfaces contain "Get" and "Set" methods for its properties. Types 13 // also have a "Serialize" method to convert the type into an interface map 14 // for use with the json package. There is a convenience "IsExtending" method 15 // on each types which helps with the ActivityStreams hierarchy, which is not 16 // the same as object oriented inheritance. While types also have a "LessThan" 17 // method, it is an arbitrary sort. Do not use it if needing to sort on 18 // specific properties, such as publish time. It is best used for normalizing 19 // the type. Lastly, do not use the "GetUnknownProperties" method in an 20 // application. Instead, use the go-fed tool to code generate the property 21 // needed. 22 // 23 // Properties come in two flavors: functional and non-functional. Functional 24 // means that a property can have at most one value, while non-functional 25 // means a property could have zero, one, or more values. Any property value 26 // may also be an IRI, in which case the application will need to make a HTTP 27 // request to fetch the property value. 28 // 29 // Functional properties have "Get", "Is", and "Set" methods for determining 30 // what kind of value the property is, fetching that value, or setting that 31 // value. There is also a "Serialize" method which converts the property into 32 // an interface type, but applications should not typically use a property's 33 // "Serialize" and instead should use a type's "Serialize" instead. Like 34 // types, properties have an arbitrary "LessThan" comparison function that 35 // should not be used if needing to sort on specific values. Finally, 36 // applications should not use the "KindIndex" method as it is a comparison 37 // mechanism only for those looking to write an alternate implementation. 38 // 39 // Non-functional properties can have more than one value, so it has "Len" 40 // for getting its length, "At" for getting an iterator pointing to an 41 // element, "Append" and "Prepend" for adding values, "Remove" for removing a 42 // value, "Set" for overwriting a value, and "Swap" for swapping two values' 43 // indices. Note that a non-functional property satisfies the sort interface, 44 // but it results in an arbitrary but stable ordering best used as a 45 // normalized form. A non-functional property's iterator looks like a 46 // functional property with "Next" and "Previous" methods. Applications should 47 // not use the "KindIndex" methods as it is a comparison mechanism only for 48 // those looking to write an alternate implementation of this library. 49 // 50 // Types and properties have a "JSONLDContext" method that returns a mapping 51 // of vocabulary URIs to aliases that are required in the JSON-LD @context 52 // when serializing this value. The aliases used by this library when 53 // serializing objects is done at code-generation time, unless a different 54 // alias was used to deserialize the type or property. 55 // 56 // Types, functional properties, and non-functional properties are not 57 // designed for concurrent usage by two or more goroutines. Also, certain 58 // methods on a non-functional property will invalidate iterators and possibly 59 // cause unexpected behaviors. To avoid this, re-obtain an iterator after 60 // modifying a non-functional property. 61 package vocab