own-pt / delphin-rdf

RDF specifications for DELPH-IN semantic representations and a Pydelphin plugin for RDF generation.
MIT License
2 stars 3 forks source link

adding WQL features #15

Closed FredsoNerd closed 3 years ago

FredsoNerd commented 3 years ago

Hi. I spent some time this week re-implementing some features from WQL to mrs-sparql from WSI, aiming to better understand the meaning of some pieces code, and as a beginning for our purpose of implementing this query generator.

For now, we have two main processes that (1 - in _to_tree) expresses the query as an optimized tree whose leaves are atomic expressions, and (2 - in _to_sparql) parses the tree into sparql, adding auxiliary variables, types and other features. The second process isn't completely implemented yet.

One may be able to run the code, for instance, as

$ python path/to/wql.py -vvv "!([ARG2 x, ARG3 h1] | ! h2:*_v_*[ARG0 e, ARG1 x]) { h1 =q h2, h2 =q h3}"

There are some modifications and comments made from the original code that could be discussed further, such as: using regular expressions, pushing some methods to classes, trying some code reuse, etc.