apache / apache/jena

rdfdiff finds too many differences

Open
#2,285 1 comment 0 reactions 0 assignees View on GitHub
enhancement
Dominant language
Java
Stars
1.4k
Forks
712
Avg merge
15h 41m
Merged PRs (30d)
53

Description

### Version

5.0.0-rc1

### What happened?

`rdfdiff` finds more differences than there are between two files.
the case below shows two files that are isomorphic except that one has 1 additional triple but `rdfdiff` finds several other differences between the files.

```bash
$ cat issue.ttl
@prefix ex: .

ex:region_10
a ex:Region ;
ex:related [
ex:memberList (
ex:region_11
) ;
] ;
.

$ cat issue1.ttl
@prefix ex: .

ex:region_10
a ex:Region ;
ex:related [
ex:memberList (
ex:region_11
) ;
] ;
.

$ ~/Downloads/apache-jena-5.0.0-rc1/bin/rdfdiff issue.ttl issue1.ttl ttl ttl
models are equal

# that was as expected
# but now when i add a single triple to one of the files:

$ cat issue1.ttl
@prefix ex: .

ex:region_16 a ex:Region .

ex:region_10
a ex:Region ;
ex:related [
ex:memberList (
ex:region_11
) ;
] ;
.
$ ~/Downloads/apache-jena-5.0.0-rc1/bin/rdfdiff issue.ttl issue1.ttl ttl ttl
models are unequal

< 5 triples
> 6 triples
< [http://example.com/region_10, http://example.com/related, _:2f46e8a27dca00569d3d04d42c3f3c53]
< [_:2f46e8a27dca00569d3d04d42c3f3c53, http://example.com/memberList, _:f0c1b4df8bd882e0dc926aee91d36315]
< [_:f0c1b4df8bd882e0dc926aee91d36315, http://www.w3.org/1999/02/22-rdf-syntax-ns#rest, http://www.w3.org/1999/02/22-rdf-syntax-ns#nil]
< [_:f0c1b4df8bd882e0dc926aee91d36315, http://www.w3.org/1999/02/22-rdf-syntax-ns#first, http://example.com/region_11]
> [_:d310f6311ac18f96e2c81f63007497e6, http://example.com/memberList, _:fe69945f1dff1961864044d0b5a4c756]
> [http://example.com/region_16, http://www.w3.org/1999/02/22-rdf-syntax-ns#type, http://example.com/Region]
> [http://example.com/region_10, http://example.com/related, _:d310f6311ac18f96e2c81f63007497e6]
> [_:fe69945f1dff1961864044d0b5a4c756, http://www.w3.org/1999/02/22-rdf-syntax-ns#rest, http://www.w3.org/1999/02/22-rdf-syntax-ns#nil]
> [_:fe69945f1dff1961864044d0b5a4c756, http://www.w3.org/1999/02/22-rdf-syntax-ns#first, http://example.com/region_11]

# but i only expected a single triple difference between the two files
```

i expected output something like this:
```
models are unequal

< 0 triples
> 1 triples
> [http://example.com/region_16, http://www.w3.org/1999/02/22-rdf-syntax-ns#type, http://example.com/Region]
```

I got the same results on jena 4.10.x.

### Relevant output and stacktrace

_No response_

### Are you interested in making a pull request?

None

Contributor guide

Open the contributing guide

Research direction

Start by reproducing the two `rdfdiff` commands from the issue with the supplied Turtle files and compare the reported triples. Then trace the `rdfdiff` command entry point and its RDF model-difference handling, focusing on blank-node and list matching. Done means the original case still reports unequal models while showing only the single added `region_16` triple.

Written by the indexing model from the issue text.

Assessment

Tech stack
java
Domain
cli
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
42/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.