help me jiba

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

help me jiba

Pakbi
Hi Jiba,
i manage to continue the work you have left in email.
Can you help me with another query. I have send you an email by pasquale.bonasia@clebari.com
Thanks
Pasquale
Reply | Threaded
Open this post in threaded view
|

Re: help me jiba

Pakbi
C:\Users\Pasquale Bonasia\Downloads\OntoPharma>python ./OntoPharma.py
Traceback (most recent call last):
  File "./OntoPharma.py", line 256, in compatibilita
    <''' + Farmaco.iri + '''> onto:glutine ?s . }''')

  File "C:\Users\Pasquale Bonasia\AppData\Local\Programs\Python\Python37\lib\site-packages\owlready2\namespace.py", line 547, 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 553, 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 417, in parse
    t, symstack, statestack, state
  File "C:\Users\Pasquale Bonasia\AppData\Local\Programs\Python\Python37\lib\site-packages\owlready2\rply.py", line 465, in _reduce_production
    if state is None: value = p.func(targ)
  File "C:\Users\Pasquale Bonasia\AppData\Local\Programs\Python\Python37\lib\site-packages\owlready2\sparql\parser.py", line 1015, in f
    p.storid = p.sql = translator.abbreviate(p.value)
  File "C:\Users\Pasquale Bonasia\AppData\Local\Programs\Python\Python37\lib\site-packages\owlready2\sparql\main.py", line 293, in abbreviate
    if r is None: raise ValueError("No existing entity for IRI '%s'! (use error_on_undefined_entities=False to accept unknown entities in SPARQL queries)" % entity)
ValueError: No existing entity for IRI 'http://test.org/codifa.owl#glutine'! (use error_on_undefined_entities=False to accept unknown entities in SPARQL queries)
Reply | Threaded
Open this post in threaded view
|

Re: help me jiba

Jiba
Administrator
Hi,

This error means that the 'http://test.org/codifa.owl#glutine' entity is mentioned in your SPARQL rules but it does not exist in the world in which you execute the rule. There is either an error in the IRI in the rule, or you forgot to load the appropriate ontology in the right world.

Jiba
Reply | Threaded
Open this post in threaded view
|

Re: help me jiba

Pakbi
Hi Jiba, the other query work, only this
Reply | Threaded
Open this post in threaded view
|

Re: help me jiba

Pakbi
individuals = on.individuals()
      next(individuals) # 0
      next(individuals) # 1
      next(individuals) # 2
      Farmaco = next(individuals) # 3
      row = my_world.sparql('''PREFIX onto: <http://test.org/codifa.owl#>
         SELECT ?p ?q ?g ?s {
         <''' + Farmaco.iri + '''> onto:fenilchetonuria ?p .
         <''' + Farmaco.iri + '''> onto:diabete ?q .
         <''' + Farmaco.iri + '''> onto:lattosio ?g .
         <''' + Farmaco.iri + '''> onto:glutine ?s . }''')
      for col in row:
          if col==0:
             f2=row[col]
          if col==1:
             d2=row[col]
          if col==2:
             l2=row[col]
          if col==3:
             g2=row[col]