-
Notifications
You must be signed in to change notification settings - Fork 5
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
chore: autoformat sparql-files with pre-commit #327
base: master
Are you sure you want to change the base?
Conversation
e67f5ba
to
b71b0ea
Compare
insert {graph ${g} {?s cim:IdentifiedObject.mRID ?mrid}} | ||
where { | ||
graph ${g} {?s a ${rdf_type}} | ||
filter (not exists {?s cim:IdentifiedObject.mRID ?mrid}) | ||
bind(str(?s) as ?mrid) | ||
|
||
INSERT { | ||
GRAPH ?g { | ||
?s cim:IdentifiedObject.mRID ?mrid . | ||
} | ||
} | ||
WHERE { | ||
GRAPH ?g { | ||
?s a ?rdf_type . | ||
} | ||
FILTER NOT EXISTS { | ||
?s cim:IdentifiedObject.mRID ?mrid . | ||
} | ||
BIND (str(?s) AS ?mrid) |
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.
I struggled a bit with the substitutions ${g}
and ${rdf_type}
here. They trip up the formatter. Temporarily replacing them with placeholder strings, and putting the substitutions back after formatting, caused other issues. So I've removed them. But I haven't made the corresponding changes in the code yet. Are the substitutions necessary?
I unfortunately couldn't find a pip-installable CLI that actually works, this npm package is the only relatively bug-free formatter I could find. The substitutions are causing some issues, hence the script that temporarily replaces them. If we remove the substitutions we don't need the script. |
filter(?analysis_enabled) | ||
filter(?connected) | ||
FILTER (?analysis_enabled = true) | ||
FILTER (?connected = true) |
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.
When the formatter finds a FILTER
call with just a bool variable as argument, it removes the parenthesis. Run it again, and it complains about the missing parenthesis ... I think that's a bug, and will file an issue. In the meantime, I'm explicitly comparing against true
to avoid the issue.
No description provided.