Hi there,
My problem is that whenever I try to export a node, from RDF node tab, the node is exported like the following:

<?xml version="1.0" encoding="UTF-8"?>
<rdf:RDF xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"
  xmlns:ns0="Arraytitle"
  xmlns:ns1="Arraydate"
  xmlns:ns2="Arraycreated"
  xmlns:ns3="Arrayhas_creator"
  xmlns:ns4="Arraynum_replies">

  <rdf:Description rdf:about="[base_url]node/3">
    <rdf:type>ArrayDocument</rdf:type>
    <ns0:>Node One</ns0:>
    <ns1: rdf:datatype="ArraydateTime">2010-12-18T18:57:39+02:00</ns1:>
    <ns2: rdf:datatype="ArraydateTime">2010-12-18T18:57:39+02:00</ns2:>
    <ns3: rdf:resource="[base_url]user/1"/>
    <ns4: rdf:datatype="Arrayinteger">0</ns4:>
  </rdf:Description>

</rdf:RDF>

I've installed rdfui, rdfx and evoc module from latest dev of rdf module, also I imported all core vocabs.
Also, a drupal message gets appeared after a refresh:

Warning: Illegal offset type in ARC2_RDFSerializer->__init() (line 27 of sites/all/modules/rdf/vendor/arc/serializers/ARC2_RDFSerializer.php).
Warning: Illegal offset type in ARC2_RDFSerializer->__init() (line 27 of sites/all/modules/rdf/vendor/arc/serializers/ARC2_RDFSerializer.php).
Warning: Illegal offset type in ARC2_RDFSerializer->__init() (line 27 of sites/all/modules/rdf/vendor/arc/serializers/ARC2_RDFSerializer.php).
Warning: Illegal offset type in ARC2_RDFSerializer->__init() (line 27 of sites/all/modules/rdf/vendor/arc/serializers/ARC2_RDFSerializer.php).
Warning: Illegal offset type in ARC2_RDFSerializer->__init() (line 27 of sites/all/modules/rdf/vendor/arc/serializers/ARC2_RDFSerializer.php).
Warning: Illegal offset type in ARC2_RDFSerializer->__init() (line 27 of sites/all/modules/rdf/vendor/arc/serializers/ARC2_RDFSerializer.php).
Warning: Illegal offset type in ARC2_RDFSerializer->__init() (line 27 of sites/all/modules/rdf/vendor/arc/serializers/ARC2_RDFSerializer.php).
Warning: Illegal offset type in ARC2_RDFSerializer->__init() (line 27 of sites/all/modules/rdf/vendor/arc/serializers/ARC2_RDFSerializer.php).
Warning: Illegal offset type in ARC2_RDFSerializer->__init() (line 27 of sites/all/modules/rdf/vendor/arc/serializers/ARC2_RDFSerializer.php).

Please let me know if you need further info.
Thanks

Comments

Anonymous’s picture

This is because of a change in the ARC 2 library. I had the same problem when trying out SPARQL Endpoint, #965010: rdf:type values show up as arrays. Scor suggested a temp fix of just downloading the earlier version of ARC 2 and that worked in my case.

Remon’s picture

I tried out an old arc version from bazaar repository as well as the one on github/scor/rdf, the bug remains though.

Remon’s picture

Actually this happens because namespaces list has some duplicated namespace declaration, for example, skos namespace refers to an Array which has skos full url twice instead of referring to a string. could be a problem of hook_rdf_namespaces or something.

Remon’s picture

StatusFileSize
new518 bytes

For now, I use a dirty patch the make sure that namespaces are not duplicated.

ebremer’s picture

I got the same error you did Remon. I even removed RDFx (and submodules), as well as, RDF (core) and uninstalled them all, then installed scor's rdfx (with earlier arc2) and I still got the same error. If I apply your patch, it will export the rdf, but, I don't get all of the RDF, only name and account are exported. I added Last Name and First Name with foaf:firstname and foaf:lastname respectively, but they don't show up.

shunting’s picture

#1 did not work for me.

#4's "dirty patch" did.

datorres’s picture

I have th same problem, but when I try to generate the rdf file I have this : Error de lectura XML: declaración de texto o XML en un lugar distinto del principio de la entidad

datorres’s picture

I have the same problem. You find solution?

If I apply your patch, it will export the rdf, but, I don't get all of the RDF, only name and account are exported. I added Last Name and First Name with foaf:firstname and foaf:lastname respectively, but they don't show up.

scor’s picture

@datorres: "I added Last Name and First Name with foaf:firstname and foaf:lastname respectively, but they don't show up." this should be in a seprate issue, it seems unrelated.

scor’s picture

Title: RDF node export is missed up » RDF node export is messed up in the presence of duplicate namespaces
Status: Active » Needs work

The problems comes when evoc has imported the core vocabularies and redefined the core namespace. the core function rdf_get_namespaces() was fixed some time ago to strip out any duplicate, so it should really be used instead of a custom function. I've committed a fix which uses the core API directly instead to avoid duplicates.

We should however not need rdfx_get_namespaces() at all, if only for the static caching, which is important in the case of evoc which hits the database. Two options:
1. add static cache in rdf_get_namespaces() in core
2. add static cache inside evoc_rdf_namespaces()

I prefer 2, but that should be a separate performance issue really.

scor’s picture

Title: RDF node export is messed up in the presence of duplicate namespaces » Remove rdfx_get_namespaces() and rely on rdf_get_namespaces() instead

repurposing this issue to clean up rdfx.

Remon’s picture

Well, In my humble opinion Option 1 is preferable and is a global fix. A separate issue should be opened on core rdf.

Remon’s picture

Status: Needs work » Needs review
StatusFileSize
new3.14 KB

a patch that removes depending on rdfx_get_namespaces()... if I may :)

Remon’s picture

scor’s picture

Project: Resource Description Framework (RDF) » RDF Extensions
Component: D7. RDF UI » Code
scor’s picture

Status: Needs review » Needs work
+++ b/rdfx.terms.inc
@@ -39,6 +39,7 @@ function _rdfx_get_terms($term_type) {
 /**
  * Gets a list of all defined namespaces.
+ * TODO deprecate this function
  */
 function rdfx_get_namespaces() {
   $rdf_namespaces = &drupal_static(__FUNCTION__);

how about removing this function entirely? I doubt this is used elsewhere in contrib...

scor’s picture

This needs reroll since the RDF export API has changed.

scor’s picture

Issue tags: +RDF, +sprint

tagging

Anonymous’s picture

This should also be checked against coding standards. For example, the TODO statements should be @todo.

scor’s picture

you can ignore the hunk from evoc.module and rdfx.terms.inc, it will be removed by another patch. rdfx_get_namespaces() will also go away in another patch.

mlncn’s picture

Status: Needs work » Postponed

This patch is postponed then until Remon's #1089040: Cache rdf_get_namespaces using drupal_static gets into Drupal 7 core and the evoc.module and rdfx.terms.inc parts are removed, because without any of that it is nothing but checking coding standards against comments and code that won't be here anymore...