Jump to:
| Project: | Taxonomy import/export via XML |
| Version: | 6.x-2.x-dev |
| Component: | RDF/XML format |
| Category: | feature request |
| Priority: | normal |
| Assigned: | Unassigned |
| Status: | active |
Issue Summary
I came across an issue on this module that was closed (fixed) regarding exporting the taxonomy as RDF using SKOS #560326: RDF export/import should be W3C standard SKOS - here is the patch. The issue contain a patch which created a skos_format.inc file but it doesn't appear that this patch was ever applied to the 2.x-dev release and when I applied it myself it doesn't appear that the rest of the code has all the hooks in needs. Specifically, the list of vocabularies doesn't contain include a url for invoking the functions which will produce the skos output. When the list of vocabularies is rendered the XML, RDF, and TCS formats are available but not SKOS. I simply duplicated the line 232 in taxonomy_xml.module and changed the RDF label SKOS and the path from "taxonomy_xml/$vocabulary->vid/rdf" to "taxonomy_xml/$vocabulary->vid/skos" and it produces RDF using the SKOS vocabulary.
Comments
#1
Upon further investigation I came across two additional issues with the skos_format.inc patch.
First, the skos_format.inc file can not coexist with the rdf_format.inc file because both define the taxonomy_xml_get_literal_string($values) function.
Secondly, a call is made to taxonomy_xml_add_all_parents_to_queue($term); which doesn't exist. A function called taxonomy_xml_add_all_children_to_queue($term); exists in the taxonomy_xml.module file but not a functions for adding parents to the queue.
#2
skos_format.inc is redundant. SKOS is RDF and can be parsed as RDF.
The significant change that that earlier patch supplied (local anonymous entities) was an issue at the RDF-parsing layer (not SKOS-specific) and was merged in to make rdf_format a little better.
If there are SKOS source documents that cannot be successfully parsed as RDF, then that may indicate a weakness of the rdf_format parser, and could be fixed.
So far, the RDF parser has been written only to support any known real-world data sources - but it may not live up to all the exhaustive corners of RDF syntax. It was written against actual use-cases and examples, not against every line of the spec, as the spec contains some tricky cases that have not yet been seen in use (or made no sense in the Drupal import context). For example, proper xml:lang information is currently discarded ... though it may be patched in when someone needs it.
Anyway. SKOS is a subset of RDF. This module solves for the superset (RDF, and a number of dialects within it). SKOS is one of the preferred dialects, and if you have a sample of valid SKOS as supplied by a reliable tool or open data warehouse, that does not successfully import as RDF, post it up here and we may be able to see what the problem is.
The 'RDF' export format is probably still based on an earlier W3C 'glossary' schema, and therefore may produce something that is like, and compatible with, but not guaranteed to be modern SKOS. I'd be happy to update that to be more SKOS-like if someone can identify what needs to be changed for that to happen. At the time, SKOS lacked the way to express some things that we needed to serialize, so I used other schemas as well.