Re: [PyWrapper-devel] Behold RDF is born unto us!
Status: Alpha
Brought to you by:
jatorre
From: <m.d...@bg...> - 2007-01-08 08:42:41
|
And basically its done now:) The latest trunk gives back correct RDF, Roger! I haven't been able to test this version a lot, so I am nearly =20 positive that I must have introduced some new bugs, but at least =20 Rogers example and the queryform requests work fine! Gonna try to find some time today to do some cleanup and finally =20 stream records and not keep the entire result in memory. we'll see. Markus On Jan 8, 2007, at 5:07 AM, Javier de la Torre wrote: > Hey Markus, > > You know that Elementtreee is already part of PyWrapper distribution > no? I am using it in the BioMOBY part. > > I think we talked about it some time ago and considered moving > everything in pywrapper to use it but discarded because it is quite > some work and we were afraid of breaking something... > > But I prefer ElementTree than minidom so I am more than happy if you > do it :) > > Cheers. > > Javi. > > On 05/01/2007, at 20:08, D=F6ring, Markus wrote: > >> 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 >> the output. I will take a look into it. Not sure how well the >> frameworks support attribute namespaces, cause I am not aware of how >> to declare namespace prefixes implicitly. The code at least knows the >> namespace of the attribute, so its only a matter of how to get it >> out. Currently I am using DOM to produce the XML but I wanted to >> 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 >> thought of how to use it. So far pywrapper seemed to work fine with >> multiple CNS files. Simply add a second one in the system configtool >> pane. Just make sure they dont clash - that is defining the same >> namespace or using the same namespace alias. The aliases for the >> concepts don't matter, cause they only form one part of the total >> concept alias. So we only need to keep track of the namespaces and >> 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 >>> datasource up to a database then you should be able to run this >>> query (long URL) perhaps with minor tweaks to the port etc. >>> >>> http://localhost:8080/pywrapper/pywrapper? >>> dsa=3Dtraining&op=3Dsearch&envelope=3Dfalse&model=3Dhttp://rs.tdwg.org= / >>> ontology/voc/tapir/outputmodel/ >>> 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- >>> life output model and it is actually quite simple once you have the >>> framework in place. >>> >>> This is still a fairly trivial example but it shows that it is >>> possible and I'll continue to build on it up to the workshop. >>> >>> **WARNING** I am using the identifications table in the training >>> dsa as if it contained pure nomenclatural data just because I have >>> the TaxonName vocabulary to hand. This is not how the vocabulary >>> should or will be used. It is just a test thing. I'll now try and >>> do some more sensible things. >>> >>> The fun part is that I use the mapped ABCD concepts in my output >>> model. So we are creating RDF from a datasource that was never >>> intended to supply it :) Not sure how possible this will be in real >>> life for retrofitting data suppliers who haven't done the mappings >>> to the central concepts but is a possibility. >>> >>> I have one question about Concept Name Servers. It would make sense >>> to have a CNS for the TDWG ontology. We could then define the RDF >>> generating models and some query templates in it along with their >>> associated concepts. We would need some convention to prevent name >>> clashes with the alias'. >>> >>> Can anyone see a problem with this? Will PyWrapper pick up multiple >>> CNS and load them all? Has this been tested? >>> >>> The mapping is fun here because the TAPIR concepts map to db >>> concepts through the regular mechanisms but are also mapped, via >>> the namespace conventions in the RDF to more general meanings. >>> >>> I also have a request. If you take the result of running the above >>> (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#' >>> about=3D'2422'> >>> <title xmlns=3D'http://purl.org/dc/elements/1.1/'>Calicium >>> 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/ >>> 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 >>> attribute in the output. I have not looked into it in detail but it >>> is specified in the model and other namespace stuff is followed so >>> I guess it is a bug (this is the minor minor thing that will come >>> to bite us when we need rdf:resource references going). >>> >>> Could someone with their hands on the code (sorry is that you >>> Markus!) look at this one. Then I think we will be really RDF >>> compatible. >>> >>> Many thanks, >>> >>> All the best, >>> >>> Roger >>> >>> >>> **************************************** >>> Roger Hyam <ro...@td...> >>> Biodiversity Information Standards >>> **************************************** >>> >>> >>> --------------------------------------------------------------------=20= >>> - >>> - >>> --- >>> 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=3DDEVDEV__________________________= ____=20 >>> _ >>> _ >>> _______________ >>> PyWrapper-devel mailing list >>> PyW...@li... >>> https://lists.sourceforge.net/lists/listinfo/pywrapper-devel >> >> >> ---------------------------------------------------------------------=20= >> - >> --- >> 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 =20 >> cash >> http://www.techsay.com/default.php? >> page=3Djoin.php&p=3Dsourceforge&CID=3DDEVDEV >> _______________________________________________ >> PyWrapper-devel mailing list >> PyW...@li... >> https://lists.sourceforge.net/lists/listinfo/pywrapper-devel >> >> >> >> >> ---------------------------------------------------------------------=20= >> - >> --- >> 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 =20 >> cash >> http://www.techsay.com/default.php? >> page=3Djoin.php&p=3Dsourceforge&CID=3DDEVDEV >> _______________________________________________ >> PyWrapper-devel mailing list >> PyW...@li... >> https://lists.sourceforge.net/lists/listinfo/pywrapper-devel > > > ----------------------------------------------------------------------=20= > --- > 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 > _______________________________________________ > PyWrapper-devel mailing list > PyW...@li... > https://lists.sourceforge.net/lists/listinfo/pywrapper-devel |