I'm working up support for rdf representation of taxonomy terms (to be read/write compatible with my taxonomy_xml and other public vocabularies)
Chugging along OK, but I found that when setting my $data to contain simple text strings or URIs (as opposed to full RDF_ object entities) the serializer didn't play along, although the code there almost did.
Looks like the use of an undeclared variable due to a mistype.
foreach ($predicates as $predicate => $objects) {
$qname = rdf_uri_to_qname($predicate);
$qname = $base_prefix ? preg_replace('/^' . preg_quote($base_prefix, '/') . ':/', '', $qname) : $qname;
foreach (is_array($objects) ? $objects : array($object) as $object) {
... $object in the last line was undeclared, inaccurate, and ended up repeating the value of a valid predicate into the spot reserved for all other predicates. quite wrong
a 1-character patch attached.
- foreach (is_array($objects) ? $objects : array($object) as $object) {
+ foreach (is_array($objects) ? $objects : array($objects) as $object) {
now works as expected.
(not sure if this serialization problem is different from the 'data export' category... it's the closest I can see)
| Comment | File | Size | Author |
|---|---|---|---|
| #1 | rdfxml-serialization_support_type.patch | 1.25 KB | dman |
| rdfxml-serialization_typo.patch | 822 bytes | dman |
Comments
Comment #1
dman commentedALSO - new, also-small issue.
Support for rdf:type was not working - only if the supplied 'rdf:type' was an array of types.
I'm not sure when one entity would/should be more than one 'type' or whether just using the first one of those values found as the 'real' type (as happens now) would be the right thing to do.
But in any case, I'd expect to be able to set ONE type and be able to use that.
Updated (cumulative) patch attached.
sample snippet:
Produced the incorrect:
With the fix, it produces the expected, correctly type-structured:
Comment #2
smustgrave commented