Re: [PyWrapper-devel] Behold RDF is born unto us!
Status: Alpha
Brought to you by:
jatorre
From: <m.d...@BG...> - 2007-01-05 19:09:06
|
I have just tried to use namespaces in attributes. to make it short: it = failed. Its python's minidom implementation that causes the trouble. = When I use the method .setAttributeNS(myNS, myAttrName, value) it uses = xmlns: on the element to define the namespace. So if the elements NS is = different, it actually overwrites it! So minidom cannot handle mixed = namespaces within one element. I've checked ElementTree (which is part of python's standard since = version 2.5) and there it works! It even recognises the RDF namespace = and uses rdf: as the prefix without telling it so. So I have to update all of pywrapper to use ElementTree instead of = minidom. This is a bit more work so I dont know when there will be time = to update the code - in the worst case I could do this during the = developers meeting. But at least we know it will work! And ElementTree is supposed to be much faster with a much smaller = footprint. Cheers, Markus -----Original Message----- From: pyw...@li... on behalf of = D=F6ring, Markus Sent: Fri 1/5/2007 5:20 PM To: PyWrapper Developers mailing list Cc: Roger Hyam Subject: Re: [PyWrapper-devel] Behold RDF is born unto us! well done Roger! worked out of the box for me. I guess you are right that pywrapper ignores attribute namespaces in =20 the output. I will take a look into it. Not sure how well the =20 frameworks support attribute namespaces, cause I am not aware of how =20 to declare namespace prefixes implicitly. The code at least knows the =20 namespace of the attribute, so its only a matter of how to get it =20 out. Currently I am using DOM to produce the XML but I wanted to =20 migrate to Elementree at some point. I will keep you informed. Creating an alias.txt for the TDWG ontology would be the exact way we =20 thought of how to use it. So far pywrapper seemed to work fine with =20 multiple CNS files. Simply add a second one in the system configtool =20 pane. Just make sure they dont clash - that is defining the same =20 namespace or using the same namespace alias. The aliases for the =20 concepts don't matter, cause they only form one part of the total =20 concept alias. So we only need to keep track of the namespaces and =20 their aliases. cheers, markus On Jan 4, 2007, at 5:30 PM, Roger Hyam wrote: > Happy New Year everyone. > > If you have a local pywrapper and have connected the training =20 > datasource up to a database then you should be able to run this =20 > query (long URL) perhaps with minor tweaks to the port etc. > > http://localhost:8080/pywrapper/pywrapper?=20 > = dsa=3Dtraining&op=3Dsearch&envelope=3Dfalse&model=3Dhttp://rs.tdwg.org/=20 > ontology/voc/tapir/outputmodel/=20 > TaxonName_001.xml&filter=3DUnitID@abcd206+like+"2422" > > What you will get back is (but for one minor minor thing) valid RDF! > > After Markus' fix (and after Christmas) I turned to making a real-=20 > life output model and it is actually quite simple once you have the =20 > framework in place. > > This is still a fairly trivial example but it shows that it is =20 > possible and I'll continue to build on it up to the workshop. > > **WARNING** I am using the identifications table in the training =20 > dsa as if it contained pure nomenclatural data just because I have =20 > the TaxonName vocabulary to hand. This is not how the vocabulary =20 > should or will be used. It is just a test thing. I'll now try and =20 > do some more sensible things. > > The fun part is that I use the mapped ABCD concepts in my output =20 > model. So we are creating RDF from a datasource that was never =20 > intended to supply it :) Not sure how possible this will be in real =20 > life for retrofitting data suppliers who haven't done the mappings =20 > to the central concepts but is a possibility. > > I have one question about Concept Name Servers. It would make sense =20 > to have a CNS for the TDWG ontology. We could then define the RDF =20 > generating models and some query templates in it along with their =20 > associated concepts. We would need some convention to prevent name =20 > clashes with the alias'. > > Can anyone see a problem with this? Will PyWrapper pick up multiple =20 > CNS and load them all? Has this been tested? > > The mapping is fun here because the TAPIR concepts map to db =20 > concepts through the regular mechanisms but are also mapped, via =20 > the namespace conventions in the RDF to more general meanings. > > I also have a request. If you take the result of running the above =20 > (it looks like this) > > <?xml version=3D"1.0" encoding=3D"UTF-8"?> > > > <RDF xmlns=3D'http://www.w3.org/1999/02/22-rdf-syntax-ns#'> > <TaxonName xmlns=3D'http://rs.tdwg.org/ontology/voc/TaxonName#' =20 > about=3D'2422'> > <title xmlns=3D'http://purl.org/dc/elements/1.1/'>Calicium =20 > adspersum Pers. subsp. australe Tibell</title> > <genusPart>Calicium</genusPart> > <specificEpithet>adspersum</specificEpithet> > <infraspecificEpithet>australe</infraspecificEpithet> > </TaxonName> > </RDF> > > and cut and paste it into the W3C RDF validator (http://www.w3.org/=20 > RDF/Validator/) you get a single deprecated warning. > > Error: {W102} unqualified use of rdf:about is deprecated.[Line =3D 5, = > Column =3D 78] > > It seems that PyWrapper isn't putting the namespace in for the =20 > attribute in the output. I have not looked into it in detail but it =20 > is specified in the model and other namespace stuff is followed so =20 > I guess it is a bug (this is the minor minor thing that will come =20 > to bite us when we need rdf:resource references going). > > Could someone with their hands on the code (sorry is that you =20 > Markus!) look at this one. Then I think we will be really RDF =20 > compatible. > > Many thanks, > > All the best, > > Roger > > > **************************************** > Roger Hyam <ro...@td...> > Biodiversity Information Standards > **************************************** > > > ---------------------------------------------------------------------- = > --- > Take Surveys. Earn Cash. Influence the Future of IT > Join SourceForge.net's Techsay panel and you'll get the chance to =20 > share your > opinions on IT & business topics through brief surveys - and earn cash > http://www.techsay.com/default.php?=20 > = page=3Djoin.php&p=3Dsourceforge&CID=3DDEVDEV_____________________________= ___=20 > _______________ > PyWrapper-devel mailing list > PyW...@li... > https://lists.sourceforge.net/lists/listinfo/pywrapper-devel -------------------------------------------------------------------------= Take Surveys. Earn Cash. Influence the Future of IT Join SourceForge.net's Techsay panel and you'll get the chance to share = your opinions on IT & business topics through brief surveys - and earn cash http://www.techsay.com/default.php?page=3Djoin.php&p=3Dsourceforge&CID=3D= DEVDEV _______________________________________________ PyWrapper-devel mailing list PyW...@li... https://lists.sourceforge.net/lists/listinfo/pywrapper-devel |