Overview

Dydra is an excellent cloud-based RDF triple store, but in some cases its JSON-LD serialization may produce output that differs from expectations. This blog post explains the observed behavior and the workaround we implemented.

Observed Behavior

Expected Output

In the JSON-LD specification, URI references are commonly output in object form as follows:

{}"""}"}@@p,pitr"r"dyo@o@"pvivi:e:d:d"w"w"":a:a:hsst[A"G"t"thehppttntsrrtet:iprpbsas/:u:t:eEt/e/xne/d/atdsBsmiTeyeptop"ply"o:oe":ll.]i{ic,{aao..mee/ttihhteeerrmss/cc1aa"nn,..iioo//atdxd/r0exsasb/c0dx.1.2.3"4..."

Output Observed in Dydra

In Dydra’s JSON-LD endpoint, some URI references were observed to be output as plain strings:

{}""""@@ppitrrdyoo"pvv:e::"ww":aahsst[AGt"tepptnsrre:irba/:uteEtexnedatdBmiTypto"ly":e":.]"c,"hohtmtt/tpipsts:e:m/s1se"ep,poolliiaa..eetthheerrssccaann..iiootaxd/d0rxeasbsc/d0.x.1.2"34...",

Note: This behavior does not occur for all properties and may vary depending on the @context definition and property types.

Impact of Behavioral Differences

FormatJSON-LD Parser Interpretation
{ "@id": "..." }URI reference (link to another node)
"..."Literal string

This difference can cause the following impacts:

  • Affects graph structure traversal
  • Affects some SPARQL query results
  • Affects JSON-LD framing processing

Regarding Typed Literals

Similarly, type information may be omitted for typed literals such as xsd:dateTime.

Expected output:

{}"}pr""o@@vvt:ayslptueae"r":t:e"d"xA2st0dT2:i5dm-ae0t"1e:-T1i{5mTe1"0:30:00Z",

Observed output:

{}"prov:startedAtTime":"2025-01-15T10:30:00Z"

Workaround

Approach: Fetch in TTL Format and Build JSON-LD

Since Dydra serializes Turtle (TTL) format accurately, the following strategy was adopted:

[[[[[CDnJAly3SpidOperPNlnaa-itARrCLCc]cSesoDoacPtenrteAurvCripRr]eoeotQnrncn:Lstst]sttEirJenntuSxdocOtpTtN/oTQi-tiLuoLunanDrtfdt]osLlroemgaitc]

Implementation

if}mupncccf}cf}r}oPWcooooooe;raotnnnrci}cci}li}}}}pnrcf}gt""trrissGsofoofefrBsooru@@skottrt(nsnnpteci}}}eoeoeut(nri}}arcg{eanocs(uss(rB(bloflblbdicsfpnorrpqusot!btt!euoqjsneesjsjilgot(n}enhnaPTotaupunsjpdibuUees(blblbeeeecdrnc(o)lo.{tpaTuurabssueppriljaRctljsjsjccaasnopdi}r;sdpehrLnrsdtjtubcrrecdedItiiLeeTeePeit{ttJptonrSefeeEeux"sdtesrebjteedac.VfltacyclcfVVeShdsep[rtx[st:ealricqjesdditotoraientipt{ataasO:[etde"(eu{tph"rnfe=ptuec.iicebVbel(trgVfeViV(ll.Ns:ic@ttrrr(:gdoT=lsactsccasjajfuqeauadanaquug-Au[cityunaenr}ropedtseaat.eleeeurlal(llueeeLrbRpaayprcdoJacJnas=I.tttescucraa.gullluluatDrjertlpenotidSpfoDserodh(eesetete=dlleeiiieied==(aeceeeo;ceOhrnyowsbnfassI.t:.n.a-tttt.p@ycodIh"ffa)N,ovdneye=sudh(vtc{o=nt=eee=e=o{qrg<trida]rt;LmerLPrwq(b=apaueebgarrrrbuerRIdcnoeDrada.suqsj=srlnr:"jqug{aaa{alj"adaed<a=d=amI_"t'(rpuMauues(eukm@euagllllie@dipc,st=l=sdCnstsabadabcuqpdenT{icage".."tci.chote=io=a]O3tuerjpsdjtburisoydtded@dd@etdoarprInb={rN"oJrrse<).eIjaecwp""..)vaaovr."btdrid"gjr=T;St(ecsscdeddawne@:tolatttaat:je<en,he""aEJOl)(tt{ut,c.iti;ieb{ilaahlleeIsdgtfco@yoXSNe;trbItpcet=dqrjtutteu.r`cdti,ototbibTO-:uijdnsraIh="umeeeyyrevm_t)rcbprsjdfj,NLrne)e.etd=:aTcr"pp"aT:.!iauj:.e"oe-Dstgc)wgde,tdyta:eet:ly$v.ntne/@mc:rcLtl,teiIy"".p;l.hup{apgekc/tattDsre.{Mtcd[pN.oel&valeeqlu,sntwyp"sssei)Mva(a)]ea.bi&ani;uus]oswp(ti.rn;aapst))m.j=tlt=aehuw]we(&rnligpl(ue;ie"e=euxe=d;(non.o&igea)<u)b.{ndc=resr=.okf>ow)nlnl:se)jvfN}tadaobnf3gegit;;eaoo."l!:l"bjos=.=tzRrclrdvL.=s.Bjewupo>!}vhaDitumeaiv=tvlecnb{rr=)atFnIea"ltaraact>jeg{=[l=iGgd;t)Tuel"ilntV>e"d/"u=or,)iheruhnuk.ac@i1n@e=na!o{iaetgeNvl=tic9uispu;ns}l,t),oausda9ld1bhn;"pdle[)"t9l"eki)":"eu)]:e/]?h{ns@/@"e;;{s0&;ao{l/t)}s)2&ovwtawy`u/binhnwp{b{2"jo[egwe}j2@er]u.";e-ic>kaw:crdt>eg3td"s(ye.lIf[)"oid-i0;p:rtsn]oge}yil/r;n:ni2attt0laoe0.x{br1d-ja/anelXtsc.Ma#tlLttsaSyy;ncppgheeue."amv)gaae#l{su}te;ri}n;g"){

Usage Example

c}cco)oonmh}b;nnFsee,ossetta"dttthdAycroec:tjhedrcuss:seqroip:putnno"tellnP{"redTsO:yTeS,==LT"="tatf,ewuoaxarrwtitma/tlaitetturTreoaftsJnelpsdteooc"nnch,sLo(edn`.(v$tte{eurDxrtYFttDe(lRt)eAc;)_h;ENaDsPOTITCNLoTn}v/esrptartqol`J,SO{N-LD

Required Dependencies

This workaround requires the n3 library:

nnppmmiinnssttaalllln3-save-dev@types/n3

Summary

ItemDetails
Observed behaviorSome URI references become strings instead of { "@id": "..." }
Occurrence conditionsNot all cases; varies by context and properties
WorkaroundFetch in TTL format, parse with n3, and build JSON-LD
Additional dependencyn3

When using Dydra, if the JSON-LD output format differs from expectations, fetching in TTL format and converting on the client side is an effective approach.


Last updated: 2025-12-29