[redland-dev] Redland in Python questions

Uldis Bojars captsolo at gmail.com
Fri Jul 7 17:09:43 BST 2006


Hi, All!

Could you help with a couple of questions about using Redland's Python bindings?

1) The 'handler' callback in RDF.Parser

There is a 'handler' callback that can be supplied to Parser methods
parse_into_model and parse_string_into_model.

This callback is good for logging, but a strange thing happens - these
parser methods always return True (success) if the 'handler' callback
is used when their return value should be indicating if the parsing
failed or not.

Is this supposed to work this way? Is there some way to use the
handler to throw an exception (a simple 'raise Exception' does not do
anything) or to indicate what return value (true/false) should these
parsing methods return?

2) Model.contains_statement()

Is there a way to check if the model contains one or more statements
matching a particular statement "template"?

E.g., to use model.contains_statement( RDF.Statement( None,
rdfs.seeAlso, None) ) to find if there are statements with a predicate
rdfs.seeAlso.

There is a method find_statements(), but it would perform more work
than necessary - there is no need to find all statements in this case.

Redland version information:
redland-devel-1.0.4-1
redland-1.0.4-1
redland-python-1.0.4.1-1

Thanks
Uldis

[ http://captsolo.net/info/ ]


More information about the redland-dev mailing list