#social 2018-12-22

2018-12-22 UTC
xmpp-social joined the channel
#
fr33domlover
Hi people! When serializing RDF into compacted AS2, should I set the "use native types" flag to true?
#
fr33domlover
The default is false and in AS2 spec I didn't find mentions of it
#
fr33domlover
I did find an example that suggests that native types are used, but it's not enough to be sure so I'm asking here ^_^
EyeCandyKitten joined the channel
#
fr33domlover
aaronpk, csarven perhaps you can help? :) ^
jdormit_m joined the channel
#
rhiaro
fr33domlover, I think it's up to you, depends on your implementation. Life is probably easier if it's true though, because then they're native json datatypes. And it'll get correctly typed if you/a consumer converts it back into another RDF syntax later
#
rhiaro
But you also might want to keep the original literal strings (in which case leave it false)
#
rhiaro
(eg. if you have a literal "2.0" another rdf syntax and convert to jsonld with native types it'll be integer 2. If you don't use native types, it'll remain "2.0". Sorry if i'm explaining details you already know! Short answer is, the spec doesn't mind, I think)
#
fr33domlover
rhiaro, thanks :) I don't mind either whether true or false, but my server may send AS2 data to servers that implement ActivityPub as plain JSON, so I'd like to be sure (as much as possible) they expect the same JSON that I'll be sending
#
fr33domlover
rhiaro, e.g. for some numeric property, are they prepared to handle both number 2.14 and string "2.14" which would be parsed as a number? etc.
#
fr33domlover
If not, I need to set use-native-types to match expectations etc. :P
#
rhiaro
would that depend on the software on the receiving server I guess? Different json parsers might see those things sliiightly differently. I don't really know in practice
#
fr33domlover
rhiaro, I want to federate with the Mastodon/Pleroma/Friendica/Peertube etc. fediverse, I hope to figure out what they expect :p
#
fr33domlover
(I don't remember if AS2/AP have any numeric properties)
#
rhiaro
things like totalItems I guess.. I feel like they probably shouldnt' blow up if they got a string instead of a number there
#
rhiaro
would be kind of rude to
#
fr33domlover
rhiaro, I must say, implementing the json-ld API spec has brought me a lot of frustration, it's been very painful to implement, and I'm honestly very surprised the document got approved by the W3C to be a recommendation despite how horrible it is (sadly, the horriblenes isn't easily visible when briefly reading). I wish JSON-LD wasn't required for ActivityPub, or that we used something much much simpler
#
fr33domlover
(I doubt that anyone in the fediverse needs keyword aliases and all those weird vocabulary and context tricks, not to mention the tons of extra horror added in JSON-LD 1.1)
ahihi2 joined the channel
#
rhiaro
What are you implementing it in fr33domlover?
#
rhiaro
I've never had to implement it myself, just used existing libs
#
rhiaro
but I know cwebber did
#
fr33domlover
rhiaro, Haskell. I'm also implementing it pure-functional and with actual programming language types, which is extra work but also helps me find the so many inaccuracies and undocumented errors
#
fr33domlover
rhiaro, yeah cwebber did in Racket, he showed me the code
#
rhiaro
Good luck :)
#
fr33domlover
rhiaro, thanks :) I'm almost done actually