GEGlobalResearch / DARPA-ASKE-TA1

ANSWER Project to demonstrate knowledge-driven extraction of scientific models from code and texts
Other
7 stars 5 forks source link

See annotation refactoring #63

Closed crapo closed 4 years ago

crapo commented 4 years ago

@kittaakos , I added a "see" annotation a while back to the SADL grammar. Now I want to add the ability for the backend AnswerCMStatement to have "(see )" after any statement so that we can have a link to related graphics, etc. However, I'm running into grammar issues. I thought that they could be resolved by refactoring SadlAnnotation to separate the optional leading "," from the annotation, but that isn't the case. This effort is in the SeeAnnotation branch of both sadlos2 and ASKE TA1.

kittaakos commented 4 years ago

The problem of the ambiguous SADLResource rule: ruleSadlResource

I will try to come up with a solution, right now, I do not know if it is possible.

kittaakos commented 4 years ago

It seems it won't work if we want to reuse the parser rule from SADL. What was the original intention; would the annotation belong to the SADL resource or the entire CM statement?

uri "http://sadl.org/a.dialog".

Foo is a class.
MyFoo is a type of Foo.

CM: MyFoo (see "http://url.com"). // <- annotation belongs to SADL resource
CM: MyFoo (see also "http://url.com"). // <- annotation belongs to CM statement
CM: MyFoo (see "http://url.com") (see also "see"). // <- both the SADL resource and the CM statement has an annotation.

If we would reuse the rule, the parser could not decide what to do with:

CM: MyFoo (see "http://url.com"). // ???? <- does it belong to the SADL resource or the CM statement?

@crapo, why did you want to reuse the rule from SADL? Does it make easier to write an annotation processing code? We could create common interfaces with other ways if required.

crapo commented 4 years ago

I don't really want to reuse the rule from SADL, and I want it to apply to the entire CM statement, but I want to use the keyword "see', which seem like it can't be done. The reason that I want it to be for the entire CM statement is so that it can be applied to any of the many possible forms, e.g., a quoted string.

kittaakos commented 4 years ago

Please write a few examples without modifying the grammar and I check if it is feasible. Thank you!

crapo commented 4 years ago

Attaching a dialog file with examples of various AnswerCMStatements.

AnswerCMStatementLinks.dialog.txt

kittaakos commented 4 years ago

Attaching a dialog file with examples of various AnswerCMStatements.

Thank you! Unfortunately, it won't work. We can either put the CM annotation after the EOS or we have to use see also keyword. See the examples:

uri "http://test".
CM: Fruit is a class. (see "https://www.wikidata.org/wiki/Q3314483")
CM: Graph "select ?x ?y ?z where {?x ?y ?z}". (see "file:///C:/Users/200005201/sadl3-master2/runtime-New_configuration/TestSadl3Ide/Graphs/GeorgeAndMartha.owlBirthch.svg")
CM: What is temperature? (see "https://www.wikidata.org/wiki/Q11466")
CM: Yes? (see "https://www.wikidata.org/wiki/Q11466")
CM: External getGamma(float T) returns float: "http://science.org/gamma". (see "https://www.wikidata.org/wiki/Q503869")
CM: "Just to let you know, the back-end agent is named 'CM'". (see "https://github.com/GEGlobalResearch/DARPA-ASKE-TA1/wiki")
CM: Fruit is a class.
uri "http://test".
CM: Fruit is a class (see also "https://www.wikidata.org/wiki/Q3314483").
CM: Fruit is a class (see also "https://www.wikidata.org/wiki/Q3314483").
CM: Graph "select ?x ?y ?z where {?x ?y ?z}" (see also "file:///C:/Users/200005201/sadl3-master2/runtime-New_configuration/TestSadl3Ide/Graphs/GeorgeAndMartha.owlBirthch.svg").
CM: What is temperature (see also "https://www.wikidata.org/wiki/Q11466")?
CM: Yes (see also "https://www.wikidata.org/wiki/Q11466")?
CM: External getGamma(float T) returns float: "http://science.org/gamma" (see also "https://www.wikidata.org/wiki/Q503869").
CM: "Just to let you know, the back-end agent is named 'CM'" (see also "https://github.com/GEGlobalResearch/DARPA-ASKE-TA1/wiki").
CM: Fruit is a class.
crapo commented 4 years ago

OK, thanks. Have to think about this. Maybe we'll do "(See .)" after EOS so it is proper capitalization and punctuation for English. At that point I believe it just becomes another statement ending in EOS that doesn't have a newline in front of it (or it could, as it can appear anywhere).

kittaakos commented 4 years ago

Have to think about this

OK, let me know if you have chosen one of them. I can prepare the PR with some tests.

crapo commented 4 years ago

I've implemented what I think is the desired grammar and pushed to master, along with associated model processing. Please review and add any test cases you think useful. These statements are now valid: CM: Fruit is a class. (See "https://www.wikidata.org/wiki/Q3314483".)

CM: Graph "select ?x ?y ?z where {?x ?y ?z}". (See "file:///C:/Users/200005201/sadl3-master2/runtime-New_configuration/TestSadl3Ide/Graphs/GeorgeAndMartha.owlBirthch.svg".)

CM: Yes. (See "https://www.wikidata.org/wiki/Q11466".)

CM: External getGamma(float T) returns float: "http://science.org/gamma". (See "https://www.wikidata.org/wiki/Q503869".)

CM: "Just to let you know, the back-end agent is named 'CM'". (See "https://github.com/GEGlobalResearch/DARPA-ASKE-TA1/wiki".)

kittaakos commented 4 years ago

I've implemented what I think is the desired grammar and pushed to master

Thanks for the heads-up.

These statements are now valid:

FYI, I can write this too.

uri "http://sadl.org/a.dialog".

(See "a".)
crapo commented 4 years ago

Yes, the implication intended is that the statement refers to something that came before, perhaps all of what came before.

crapo commented 4 years ago

This is now satisfactory in the grammar.