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).

AttachmentSize
rdf.api.inc.patch809 bytes

#1

TheOnlyHarry - December 23, 2008 - 11:56
Status:active» needs work

#2

TheOnlyHarry - December 23, 2008 - 12:21

Sorry, there was something wrong with the patch in the opening post, this one is correct.

AttachmentSize
rdf.api.inc.patch 840 bytes

#3

febbraro - January 15, 2009 - 18:45

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

jmiccolis - February 19, 2009 - 18:50
Status:needs work» reviewed & tested by the community

I've given the patch a quick test and it does seem to work.

#5

TheOnlyHarry - February 23, 2009 - 14:05
Version:6.x-1.x-dev» 6.x-1.0-alpha5
Status:reviewed & tested by the community» needs review

This patch also addresses the issue mentioned above (http://drupal.org/node/350485#comment-1202551)...

AttachmentSize
rdf.api.patch 835 bytes

#6

febbraro - March 1, 2009 - 20:22
Assigned to:Anonymous» febbraro
Status:needs review» fixed

tested and committed patch from #5.

#7

Arto - March 1, 2009 - 22:02
Status:fixed» needs review

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.

AttachmentSize
350485_rdf_get_prefixes.patch 891 bytes

#8

febbraro - March 2, 2009 - 01:52
Status:needs review» reviewed & tested by the community

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

Arto - March 2, 2009 - 03:16
Status:reviewed & tested by the community» fixed

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

System Message - March 16, 2009 - 03:20
Status:fixed» closed

Automatically closed -- issue fixed for 2 weeks with no activity.

 
 

Drupal is a registered trademark of Dries Buytaert.