- From: Alistair Miles <alistair.miles@zoo.ox.ac.uk>
- Date: Tue, 8 Jul 2008 10:13:52 +0100
- To: "'Thomas Baker'" <tbaker@tbaker.de>
- Cc: "'SWD WG'" <public-swd-wg@w3.org>, "'Ed Summers'" <ehs@pobox.com>
Hi Tom, Thanks to Ed for following this up. Ed's code shows how to get a serialisation of the schema, according to any of the RDF syntaxes supported by rdflib. If you want n-triples, do format='nt' I think. If you want a custom text output of the triples, you could do something like http://www.w3.org/2006/07/SWD/SKOS/reference/20080603/triples2text.py which I used to generate http://www.w3.org/2006/07/SWD/SKOS/reference/20080603/triples.txt You should be able to get the same effect for XL by replacing the first line of the script with 'from semanticsxl import statements'. Hope that helps. Al. -- Alistair Miles Senior Computing Officer Image Bioinformatics Research Group Department of Zoology The Tinbergen Building University of Oxford South Parks Road Oxford OX1 3PS United Kingdom Web: http://purl.org/net/aliman Email: alistair.miles@zoo.ox.ac.uk Tel: +44 (0)1865 281993 > -----Original Message----- > From: public-swd-wg-request@w3.org [mailto:public-swd-wg- > request@w3.org] On Behalf Of Ed Summers > Sent: 10 June 2008 15:03 > To: SWD WG > Subject: Re: [SKOS] 3 June Editors' Draft text and python files > > > It looks like Alistair designed semantics.py and semanticsxsl.py to be > used like a library, which makes sense since they are autogenerated. > > So you will need to write a little script that imports the > semantics.py or semanticsxsl.py, gets the graph with the schema() > function from the respective library, and then does something with it, > like output it as n3. > > So for example you ought to be able to put this script in the same > directory as semantics.py, and run it: > > import semantics > > graph = semantics.schema() > graph.bind('skos', 'http://www.w3.org/2008/05/skos#') > graph.bind('owl', 'http://www.w3.org/2002/07/owl#') > print graph.serialize(format='n3') > > The binds are in there so you get nice 'skos:' and 'owl:' prefixes in > your output. When you run that you ought to see pretty n3 for the skos > vocabulary :-) > > I hope this helped. > > //Ed > > On Tue, Jun 10, 2008 at 4:47 AM, Thomas Baker > <baker@sub.uni-goettingen.de> wrote: > > > > On Wed, Jun 04, 2008 at 10:23:16PM +0100, Alistair Miles wrote: > >> All the prose statements of the SKOS and XL data models are > extracted as a > >> single text file at: > >> > >> > <http://www.w3.org/2006/07/SWD/SKOS/reference/20080603/semantics.txt> > >> > >> ...which I used to generate separate python scripts for SKOS and XL > triples > >> at: > >> > >> <http://www.w3.org/2006/07/SWD/SKOS/reference/20080603/semantics.py> > >> > <http://www.w3.org/2006/07/SWD/SKOS/reference/20080603/semanticsxl.py> > >> > >> .. I can't remember exactly what you need for your SKOS-learner > tool, let me > >> know what I can do ... I should be able to generate any text- > representation > >> of the triples pretty easily from the python scripts. > > > > Having installed http://rdflib.net/, "python ./semantics.py" > > now generates no errors - but also no visible output, neither to > > STDOUT nor to a file. What am I missing? > > > > Tom > > > > -- > > Tom Baker - tbaker@tbaker.de - baker@sub.uni-goettingen.de
Received on Tuesday, 8 July 2008 09:14:33 UTC