Skip to content
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

Problems parsing class expressions with object properties in robot templates #442

Closed
cmungall opened this issue Feb 28, 2019 · 8 comments · Fixed by #444
Closed

Problems parsing class expressions with object properties in robot templates #442

cmungall opened this issue Feb 28, 2019 · 8 comments · Fixed by #444

Comments

@cmungall
Copy link
Contributor

@kaiiam and I are trying to use a template where one of the columns is an expression "RO:nnnnn SOME %". This is failing to parse, as it does not expect SOME. [@kaiiam will update this ticket with specific error messages].

I see from the docs that the default assumption is for a name

If the template string starts with a C and a space then it will be interpreted as a class expression. The value of the current cell will be substituted into the template, replacing all occurrences of the percent % character. Then the result will be parsed into an OWL class expression. ROBOT uses the same syntax for class expressions as Protégé: Manchester Syntax. If it does not recognize a name, ROBOT will assume that you’re trying to refer to a class by its IRI (or compact IRI). This can lead to unexpected behaviour, but it allows you to refer to classes (by IRI) without loading them into the input ontology.

How do we get this parsed as an OP? We tried including -i ro_import.owl but it still seems to assume the RO ID is a class.

Will provide a reproducible example shortly

@kaiiam
Copy link

kaiiam commented Feb 28, 2019

when I try to run it on an example csv file I get the error:

PARSE ERROR error while parsing "RO:0002507 some http://purl.obolibrary.org/obo/ENVO_00000488" at row 3 ("ENVO:3100035"), column 5 ("environmental feature") in table "modules/ebi_biomes.csv": Encountered some at line 1 column 12. Expected one of:
	or
	and
	|EOF|

my csv file is the following:

ID label definition EBI Biomes environmental feature environmental material anatomical entity quality biome (subclass of) EBI Biome Path
ID LABEL A IAO:0000115 A http://www.geneontology.org/formats/oboInOwl#hasNarrowSynonym C RO:0002507 some % C RO:0002507 some % C RO:0002507 some % C RO:0000053 some % C % A http://www.geneontology.org/formats/oboInOwl#hasExactSynonym
ENVO:3100035 glacial lake biome A freshwater lake biome which is determined by a glacial lake. Glacial lake http://purl.obolibrary.org/obo/ENVO_00000488 http://purl.obolibrary.org/obo/ENVO_01001125     http://purl.obolibrary.org/obo/ENVO_01000252 root > Environmental > Aquatic > Freshwater > Ice > Glacial lake

@cmungall
Copy link
Contributor Author

Even more minimal example:

foo_template.csv:

ID,P
ID,C RO:1 some C:1
X:1,Y:1
$ robot template -i foo_rel.owl --template foo_template.csv -o z.owl 
PARSE ERROR error while parsing "RO:1 some C:1" at row 3 ("X:1"), column 2 ("P") in table "foo_template.csv": Encountered some at line 1 column 6. Expected one of:
        or
        and
        |EOF|

For details see: http://robot.obolibrary.org/template#parse-error
Use the -vvv option to show the stack trace.
Use the --help option to see usage information.

foo_rel.owl:

<?xml version="1.0"?>
<rdf:RDF xmlns="http://purl.obolibrary.org/obo/TEMP#"
     xmlns:owl="http://www.w3.org/2002/07/owl#"
     xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"
     xmlns:rdfs="http://www.w3.org/2000/01/rdf-schema#">
    <owl:Ontology rdf:about="http://purl.obolibrary.org/obo/TEMP"/>
    <owl:ObjectProperty rdf:about="http://purl.obolibrary.org/obo/RO_1">
        <rdfs:label rdf:datatype="http://www.w3.org/2001/XMLSchema#string">foo</rdfs:label>
    </owl:ObjectProperty>
</rdf:RDF>

@cmungall
Copy link
Contributor Author

cmungall commented Mar 1, 2019

AH I SEE, it literally uses the same syntax as Protege, in that the rdfs:label is used (quoted with a space). I wasn't aware that "Protege Manchester Syntax" was a thing as such

@cmungall cmungall closed this as completed Mar 1, 2019
cmungall added a commit that referenced this issue Mar 1, 2019
Explicitly stating that rdfs:labels can be used, fixes #442
@jamesaoverton
Copy link
Member

Now I see that there aren't any examples of the interesting Manchester cases in our docs. I'll add an issue for that.

@ramonawalls
Copy link

I think my issue is related, but if not, I'm happy to open a new one. I have a template that uses a pattern with two nested SOME statements. Even though the exact same statements exist in our current version of PPO and the same statements work fine when using DOSDP patterns, I get a syntax error from ROBOT when trying to parse the template:

MANCHESTER PARSE ERROR the expression (((OBI:0000293 some PO:0000003) and (OBI:0000299 some (IAO:0000027 and (IAO:0000136 some PPO:0002000))))) at row 7, column 7 in table "../templates/PPO_supporting_classes.tsv" cannot be parsed: encountered unexpected 'some'
	hint: the term before 'some' must be a property

The text version of the above axiom is: ((has specified input some whole plant) and (has specified output some (data item that (is about some plant phenological trait)))

I ran into the same error in another file when I tried to use

PPO:0002001 and (RO:0000080 some (PO:0000003 and (PPO:0000010 some PO:0009011))))

AKA (plant structure presence and (is quality of some (whole plant and (has visible part some plant structure)))

After attempting many permutations, the problem seems to be when using a clause of the form

C and (P some C)

The parser does not properly understand the some.

@jamesaoverton
Copy link
Member

The problem is usually that your robot template command needs an --input foo.owl that specifies that P is an object property. And ROBOT is happier using labels in expressions, so it's better to use 'has specified input' (with the single quotes).

@ramonawalls
Copy link

Thanks, @jamesaoverton. I tried supplying an input file (I read the robot help page so many times), but could not get it to work. Can you point me at an example?

@matentzn
Copy link
Contributor

matentzn commented Jul 4, 2024

@ramonawalls I emailed you just now! If you send me the template I will update the docs / fix the issue in ROBOT!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

5 participants