Converts given object into an iterable of triples, with the following conversion rules:
Toplevel object keys are used as subjects and MUST each have a plain object as value, where its keys are used as predicates and values as objects (in the SPO sense).
Plain objects in SPO object position are translated into unique IDs in order to allow the nested map to become a subject itself. In RDF terms, this is equivalent to BNodes.
Arrays in SPO object position cause multiple triples with same subject & predicate to be emitted. If any of the items in the array is a plain object, it will be treated as BNode and transformed as described in the previous rule
Converts given object into an iterable of triples, with the following conversion rules:
src = { "@thi.ng/rstream-query": { type: "project", author: "toxi", tag: ["ES6", "TypeScript", "graph"] }, toxi: { type: "person", hasAccount: [ {type: "twitter", id: "toxi"}, {type: "github", id: "postspectacular"} ] } }; [...asTriples(src)] // [ [ '@thi.ng/rstream-query', 'type', 'project' ], // [ '@thi.ng/rstream-query', 'author', 'toxi' ], // [ '@thi.ng/rstream-query', 'tag', 'ES6' ], // [ '@thi.ng/rstream-query', 'tag', 'TypeScript' ], // [ '@thi.ng/rstream-query', 'tag', 'graph' ], // [ 'toxi', 'type', 'person' ], // [ 'toxi', 'hasAccount', '__b0__' ], // [ '__b0__', 'type', 'twitter' ], // [ '__b0__', 'id', 'toxi' ], // [ 'toxi', 'hasAccount', '__b1__' ], // [ '__b1__', 'type', 'github' ], // [ '__b1__', 'id', 'postspectacular' ] ]