Closed cleanunicorn closed 7 years ago
Is there a way to always force single objects to arrays?
If there are multiple values as rdf:type I get an array like this one. Note the @type property is an array.
rdf:type
@type
{ "@context": { "ethon": "http://ethon.consensys.net/", "ethstats": "http://ethereum.ethstats.io/" }, "@graph": [{ "@id": "ethstats:Uncle_0x5cd50096dbb856a6d1befa6de8f9c20decb299f375154427d90761dc0b101109", "@type": ["ethon:Uncle", "ethon:Block"], "ethon:blockCreationTime": "2015-07-30T15:26:58.000Z", "ethon:blockHash": "0x5cd50096dbb856a6d1befa6de8f9c20decb299f375154427d90761dc0b101109", "ethon:number": "1" }] }
But if there is only one rdf:type the @type property is not an array.
{ "@context": { "ethon": "http://ethon.consensys.net/", "ethstats": "http://ethereum.ethstats.io/" }, "@graph": [{ "@id": "ethstats:Uncle_0x5cd50096dbb856a6d1befa6de8f9c20decb299f375154427d90761dc0b101109", "@type": "ethon:Uncle", "ethon:blockCreationTime": "2015-07-30T15:26:58.000Z", "ethon:blockHash": "0x5cd50096dbb856a6d1befa6de8f9c20decb299f375154427d90761dc0b101109", "ethon:number": "1" }] }
When serializing the graph, I send the options
'frame' => (object) [ '@context' => (object) [ 'ethon' => 'http://ethon.consensys.net/', 'ethstats' => 'http://ethereum.ethstats.io/', ],
Is there a way to send the @set option for the rdf:type / @type property?
@set
Yeah, the compactArrays option should do just that
compactArrays
Is there a way to always force single objects to arrays?
If there are multiple values as
rdf:type
I get an array like this one. Note the@type
property is an array.But if there is only one
rdf:type
the@type
property is not an array.When serializing the graph, I send the options
Is there a way to send the
@set
option for therdf:type
/@type
property?