protegeproject / mapping-master

Library that supports the Mapping Master DSL for mapping spreadsheets to OWL ontologies
53 stars 10 forks source link

Lexical error in log is not intuitive #19

Closed nitinsurana closed 5 years ago

nitinsurana commented 6 years ago

Hi I'm trying to parse an excel using cellfie and it just doesn't do anything. In the log it says

org.mm.parser.TokenMgrError: Lexical error at line 1, column 15.  Encountered: "+" (43), after : ""
    at org.mm.parser.MappingMasterParserTokenManager.getNextToken(MappingMasterParserTokenManager.java:4895) ~[na:na]
    at org.mm.parser.MappingMasterParser.jj_scan_token(MappingMasterParser.java:5972) ~[na:na]

It's hard to know which sheet and what column is the error talking about. I believe it'll be very beneficial to add more information to the error. May be we can do something like the empty warning, which states which sheet, column & row is having trouble -

WARN  OWLReferenceRenderer    The cell location 'Users'!D6 has an empty value
martinjoconnor commented 6 years ago

It looks like the Mapping Master expression is incorrect. Can you post it.

nitinsurana commented 6 years ago

@martinjoconnor I believe the expression is correct because if I restrict the number of rows (StartRow/EndRow) it works fine. The exception is related to one of the cells containing a "+"

csnyulas commented 6 years ago

It looks like you figured out which cell has the problem, right?

I am not sure if this is provided by MappingMaster or only by the Cellfie (which wraps MappingMaster's functionality as a Protege 5.x plug-in), but if I execute some rules in Cellfie 1, the log does show which rows are processed. See example below:

Date: 2017-11-15 13:15:55
Ontology source: //www.semanticweb.org/csnyulas/ontologies/2017/10/untitled-ontology-473
Worksheet source: /home/csnyulas/work/protege/test/cellfie/university_notes/Classeur1_good.xlsx
Transformation rules: /home/csnyulas/work/protege/test/cellfie/university_notes/transformation_rules_uni46.json

# Cell range: (Feuil1!A2:A+) Comment: ""
# Class: @A*
#     SubClassOf: @B*

Class: Martin  # Generated from value "Martin" located at cell 'Feuil1'!A2.
   SubClassOf: 13
Class: John  # Generated from value "John" located at cell 'Feuil1'!A3.
   SubClassOf: 14
Class: Lorenz  # Generated from value "Lorenz" located at cell 'Feuil1'!A4.
   SubClassOf: 18
Class: Csongor  # Generated from value "Csongor" located at cell 'Feuil1'!A5.
   SubClassOf: 11
Class: Talya  # Generated from value "Talya" located at cell 'Feuil1'!A6.
   SubClassOf: 9
Class: Filipe  # Generated from value "Filipe" located at cell 'Feuil1'!A7.
   SubClassOf: 6