robot icon indicating copy to clipboard operation
robot copied to clipboard

`--include-indirect` seems broken

Open joeflack4 opened this issue 5 months ago • 3 comments

I noticed oddities in one of my projects, and I decided to create a small experiment, and in this experiment, I also cannot get --include-indirect true to work.

Expected behavior:

If I reason on a chain of direct SC relationships, e.g. A ⊑ B ⊑ C, I should get indirect relationships, e.g. A ⊑ C in my output.

Actual behavior:

I don't.

Replicability

  1. Create files chain.ttl:
@prefix :       <http://example.org/chain#> .
@prefix owl:    <http://www.w3.org/2002/07/owl#> .
@prefix rdf:    <http://www.w3.org/1999/02/22-rdf-syntax-ns#> .
@prefix rdfs:   <http://www.w3.org/2000/01/rdf-schema#> .

:A rdf:type owl:Class ;
  rdfs:subClassOf :B .

:B rdf:type owl:Class ;
  rdfs:subClassOf :C .

:C rdf:type owl:Class .

makefile:

direct.ttl: chain.ttl
	robot reason \
	  --input $< \
	  --output $@

direct2.ttl: chain.ttl
	robot reason \
	  --input $< \
	  --include-indirect false \
	  --output $@

indirect.ttl: chain.ttl
	robot reason \
	  --input $< \
	  --include-indirect true \
	  --output $@

.PHONY: check
check: direct.ttl direct2.ttl indirect.ttl
	@echo "=== direct.ttl ==="
	grep "subClassOf" direct.ttl
	md5 direct.ttl
	@echo "=== direct2.ttl ==="
	grep "subClassOf" direct2.ttl
	md5 direct2.ttl
	@echo "\n=== indirect.ttl ==="
	grep "subClassOf" indirect.ttl
	md5 indirect.ttl
  1. Run & observe
make check -B
robot reason \
	  --input chain.ttl \
	  --output direct.ttl
robot reason \
	  --input chain.ttl \
	  --include-indirect false \
	  --output direct2.ttl
robot reason \
	  --input chain.ttl \
	  --include-indirect true \
	  --output indirect.ttl
=== direct.ttl ===
grep "subClassOf" direct.ttl
                             rdfs:subClassOf <http://example.org/chain#B> .
                             rdfs:subClassOf <http://example.org/chain#C> .
                             rdfs:subClassOf owl:Thing .
md5 direct.ttl
MD5 (direct.ttl) = 217dcb5e672934375456a4586bb61fda
=== direct2.ttl ===
grep "subClassOf" direct2.ttl
                             rdfs:subClassOf <http://example.org/chain#B> .
                             rdfs:subClassOf <http://example.org/chain#C> .
                             rdfs:subClassOf owl:Thing .
md5 direct2.ttl
MD5 (direct2.ttl) = 217dcb5e672934375456a4586bb61fda

=== indirect.ttl ===
grep "subClassOf" indirect.ttl
                             rdfs:subClassOf <http://example.org/chain#B> .
                             rdfs:subClassOf <http://example.org/chain#C> .
                             rdfs:subClassOf owl:Thing .
md5 indirect.ttl
MD5 (indirect.ttl) = 217dcb5e672934375456a4586bb61fda

Observe that grep and md5 yield the same results whether include-indirect is true, false, or entirely absent.

I would've expected to see a second rdfs:subClassOf <http://example.org/chain#C> . in indirect.ttl.

Additional info

  • This behavior exists in version 1.9.0 (the one I tried first), and the latest version 1.9.8.
  • I'm using MacOS, if that matters.
  • robot reason docs
  • robot reason --help:
 -d,--include-indirect <arg>                       if true, assert direct and indirect axioms

joeflack4 avatar Jul 22 '25 05:07 joeflack4

If you use --remove-redundant-subclass-axioms false, then the you'll get A ⊑ C with robot 1.9.0 or 1.9.8.

allenbaron avatar Jul 22 '25 11:07 allenbaron

Thanks!

Then in my personal opinion this seems like a UX issue.

Could you have it do one of the following: a. Throw an error if --include-indirect true and --remove-redundant-subclass-axioms false (or left out), explaining that the instructions are ambiguous and it needs to know if the user indeed wants these axioms. b. Have --include-indirect true override --remove-redundant-subclass-axioms false if it is not explicitly passed (my preference)

joeflack4 avatar Jul 22 '25 18:07 joeflack4

Thanks for the issue and discussion! Option (b) sounds good, as long as it doesn't break existing workflows. If someone has time for a PR, that would be great.

I'm about to start my summer vacation, but we can get it sorted out later in August.

jamesaoverton avatar Aug 01 '25 15:08 jamesaoverton