Not all namespaces defined in schema export
TheOnlyHarry - December 23, 2008 - 11:55
| Project: | Resource Description Framework (RDF) |
| Version: | 6.x-1.0-alpha5 |
| Component: | Schema definitions |
| Category: | bug report |
| Priority: | normal |
| Assigned: | febbraro |
| Status: | closed |
| Issue tags: | rdf_get_prefixes |
Description
When viewing the RDF schema (http://localhost/rdf/schema) of my Drupal site (using FF 3.0) I get the following error:
XML Parsing Error: prefix not bound to a namespace
Location: http://register/rdf/schema
Line Number 3, Column 3: <owl:Ontology rdf:about="http://register/rdf/schema/">
--^It seems like RDF API (rdf_get_prefixes()) doesnt add all prefix namespaces to the document. The quick fix in the attached patch seems to resolve the problem for now (until this issue has been addressed by one of the the developers).
| Attachment | Size |
|---|---|
| rdf.api.inc.patch | 809 bytes |

#1
#2
Sorry, there was something wrong with the patch in the opening post, this one is correct.
#3
I am having the same problem.
This code in rdf_serialize_xml (below) is not accurately mirrored in rdf_get_prefixes (that this patch fixes) and thus a few of the namespaces based on "rdf:type" are missed.
// Support the typed node element syntax where possible:foreach ($predicates as $predicate => &$objects) {
$qname = rdf_uri_to_qname($predicate);
if ($qname == 'rdf:type') {
$type = rdf_uri_to_qname(array_shift($objects));
if (empty($objects)) {
unset($predicates[$predicate]);
}
break;
}
}
Not sure the timeline for the next RDF release, but my OpenCalais modules are nearly ready for their next significant upgrade which really makes extensive use of the RDF module and is depending on this and some other fixes. I don't think I can release my module and tell users to to get the RDF module and apply a patch, so I would be willing to become a co-maintainer if this could help move the process along.
Let me know if I can help.
Thanks,
Frank
#4
I've given the patch a quick test and it does seem to work.
#5
This patch also addresses the issue mentioned above (http://drupal.org/node/350485#comment-1202551)...
#6
tested and committed patch from #5.
#7
The patch generally looks fine, but there's several potential issues: all object values are assumed to be URIs, though they are likely to actually be mostly literals, for which no prefix processing is needed; the BNode prefix "_" is now included in the output; and, iterating through the object values in a normalized RDF data structure should use the form
foreach (is_array($objects) ? $objects : array($objects) as $object)whenever possible, to facilitate usability of the RDF API with both single and multi-valued properties (I need to document this, of course :-))The attached new patch-of-a-patch (requires #5) should fix these issues. I've not tested it thoroughly, hence I'm not committing it yet. If you guys have a chance, please test and (Frank or Jeff) feel free to commit.
#8
I have tested this and it works on my use cases (and does not add xmlns:_ like the previous). Will leave open briefly to see if others have any comment. If not I will commit tomorrow.
Arto, when were you planning on pushing a new release out, so I can make sure I commit before then? Also, thanks for the explanation, it helps a lot.
#9
I've just finished merging changes from the upstream experimental branches - please see changeset [177826]. The intention is to release alpha6 imminently provided there are no show-stoppers on further testing.
I included the #7 patch, we can take it out or re-evaluate it if it causes problems for anyone - but since it seems fine for you and me both, it's probably OK; let's close this issue for the time being.
#10
Automatically closed -- issue fixed for 2 weeks with no activity.