Tabulator RDFParser

25 views
Skip to first unread message

Aurimas Vinckevicius

unread,
Apr 20, 2012, 11:02:04 AM4/20/12
to zoter...@googlegroups.com
Could we update the RDFParser?

The current version of the parser cannot properly handle http://www.w3.org/2002/07/owl#sameAs predicate:

1) The aliases are not merged, so the RDF translator ends up producing multiple items.

2) It does try to associate related items, but it fails to update subject references to the new URI, so matching with a new alias fails.

The current version of tabulator RDF Parser addresses (2) and (1) is disabled for tabulator, but can be re-enabled by uncommenting one line. I tweaked the identity.js file to work with the current code in Zotero and it performs quite well for my test cases, but perhaps updating other files is also a good idea. There are quite a few changes made to the parser, so maybe altering Zotero code to work with the new structure of the parser would be a better idea.

The updated identity.js file is at https://github.com/aurimasv/zotero/commit/2840a44a4eb921748c3eea74a75e78f2c6b43f0c

Aurimas

Simon Kornblith

unread,
Apr 20, 2012, 2:37:31 PM4/20/12
to zotero-dev
On Apr 20, 11:02 am, Aurimas Vinckevicius <aurimas....@gmail.com>
wrote:
> Could we update the RDFParser?
>
> The current version of the parser cannot properly handlehttp://www.w3.org/2002/07/owl#sameAspredicate:
>
> 1) The aliases are not merged, so the RDF translator ends up producing
> multiple items.
>
> 2) It does try to associate related items, but it fails to update subject
> references to the new URI, so matching with a new alias fails.
>
> The current version of tabulator RDF Parser addresses (2) and (1) is
> disabled for tabulator, but can be re-enabled by uncommenting one line. I
> tweaked the identity.js file to work with the current code in Zotero and it
> performs quite well for my test cases, but perhaps updating other files is
> also a good idea. There are quite a few changes made to the parser, so
> maybe altering Zotero code to work with the new structure of the parser
> would be a better idea.

This sounds good to me in theory, particularly since we'd gain
Tabulator's RDFa implementation (which I think is finished now?).
However, as I recall our RDF/XML serializer contains some significant
modifications from the Tabulator serializer. Some of these were to
create RDF that could be parsed by Mozilla's RDF engine, which we used
in Zotero 1.0. I think it's fine if new Zotero RDF can't be imported
by Zotero 1.0, so we could drop those. But I also think I modified the
parser in a few other ways to make the output more readable and easier
to parse with normal XML tools. It would probably be best to compare
the output generated by both for the same data and then go from there.

Simon

Aurimas Vinckevicius

unread,
Apr 24, 2012, 10:31:57 PM4/24/12
to zoter...@googlegroups.com

Simon, you're not working on this are you? I'm gonna give it a shot.

Aurimas

--
You received this message because you are subscribed to the Google Groups "zotero-dev" group.
To post to this group, send email to zoter...@googlegroups.com.
To unsubscribe from this group, send email to zotero-dev+...@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/zotero-dev?hl=en.

Simon Kornblith

unread,
Apr 24, 2012, 11:42:03 PM4/24/12
to zotero-dev
No, I'm not currently working on it, but if you run into any trouble
I'd be happy to help.

Simon

On Apr 24, 10:31 pm, Aurimas Vinckevicius <aurimas....@gmail.com>
wrote:

Aurimas Vinckevicius

unread,
Apr 26, 2012, 5:02:41 PM4/26/12
to zoter...@googlegroups.com
I'm a little confused how Serializer() is exposed as a global function in translate.js line 2307

My understanding was that Serializer (serialize.js#L22) is loaded into Zotero.RDF.AJAW  (zotero-service.js#L239) I couldn't find anywhere else where Serializer is exposed into global scope, but I'm probably missing something.

Aurimas

Simon Kornblith

unread,
Apr 26, 2012, 6:13:27 PM4/26/12
to zotero-dev
Yeah, this is a bit weird, but there is a logical explanation. The RDF
code is loaded with Zotero.RDF.AJAW as the scope, but the global
object for everything loaded by mozIJSSubscriptLoader is the same as
the global object of the script calling mozIJSSubscriptLoader.
Tabulator defines Serializer as

Serializer = function() {return new __Serializer()};

There is no var declaration, so this gets attached to the global
object. If this declaration were changed to ```var Serializer
= ...```, it would become Zotero.RDF.AJAW.Serializer instead. This is
probably bad, and I'm not sure why I didn't just fix this in
Tabulator. Feel free to change this.

Simon

On Apr 26, 5:02 pm, Aurimas Vinckevicius <aurimas....@gmail.com>
wrote:
> I'm a little confused how Serializer() is exposed as a global function
> in translate.js
> line 2307<https://github.com/zotero/zotero/blob/c09cbb0e4b008339d947fe7c3b203a6...>
>
> My understanding was that Serializer
> (serialize.js#L22<https://github.com/zotero/zotero/blob/c09cbb0e4b008339d947fe7c3b203a6...>)
> is loaded into Zotero.RDF.AJAW
> (zotero-service.js#L239<https://github.com/zotero/zotero/blob/c09cbb0e4b008339d947fe7c3b203a6...>)

Aurimas Vinckevicius

unread,
Apr 27, 2012, 3:19:54 AM4/27/12
to zoter...@googlegroups.com
Initial commit of the update. It seems to produce the same output as previously.

https://github.com/zotero/zotero/pull/103
Reply all
Reply to author
Forward
0 new messages