Phlex::RDF proposal (schema.org, ActivityStreams/ActivityPub, FOAF, etc.) #400
ziggythehamster
started this conversation in
Ideas
Replies: 1 comment
-
Thanks for writing this up. There's lots to unpack here, we should pair sometime. |
Beta Was this translation helpful? Give feedback.
0 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
This is going to be a long post, mostly containing commented Ruby code.
@joeldrapper has been spitballing ways to support things besides HTML, and I've been thinking about specifically RDF. RDF has been around forever and can be serialized in a ton of different ways. And, in fact, it's possible to output RDF in many semantically identical but extremely different ways. In order to encourage people to use RDF-aware tooling, I think we should talk about how we might model RDF in Phlex.
Some things to think about:
render
does this already out of the box?schema.Date.new('value')
would be good UX? (But how do we prevent you from doingschema.Thing.new
, which isn't a literal?)to
should always be an array. This seems to be a bug in either the spec's definition file or injson-ld-preloaded
's parser of the spec's definition file. This can be fixed by making theTermDefinition
forto
setcontainer_mapping: "@set"
as:Public
should be expanded tohttps://www.w3.org/ns/activitystreams#Public
. This does not appear to be fixable inside ruby-rdf, so we could make the helper that buildsRDF::Resource
s have an option likeforce_expand: true
which causes us to prefix the resource URI with__phlex_force_expand__
, and we simply remove that after we have a hash of JSON-LD but before we serialize the JSON.Phlex::RDF
should by default patch ruby-rdf/json-ld so network access raises. maybe add aPhlex::RDF.allow_rdf_network_access!
that can be called to restore the default.For reference, the above prints this output:
The compile phase would probably just have a graph it passes through successive templates and just have a bunch of RDF::Statement.new's and cache the
RDF::Resource
s in a Hash (or useRDF::URI.intern
).Also I wanted to do an ActivityStreams example since that's what I'm most interested in, but it's a good test-bed for nesting templates, so I want to gut check my thoughts before I went down that rabbit hole :).
Beta Was this translation helpful? Give feedback.
All reactions