Simple RDF writer or good tutorial?

  • Thread starter Jeremy Dillworth
  • Start date
J

Jeremy Dillworth

I've been trying to find a python lib to produce RDF files simply.
I have very little knowledge of XML.

I have been looking at RDFLib, but couldn't make much sense of the
examples with my limitted knowledge of RSS & XML.
http://rdflib.net/

Could someone please direct me to a gentle RDFLib tutorial, or
perhaps a lib that's simpler to use.

Thanks in advance!
 
A

A.M. Kuchling

I have been looking at RDFLib, but couldn't make much sense of the
examples with my limitted knowledge of RSS & XML.

Perhaps the examples from my PyCon slides may be helpful:
http://www.amk.ca/talks/semweb-intro/

Note that you can't really use RDFlib's .save() method to write RSS files
that most aggregators can parse, because RDFlib will write out the triples
in arbitrary order, and most RSS parsers don't use a real RDF parser, so
they expect elements to be in a certain order.

--amk
 
K

Kendall Grant Clark

On Mon, 6 Oct 2003 12:29:15 -0700 (PDT), Jeremy Dillworth

In addition to AMK's suggestion, I'll add that we published on XML.com a
few months ago a beginner piece re: rdflib. It's pretty handy:

Building Metadata Applications with RDF
http://www.xml.com/pub/a/2003/02/12/rdflib.html

Best,
Kendall Clark
Columns Editor, XML.com
 
A

Andrew Dalke

amk:
Note that you can't really use RDFlib's .save() method to write RSS files
that most aggregators can parse, because RDFlib will write out the triples
in arbitrary order, and most RSS parsers don't use a real RDF parser, so
they expect elements to be in a certain order.

A goal of XML was to make it easy to write parsers. Despite tools
like XMLGenerator, people insist on using print/write to generate XML
output, and often forget to escape elements correctly. The result is
"XML" output that isn't XML, with unescaped text like "AT&T". This
is especially a problem in the RSS world so cause people like Mark
Pilgrim to write an "Ultra-liberal RSS parser" to workaround those errors,
Thus was have people using the wrong tools to write output, causing
others to write specialized tools to capture wild type data, again raising
the bar on getting data from point A to point B.

Now here's the opposite case, where the data is correct but the parsers
only handle a subset of the definition.

What's the advantage of XML again? [1]

Andrew
(e-mail address removed)

[1] My answer is that it gives a way to handle Unicode even
if your character encoding doesn't support all Unicode. Even
then, there's a lot of data I've seen which claims to be Latin-1
when it isn't.
 
U

Uche Ogbuji

Andrew Dalke said:
amk:

A goal of XML was to make it easy to write parsers. Despite tools
like XMLGenerator, people insist on using print/write to generate XML
output, and often forget to escape elements correctly. The result is
"XML" output that isn't XML, with unescaped text like "AT&T". This
is especially a problem in the RSS world so cause people like Mark
Pilgrim to write an "Ultra-liberal RSS parser" to workaround those errors,
Thus was have people using the wrong tools to write output, causing
others to write specialized tools to capture wild type data, again raising
the bar on getting data from point A to point B.

No reason why Pythoneers can't be good citizens:

http://www.xml.com/pub/a/2002/11/13/py-xml.html

But to the point, the OP cannot expect to get order from a naturally
unordered system (RDF). I can't see how this points to any failure in
XML. You would have the exact same problem trying to get portable
order out of a Python dictionary (or 2.3 set).

--Uche
http://uche.ogbuji.net
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
474,166
Messages
2,570,902
Members
47,443
Latest member
RobertHaddy

Latest Threads

Top