Re: [Tracker] Using tracker extractors from other applications



Hi,

On Sat, Nov 20, 2010 at 12:21 AM, Nikolaus Rath <Nikolaus rath org> wrote:

Nikolaus Rath <Nikolaus-BTH8mxji4b0 public gmane org> writes:
>> extractor = ExtractorHelper ()
>> results = extractor.get_metadata (filename)
>>
Upon closer investigation, get_metadata() fails whenever it encounters a
text/plain file that contains a '['. Looking at the code, this does not
seem surprising.

Is the format of the string that's returned by GetMetadata() described
somewhere? Then I could try to fix the parser.

GetMetadata() returns triplets in "turtle" format, with the subject missing (because the caller should know it and probably wants to add more information). That python "parser" (if you can call it that) uses just regular expressions to parse those triplets and handle the anonymous nodes (those "[ xxx ]") in a tricky way to form a single key for the dictionary.

Nodes like:
A slo:location [a slo:GeoLocation; slo:city "Helsinki"]
Are translated in the dictionary to:
slo:location:city "Helsinki"

Not nice, but good enough for our testing. Remember that this code is just an internal utility and not a public API. Patches are welcome if you find issues,

Ivan


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]