-
Notifications
You must be signed in to change notification settings - Fork 62
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
SHACL focus node & source Shape #88 #160
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Nice work overall! Certainly the last main class needs to be removed, but you may want to look into my other comments too before submitting an update?
|
||
Model blankNodes = ModelFactory.createDefaultModel(); | ||
|
||
Stream<Statement> statements = report.listStatements(null, SH.result, (RDFNode) null).toList().stream(); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Just a minor comment here: this first creates a List and then a Stream. This may not scale well for large reports. Better would be to use an ExtendedIterator instead, which also has a map function
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Changed it all list creation to use only iterators
statements.forEach(statement -> { | ||
blankNodes.add(statement); | ||
if (statement.getObject().isAnon()) { | ||
blankNodes.addAll(resolveAllBlankNodes(model, statement.getResource())); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This can theoretically run into a recursion if the bnodes have cycles. That is extremely unlikely but is usually handled by passing around a Set of the reached subjects.
Also, it can theoretically cause a stackoverflow when you traverse deep rdf:Lists. Breadth-first traversal avoids that.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Please review current state of the code. I don't know if this is what you wanted
I've refactored code based on your feedback. |
#88
Basically added a extra flag for CLI tool named -addBlankNodes. With this flag enabled tool will append all blank nodes that references shapes file.
Here is the data/shape file I used in testing and the validation report outputted from tool with mention flag enabled
Data and Shape
Validation Report with Blank Node/s