-
Notifications
You must be signed in to change notification settings - Fork 75
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Suggestion to allow single quotes in C template values #761
Conversation
We still run into problems when using a label with a single quote in expressions...
I can work around this in VALVE since it's not a tree, but it's still annoying |
I guess ROBOT should be escaping before insertion: These changes have a fair chance of to breaking somebody's stuff, somewhere. I'll want to unit test them thoroughly, then test against a bunch of real ontologies. If we see significant breakage, then I'll want to hide this improved string handling behind an option. |
But you can plug in expressions into templates, e.g. I can provide this string as a value in a cell (not the substituted template string):
If we escape single quotes before passing it to the parser, this parsing will fail (the unit tests fail):
I don't think there's a good way to know if something is an expression vs. a label, unless we run it through the |
Yes, using the QuotedEntityChecker is the right way to determine whether a cell contains a label. I didn't think I was disagreeing, just mentioning one case. I guess we need a list of cases. |
Oh I misunderstood, sorry! |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'd like to move forward with this, but I need to be convinced that it won't break things. @beckyjackson Please try this on OBI, MRO, ONTIE, and maybe other projects and report on the results.
I think ONTIE is the only one I can think of that uses labels with single quotes in template patterns. I tested it on ONTIE (using the labels instead of the CURIEs) and it worked exactly as expected. I also built MRO and OBI using the JAR from Jenkins and it completed just fine! |
Ok. Please add a few unit tests, and then we'll merge this. |
Test added! |
docs/
have been added/updatedmvn verify
says all tests passmvn site
says all JavaDocs correctCHANGELOG.md
has been updatedCurrently, when a term label contains a single quote, we need to use CURIEs instead of labels in the parent column, or else the term cannot be parsed.
For example, the label:
Results in:
Typically, I would just use
NCBITaxon:1319
instead and the template would be OK, but now that we are using labels with VALVE, we need to be able to reference all labels in the "Parent" columns or else certain functions fail.This is a proposed fix that first attempts to use a
QuotedEntityChecker
to retrieve a class by label. If a class cannot be found, then theManchesterOWLSyntaxClassExpressionParser
is used to try to parse an expression. My one concern is that for large templates with a bunch of class expressions, this double-step may be less efficient. At the same time, it may actually be quicker in some cases where only labels are used. The relevant lines are here:robot/robot-core/src/main/java/org/obolibrary/robot/TemplateHelper.java
Lines 987 to 996 in e486ce9