-
Notifications
You must be signed in to change notification settings - Fork 6
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Easy way to convert RDF Lists to Arrays #15
Comments
Expressing a list of objects is present in the core RDF model via rdf:Seq (basic ordered list) or rdf:List (linked list)
That is the canonical and recommended way, it will protect the application against assuming too much (e.g. the given 'array' isn't a rdf:List but rather a rdf:Seq or as:PaginatedCollection) and allows easy expansion of future behaviour by simply registering views for the new topology or data structure.
That is the effect of using linked lists, it's possible to remap the underlying data structure, but you'll have to be certain the list isn't too big to fit in memory (Despite the turtle serialisation implying they're always local, RDF:Lists may be distributed across the web).
It's a data model generally expressed via some serialization format, so it follows that these things aren't present when working with the data on the e.g. Note that
That isn't RDF, so that's not an option since it would complicate the core data structures (and thus all downstream code).
There aren't really good defaults for all use-cases (i.e. sync, fetching, invalidation/updating, supporting other data structures, return type, limits/pagination, filtering/sorting) and link-redux is too low-level to make those assumptions. The next version should be able to support this since downstream will be able to write their own mapping functions (though mapping functions will probably reduce code generality and composability, so a costly choice in terms of scalability).
As you mentioned, rdflib already has the collection term, but they make assumptions and come at a cost, the aforementioned In the meantime, it's trivial to write these functions with the behaviour fit for the current use-case (and an eye on the data source). Mash will also include some reusable helpers for creating delta's for manipulating P.s. |
A developer playing with RDF will, sooner or later, realize that RDF does not support Arrays. RDF Lists have their merits, but they are a struggle to deal with as a front-ender.
If I want to render an RDF list, I'd need to register a view like this one:
Which has a couple of problems:
map
,filter
,push
.I feel like link-lib, link-redux or maybe rdflib should provide a sensible way to help with RDF Lists.
Perhaps the
mapDataToProps
function could default to return RDF lists as arrays? Perhaps the Collection model ofrdflib.js
can be used?The text was updated successfully, but these errors were encountered: