# Inference Engine gives unclear error

**URL:** <https://community.stardog.com/t/inference-engine-gives-unclear-error/3668>\
**Category:** Support\
**Created:** [April 8, 2022, 12:50pm UTC](https://community.stardog.com/t/inference-engine-gives-unclear-error/3668 "2022-04-08T12:50:59Z")\
**Posts on this page:** 10\
**Page:** 1

<div class="post-metadata">

**Author:** ![Smlapenna](https://yyz2.discourse-cdn.com/flex030/user_avatar/community.stardog.com/smlapenna/32/1029_2.png) [@Smlapenna](https://community.stardog.com/u/Smlapenna)\
**Post date:** [April 8, 2022, 12:50pm UTC](https://community.stardog.com/t/inference-engine-gives-unclear-error/3668/1 "2022-04-08T12:50:59Z")

</div>

Good day,

On page: [Inference Engine | Stardog Documentation Latest](https://docs.stardog.com/inference-engine/#explaining-reasoning-results) is the section:

Explanations can be retrieved using the CLI [reasoning explain](https://docs.stardog.com/stardog-cli-reference/reasoning/reasoning-explain) command by providing an input file that contains the inferences to be explained:

**$** stardog reasoning explain myDB inference\_to\_explain.ttl

> > I assumed inference\_to\_explain.ttl is structured to contain triples.

I tried creating a file **inf.ttl** that contains one row:

`:BreachTrd a <https://gbim.scotiabank.com/gbim/ontology/gbm-bim#Breach> .`

`:BreachTrd` is an instance I loaded into stardog database ts

Breach is an OWL defined class I loaded into stardog database ts

When I run reasoning like this:

`stardog reasoning explain ts inf.ttl`

I get this response:

`Unexpected end of file [L7]`

My inf.ttl only has one line – how can stardog be complaining about Line 7

Does anyone have suggestions or tips on how to structure the turtle file to be processed by the inference engine? The documentation does not give an example.

---

<div class="post-metadata">

**Author:** ![zachary.whitley](https://yyz2.discourse-cdn.com/flex030/user_avatar/community.stardog.com/zachary.whitley/32/94_2.png) [@zachary.whitley](https://community.stardog.com/u/zachary.whitley)\
**Post date:** [April 8, 2022, 1:10pm UTC](https://community.stardog.com/t/inference-engine-gives-unclear-error/3668/2 "2022-04-08T13:10:07Z")

</div>

Can you try it with the `-f` flag?

`stardog reasoning explain -f NTRIPLES myDB inference.ttl`

and might as well try turtle too although it shouldn't make any difference.

`stardog reasoning explain -f TURTLE myDB inference.ttl`

and can you check the logs to see if there's anything interesting.

---

<div class="post-metadata">

**Author:** ![evren](https://yyz2.discourse-cdn.com/flex030/user_avatar/community.stardog.com/evren/32/1515_2.png) [@evren](https://community.stardog.com/u/evren)\
**Post date:** [April 8, 2022, 1:52pm UTC](https://community.stardog.com/t/inference-engine-gives-unclear-error/3668/3 "2022-04-08T13:52:10Z")

</div>

The error message is confusing and misleading in this case but I believe the problem is CLI command cannot find the file. Let me explain. As shown in the [examples](https://docs.stardog.com/stardog-cli-reference/reasoning/reasoning-explain#examples) you can explain an inferred triple by simply passing the triple as an argument to the command:

```auto
stardog reasoning explain myDb "ex:JohnDoe a ont:Person"

```

Note that, the command is being helpful and does not require you to have `.` at the end or declare prefixes which are done automatically. That is why you'd see and error about line 7 because prefixes have been prepended. But all this process should happen if the input is not a file. CLI cannot find the file, decides it must be a triple but then fails to parse the triple. You can verify the behavior like this:

```auto
$ stardog reasoning explain test file_does_not_exist
Unexpected end of file [L7]

```

Double check the path your input file is or simply pass the input as a string as above. We'll look into improving the error message to be clearer.

Best,  
Evren

---

<div class="post-metadata">

**Author:** ![Smlapenna](https://yyz2.discourse-cdn.com/flex030/user_avatar/community.stardog.com/smlapenna/32/1029_2.png) [@Smlapenna](https://community.stardog.com/u/Smlapenna)\
**Post date:** [April 8, 2022, 1:58pm UTC](https://community.stardog.com/t/inference-engine-gives-unclear-error/3668/4 "2022-04-08T13:58:46Z")

</div>

Thanks for the suggestions Zachary; here's the outcome:

command: stardog reasoning explain -f NTRIPLES ts inf.ttl  
returns: Expected '\<' or '\_', found: i [L1]

> > at least it recognized line 1

command: stardog reasoning explain -f TURTLE ts inf.ttl  
returns: Unexpected end of file [L7]

> > same error as original

No errors or exceptions in the stardog.log today. [I executed the above today]

---

<div class="post-metadata">

**Author:** ![zachary.whitley](https://yyz2.discourse-cdn.com/flex030/user_avatar/community.stardog.com/zachary.whitley/32/94_2.png) [@zachary.whitley](https://community.stardog.com/u/zachary.whitley)\
**Post date:** [April 8, 2022, 2:32pm UTC](https://community.stardog.com/t/inference-engine-gives-unclear-error/3668/5 "2022-04-08T14:32:20Z")

</div>

Still seems odd that it can't find the file. If there isn't something obvious like you were in the wrong directory try ./inf.ttl and the full path /path/to/my/file/inf.ttl

Also, are you running on Linux or Windows?

---

<div class="post-metadata">

**Author:** ![Smlapenna](https://yyz2.discourse-cdn.com/flex030/user_avatar/community.stardog.com/smlapenna/32/1029_2.png) [@Smlapenna](https://community.stardog.com/u/Smlapenna)\
**Post date:** [April 8, 2022, 2:57pm UTC](https://community.stardog.com/t/inference-engine-gives-unclear-error/3668/6 "2022-04-08T14:57:45Z")

</div>

You resolved it. stardog couldn't find the file.  
Once I changed to the folder where the file resided, I received results.

command: stardog reasoning explain -f TURTLE ts inf.ttl  
returned: assertions and inferences

command: stardog reasoning explain ts inf.ttl  
returned: assertions and inferences

command: stardog reasoning explain -f NTRIPLES ts inf.ttl  
returned: Expected '\<' or '\_', found: : [L1]

---

<div class="post-metadata">

**Author:** ![zachary.whitley](https://yyz2.discourse-cdn.com/flex030/user_avatar/community.stardog.com/zachary.whitley/32/94_2.png) [@zachary.whitley](https://community.stardog.com/u/zachary.whitley)\
**Post date:** [April 8, 2022, 3:18pm UTC](https://community.stardog.com/t/inference-engine-gives-unclear-error/3668/7 "2022-04-08T15:18:01Z")

</div>

My mistake on the NTRIPLES, I didn't notice the empty prefix on the subject. Glad to hear you got it working.

---

<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:** [April 15, 2022, 11:01pm UTC](https://community.stardog.com/t/inference-engine-gives-unclear-error/3668/8 "2022-04-15T23:01:13Z")

</div>



---

<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:** [April 24, 2022, 11:19am UTC](https://community.stardog.com/t/inference-engine-gives-unclear-error/3668/9 "2022-04-24T11:19:19Z")

</div>



---

<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:** [May 3, 2022, 6:54am UTC](https://community.stardog.com/t/inference-engine-gives-unclear-error/3668/10 "2022-05-03T06:54:59Z")

</div>


