Partially solve 1494 parse dol standard examples#1540
Partially solve 1494 parse dol standard examples#1540gnn wants to merge 22 commits intospechub:masterfrom
Conversation
|
Please don't merge the pull request yet. There a are a few more commits to come. |
|
The policy is that (only) the creator of a PR merges after an OK by another reviewer |
Common/AnnoParser.hs
Outdated
There was a problem hiding this comment.
I'm not sure if you really need endOfLine. I suspect that spaces also skips crlf. If you really need to check for the end of a line, then newline (from Text.ParserCombinators.Parsec.Char) should do, too.
There was a problem hiding this comment.
Furthermore, comment lines should not be skipped but kept as part of the global annotations
There was a problem hiding this comment.
Thanks for suggesting spaces. It worked and also enabled me to get rid of a line that I wanted to be gone from the get go. See 868229b below.
The reason I'm skipping the comments is that prefixAnno is already parsing a %prefix( ... )% annotation block and it needs to return a Prefix_anno. Since I wasn't able to figure out where to put the Unparsed_anno returned from commentLine I decided to skip those comments.
|
The problem that select and reject can not handle SymbolLists is solved by branch |
|
The change suggested by Christian (newline instead of endOfLine) is enough to make the compilation go through (and probably the tests green). I have tried the files from https://ontohub.org/dol-examples. There are some that can't go through because of missing translations or logics. For some we would need more of the static analysis for DOL that has been implemented in the meanwhile in HETS (probably via a rebase). The only problem I could find so far is for https://ontohub.org/dol-examples/sorting.dol Hiding from a named specification works though. This seems to be a parsing error. |
|
I tested this and it seems that the problem is the second |
|
@mcodescu, could you please have a look at the last two commits? Can we at least merge this pull request now, even if not all problems have been solved? (The pull request should of course not break existing functionality.) |
|
I have parsed again the specifications in the repository mentioned above. Now the sorting specification is parsed correctly. It might be a good idea to run more tests before merging, though, but I don't have more inputs. Also, when compiling this branch on my machine, I had to take care of some ambiguous occurrences of methods, especially involving Data.Graph.Inductive.Graph, which is usually not imported using qualified. So if you do merge, please make sure that you don't introduce compilation errors. |
|
please rebase this branch on master ( |
|
Can one of the admins verify this patch? |
It's no longer part of the standard, so there's no need to parse it anymore. 'library' is sufficient.
See the comments in the file for an explanation. In short: those parts make the parser choke, but not because of DOL related problems. So they have to go until those unrelated problems have been fixed.
It's not part of the DOL grammar and that's how it should be as it's also not part of the alignment API.
The DOL Standard doesn't allow those. Should be plain text keywords instead.
The standard says they should simply be doubles, not enclosed in parentheses.
If the `= ...` part is omitted it now defaults to the empty specification/oms/network.
It's a minuscule change but that way, it stays in line with how the rest of Hets is organized.
Don't know whether that's the correct way, but it's my stab at getting `OMS Extraction` to work. From what I gathered by reading the code this should be the right way to do it.
For some reason Hets leaves the angular brackets in there, when parsing IRIs at least in this small code sample. This prevents logic lookup from working properly. I opted for this short hack, as it I don't know whether other code relies on the brackets being there and removing them just before looking up the logic is the option that is least likely to break other code.
Since only one function is used in the importing module, I'd like to make that explicit.
Logic `OWL`, sublogic `NP-sROIQ-D|-|` should be correct but Hets errors out saying it doesn't know the logic `NP-sROIQ-D|-|`. For now simply using `OWL` seems to work, but it's a hack that should be corrected at some point.
Same (maybe) problem as in `lookupLogicName`. The IRI passed in as a parameter is still enclosed in angular brackets which is not expected by those functions. Filtering the brackets might only address the symptom of a bigger issue but it fixes the problem at hand and has the least effects on the remaining codebase.
This reverts commit 17aa52c and instead applies the fix closer to logic name lookup inside the function doing the lookup. That way both fixes for serialization and logic name lookup (which are identical) are grouped in one file.
As the comments says, theres a proper way to do it by using the information stored in the `LanguageQual` that is the result of parsing the `language` declaration. But this would entail expanding a possible prefix of the `LanguageQual` and I don't have time to implement this right now. I'll open an issue for this so that I can work on it later. For now, parsing the DOL examples is more important so I added this hack to get an intermediate working solution.
Now it also adds support for more logics/languages and various translations.
Thanks @cmaeder for the suggestion. Using `spaces` has two benefits. It gets rid of a dependency issue resulting in a compilation error and it allows me to be consistent and only eat up whitespace at the end of lines.
ecc2936 to
c49913b
Compare
|
I rebased the branch onto the current master. There are no compilation errors and I tried parsing all the DOL examples in the repository. There are still quite a few errors, most of which stem from missing logics or comorphisms, but some also have other reasons. These are the categories of parsing errors, encountered when trying Missing comorphismsPretty simple. Hets doesn't seem to know the comorphisms uses in these examples, so the parser complains. Unknown logicsSimilar to the above. Hets doesn't seem to know one of the logics used in the examples. Note that the Unknown keyword
|
|
Closed by accident when commenting. Sorry. |
|
Can one of the admins verify this patch? |
|
|
|
continued in #2154 |
The commits on this branch solve some of the parsing issues hets has with the DOL standard.
Two outstanding issues still remain:
serializationCURIES (so don't use those yet when you're testing)selectandrejectcan not handleSymbolListswhich is why the ticket can not be fully closed yet. The fixes for those issues will follow soon.
I'm creating this pull request before fully solving this issue because one can still use the parser on quite a few things, so it might be of some help already.
I tested for conflicts. There shouldn't be any.