The default RDF/XML module is excellent, but not helpful for many Semantic Web users. The semantic web taxonomy standard in RDF is W3C's SKOS. SKOS is popular, many semantic web project support it, its the future, ...

We needed SKOS support for taxonomy_xml in the EU-funded research project "OrganiK" ( and implemented it.

attached the file embedded in a patch to now support SKOS.

we also had some changes to taxonomy_xml.module, but they are not necessary for you, anyway, registering the .inc should be enough (not part of the patch)

we tested it with various SKOS files and already fixed errors. It should work ... but not 100% sure.

we are interested to get this code into taxonomy_xml, but this is our first contribution, so don't slap us too hard. I am willing to spare some time fixing bugs etc....

if there are issues, please bug me via

taxonomy_xml_withskos.patch27.81 KBleobard
Members fund testing for the Drupal project. Drupal Association Learn more


dman’s picture

Well first, this is a great contribution. SKOS has always been on the radar, and already some terminology and synonyms are supported for it.
What I don't know is where to find any specification or examples for how SKOS should formally be applied to taxonomy concepts! I know it could be used to talk about the same sort of ideas ... but I've never seen it do so!
So without a practical source or use-case, it's not been researched further.

So I'd be interested to see the spec you found or the examples you are working with!

As for the patch, it's a bit confusing. Visually it seems to be 90% identical to the RDF format. So much so that I can't tell what is unique about it! I'm thinking that a lot of my RDF-specific stuff could probably be removed from it - or if practical refactored into a few more common routines.
All I can see by looking is some stuff in taxonomy_xml_convert_triples_to_sorted_objects_skos() - but I can't see what it's trying to do.
If the SKOS files you are working with are so much like rdf (?), then what is the actual difference? Perhaps a small exception or change to the rdf format one will encompass SKOS OK too?
The RDF dialect I currently use is only following examples from the W3C (specifically the Wine ontology example) for representing taxonomies - but not an actual specification, as the working drafts at the time were in flux and contradictory.

PLEASE let me know the spec you are working to! I've deconstructed dozens of different syntaxes for taxonomies, and I wished there was better standard available. SKOS (when I researched it) was not complete enough at the time - but is certainly worth supporting as an option!

You'll need to attach a few examples (preferably with source/attribution) so I can test this more!

dman’s picture

PS, looking at OrganiK - you may be interested in a taxonomy-server extension I'm building to support/extend taxonomy_xml. For distributed re-use of taxonomies via web services, an open way to read/write these taxa.

dman’s picture

Let me know what data you are working on. I'm keen to absorb this, but don't yet know what it looks like.

leobard’s picture

ping, I got your questions, will provide an answer...

leobard’s picture

skos examples are here;

there is a list of tools and further reading on the wikipedia page

and at W3c:

skos is a rdf vocabulary designed to express Thesauri and Taxonomies, so it fits perfectly. I would recommend to look at skos:Concept, and the properties skos:altLabel, skos:narrower, skos:broader.
They do match 1:1 to the drupal taxomomy counterparts.

I would not bother making a framework out of this code. its a few lines, not worth bothering making an "RDF and skos code reuse" effort - the code works, is done, so be it, no need to make things complicated.

dman’s picture

OK, I've been through the code now and found what the difference is! It's useful.

Previously, I'd never found any useful input that actually used 'bnodes' - the internal, self-referential pseudo-ids, so I'd left out that part of the code. There was a big comment block there saying why I found it unhelpful at the time :-)
The Syntax and keywords of SKOS was already there and supported as I expected, which made things easy! I'd put them in years ago - but never had any content to feed them. When I fed it some content, all the values and structure fell into place, so that was fun to watch!

Because the concept of bnodes is part of RDF and the ARC parser, and not specific to SKOS, I've grabbed that paragraph of code and rolled it in to the appropriate place in RDF format. I suspected that what we really needed was a merge, because SKOS is RDF, so I didn't know what would not have been working for you...
Now I see it was because some of your inputs did not have any true rdf:about URIs in the files. All the examples I'd used so far did have URIs.

So I've got that in CVS-dev now. I've also preset a remote 'service' to load up the GCL (Government Category List) automatically, as a demonstration.

Thanks for those references, I like seeing if there is any progress out there. I'll have to look again at the SKOS status, and see whether there are enough real-world uses of it to support writing as well. Currently the RDF I produce follows the W3C recommendation instead, but SKOS now seems a little more well-rounded.

You can try out a fresh checkout of the dev branch. I haven't been able to do any regression testing yet.

isaac77’s picture

Great module!
Any progress on SKOS? Just tested importing a large SKOS file based on the UNESCO thesaurus. Looks like most terms were imported, but hierarchy info (broader/narrow terms) was not preserved. The problem may be with the file I'm trying to import, will attempt further testing. In any case, ability to import SKOS would be useful addition to the module.

dman’s picture

Status: Needs review » Fixed

SKOS is RDF The RDF format always supported SKOS.
Or at least should. THe patch here (that adds bnode support) was folded into the normal RDF parser within a week.

If there are problems reading any validatingpublicly available data sources, post a link to the file in question and I'll have a look.

Status: Fixed » Closed (fixed)

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

freedom7220’s picture

who can tell me how can use this patch ?

dman’s picture

Therefore you should get results by importing SKOS-carrying imports as RDF-format.

If that's not happening, attach the example that is failing, and we'll validate it.

freedom7220’s picture

Can anyone successed import LCSH into Taxonomy ?