error last version owlready2

classic Classic list List threaded Threaded
2 messages Options
Reply | Threaded
Open this post in threaded view
|

error last version owlready2

Pakbi
C:\Users\Pasquale Bonasia\Downloads\OntoPharma>python ./main.py
* Owlready2 * Warning: optimized Cython parser module 'owlready2_optimized' is not available, defaulting to slower Python implementation
Traceback (most recent call last):
  File "./main.py", line 283, in compatibilita
    querys = list(my_world.sparql('''PREFIX onto:<http://test.org/codifa.owl#> SELECT ?q { onto:''' + i + ''' onto:contiene ?q ?q onto:interazione onto:''' + PA +''' .}'''))
  File "C:\Users\Pasquale Bonasia\AppData\Local\Programs\Python\Python37\lib\site-packages\owlready2\namespace.py", line 535, in sparql
    query = self._prepare_sparql(sparql, error_on_undefined_entities)
  File "C:\Users\Pasquale Bonasia\AppData\Local\Programs\Python\Python37\lib\site-packages\owlready2\namespace.py", line 541, in _prepare_sparql
    return owlready2.sparql.main.Translator(self, error_on_undefined_entities).parse(sparql)
  File "C:\Users\Pasquale Bonasia\AppData\Local\Programs\Python\Python37\lib\site-packages\owlready2\sparql\main.py", line 61, in parse
    self.main_query = PARSER.parse(LEXER.lex(sparql))
  File "C:\Users\Pasquale Bonasia\AppData\Local\Programs\Python\Python37\lib\site-packages\owlready2\rply.py", line 451, in parse
    raise ParsingError("Error at %s" % lookahead, lookahead.source_pos)
owlready2.rply.ParsingError: ("Error at PNAME_NS:'onto:'", 106)
Reply | Threaded
Open this post in threaded view
|

Re: error last version owlready2

Jiba
Administrator
Hi,

I think there is an error in the SPARQL query :

   onto:''' + i + ''' onto:contiene ?q ?q onto:interazione onto:''' + PA +''' .

You have 6 elements while SPARQL expects triples :
 * onto:''' + i + '''
 * onto:contiene
 * ?q
 * ?q
 * onto:interazione
 * onto:''' + PA +'''

You probably forgot a "." in the middle.

Jiba