# Reasoning doesn't work from python application

**URL:** <https://community.stardog.com/t/reasoning-doesnt-work-from-python-application/2827>\
**Category:** Support\
**Created:** [December 7, 2020, 12:44pm UTC](https://community.stardog.com/t/reasoning-doesnt-work-from-python-application/2827 "2020-12-07T12:44:27Z")\
**Posts on this page:** 8\
**Page:** 1

<div class="post-metadata">

**Author:** ![SuWai](https://avatars.discourse-cdn.com/v4/letter/s/bc8723/32.png) [@SuWai](https://community.stardog.com/u/SuWai)\
**Post date:** [December 7, 2020, 12:44pm UTC](https://community.stardog.com/t/reasoning-doesnt-work-from-python-application/2827/1 "2020-12-07T12:44:27Z")

</div>

I tried to run the following query from the python application.  
Query: conn.select('PREFIX rdf: [http://www.w3.org/1999/02/22-rdf-syntax-ns#](http://www.w3.org/1999/02/22-rdf-syntax-ns#)   
PREFIX owl: [http://www.w3.org/2002/07/owl#](http://www.w3.org/2002/07/owl#)   
PREFIX rdfs: [http://www.w3.org/2000/01/rdf-schema#](http://www.w3.org/2000/01/rdf-schema#)   
PREFIX xsd: [http://www.w3.org/2001/XMLSchema#](http://www.w3.org/2001/XMLSchema#)   
PREFIX MDRS: [http://www.MRDS.com#](http://www.MRDS.com#)   
ASK { ?phone a MDRS:Apple\_Lover.}', content\_type='application/sparql-results+json', reasoning=True)  
Return in Python application: {'head': {}, 'boolean': False}  
In browser:

 ![image](https://canada1.discourse-cdn.com/flex030/uploads/stardog/original/1X/99359ee0afc6c4480c685914869adc2f989f5185.png)  
It is returning true in the browser.

---

<div class="post-metadata">

**Author:** ![stephen](https://yyz2.discourse-cdn.com/flex030/user_avatar/community.stardog.com/stephen/32/27_2.png) [@stephen](https://community.stardog.com/u/stephen)\
**Post date:** [December 7, 2020, 1:17pm UTC](https://community.stardog.com/t/reasoning-doesnt-work-from-python-application/2827/2 "2020-12-07T13:17:03Z")

</div>

Hi,

What version of both Stardog and pystardog are you running? The fact that you're using webconsole in the browser points to your Stardog being at least one major release behind, which could potentially explain what you're seeing. I am unable both to reproduce your error and to run the command you provided in the latest pystardog release:

```python
>>> query = """PREFIX rdf: <http://www.w3.org/1999/02/22-rdf-syntax-ns#>
... PREFIX owl: <http://www.w3.org/2002/07/owl#>
... PREFIX rdfs: <http://www.w3.org/2000/01/rdf-schema#>
... PREFIX xsd: <http://www.w3.org/2001/XMLSchema#>
... PREFIX MDRS: <http://www.MRDS.com#>
... ASK { ?phone a MDRS:Apple_Lover.}"""
>>> conn.ask(query)
False
>>> conn.ask(query, reasoning=True)
True
>>> conn.ask(query, content_type='application/sparql-results+json', reasoning=True)
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "/Users/stephen/.pyenv/versions/3.8.5/lib/python3.8/site-packages/stardog/connection.py", line 331, in ask
    r = self.conn.query(query, self.transaction, content_types.BOOLEAN,
TypeError: query() got multiple values for argument 'content_type'

```

---

<div class="post-metadata">

**Author:** ![SuWai](https://avatars.discourse-cdn.com/v4/letter/s/bc8723/32.png) [@SuWai](https://community.stardog.com/u/SuWai)\
**Post date:** [December 7, 2020, 2:21pm UTC](https://community.stardog.com/t/reasoning-doesnt-work-from-python-application/2827/3 "2020-12-07T14:21:20Z")

</div>

stardog version was Stardog Version: 6.0.1.  
pystardog version is expected to be 0.9.7 since i installed with pip.  
I tried again after updating the stardog version to 7 and it works fine now in python application but i can't connect from browser and showing this after logging in with the admin account.  
Thank you so much.

 ![image](https://canada1.discourse-cdn.com/flex030/uploads/stardog/original/1X/2e6a4a80328e63f6e2e19da227e1e5ccf4b7dec1.png)

---

<div class="post-metadata">

**Author:** ![SuWai](https://avatars.discourse-cdn.com/v4/letter/s/bc8723/32.png) [@SuWai](https://community.stardog.com/u/SuWai)\
**Post date:** [December 7, 2020, 2:21pm UTC](https://community.stardog.com/t/reasoning-doesnt-work-from-python-application/2827/4 "2020-12-07T14:21:52Z")

</div>

![image](https://canada1.discourse-cdn.com/flex030/uploads/stardog/original/1X/d6271122542bf4d8e0cb1b1c4a893ca02fd754c3.png)

---

<div class="post-metadata">

**Author:** ![stephen](https://yyz2.discourse-cdn.com/flex030/user_avatar/community.stardog.com/stephen/32/27_2.png) [@stephen](https://community.stardog.com/u/stephen)\
**Post date:** [December 7, 2020, 2:25pm UTC](https://community.stardog.com/t/reasoning-doesnt-work-from-python-application/2827/5 "2020-12-07T14:25:22Z")

</div>

This is because we deprecated the web console in Stardog 7. As a replacement you can either download Stardog Studio or use the in-browser version by going to [http://stardog.studio](http://stardog.studio)

---

<div class="post-metadata">

**Author:** ![SuWai](https://avatars.discourse-cdn.com/v4/letter/s/bc8723/32.png) [@SuWai](https://community.stardog.com/u/SuWai)\
**Post date:** [December 7, 2020, 2:27pm UTC](https://community.stardog.com/t/reasoning-doesnt-work-from-python-application/2827/6 "2020-12-07T14:27:08Z")

</div>

Okay. Thank you so much for fast and easy-to-follow reply. Really appreciate ur effort and time. 😄

---

<div class="post-metadata">

**Author:** ![SuWai](https://avatars.discourse-cdn.com/v4/letter/s/bc8723/32.png) [@SuWai](https://community.stardog.com/u/SuWai)\
**Post date:** [December 7, 2020, 2:32pm UTC](https://community.stardog.com/t/reasoning-doesnt-work-from-python-application/2827/7 "2020-12-07T14:32:54Z")

</div>

One final question. Why reasoning **doesn't work unless u load the data again** into the database with the two lines  
**conn.add(stardog.content.File('./data/mdrs.owl'))**  
**conn.commit()**  
before running the query?  
The query returns when i added the two lines but no result when i don't add this two lines even thought the data is loaded. It doesn't make sense to me that I need to load the data again and again even thought there is no changes.

 ![image](https://canada1.discourse-cdn.com/flex030/uploads/stardog/original/1X/ac1796163940cb531a9752ebea6c4e93f0d938f6.png)

---

<div class="post-metadata">

**Author:** ![system](https://canada1.discourse-cdn.com/flex030/uploads/stardog/original/2X/e/ed66b48a616f505106a4acde3c9cee7e6da9bc67.svg) [@system](https://community.stardog.com/u/system)\
**Post date:** [December 21, 2020, 2:32pm UTC](https://community.stardog.com/t/reasoning-doesnt-work-from-python-application/2827/8 "2020-12-21T14:32:57Z")

</div>

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.
