Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Non-deterministic generation in tsv2owl #9

Open
SCVFlare opened this issue Jan 30, 2024 · 1 comment
Open

Non-deterministic generation in tsv2owl #9

SCVFlare opened this issue Jan 30, 2024 · 1 comment

Comments

@SCVFlare
Copy link

Each generation of the owl form tsv2owl is unique. Even though the .tsv stays unchanged properties in owl restrictions get jumbled in a random order each generation. The following link showcases two generations side by side using the same .tsv:
https://www.diffchecker.com/WXWT2Dek/

@VladimirAlexiev
Copy link
Owner

hi @SCVFlare ! As far as I can see, the diffs concern he order of blank nodes like this, right?

        rdfs:subClassOf   [ rdf:type            owl:Restriction ;
                            owl:maxCardinality  1 ;
                            owl:onProperty      s:creativeWorkStatus
                          ] ;

Here is the process:

  • tsv2owl.pl dumps them in the same order it finds them in the sheet, eg
s:CreativeWork rdfs:subClassOf [a owl:Restriction; owl:onProperty s:creativeWorkStatus; ; owl:maxCardinality 1].
...
s:CreativeWork rdfs:subClassOf [a owl:Restriction; owl:onProperty s:primaryImageOfPage; ; owl:maxCardinality 1].
  • Then the Makefile prettifies them using
    riot --formatted=ttl otkg-unformatted.ttl | perl -00e '@a=<>; print sort @a'
    • riot --formatted makes turtle "paragraphs"
    • perl then sorts the paragraphs alphabetically

At the level of paragraphs, this is deterministic.
But inside a paragraph, riot can change the order of Restrictions because every time it runs, it allocates new blank node IDs, and I guess it sorts Restrictions by that. We have no control over this riot behavior.

For reproducibility, it's best to just use otkg-unformatted.ttl.
It's ugly but predictable.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants