Skip to content

Conversation

@ialarmedalien
Copy link
Contributor

@ialarmedalien ialarmedalien commented Feb 13, 2025

KBase is currently using the semsql schema with a MySQL database and is likely to use it with other SQL db types in the future. This PR alters a couple of lines to use more generic syntax.

Not sure whether I need to propagate these changes to the various other SQL files and the linkml schema.

Turn off whitespace changes - I didn't realise there were so many trailing spaces in the original file!


DROP TABLE statements;
CREATE TABLE statements (stanza TEXT,subject TEXT,predicate TEXT,object TEXT,value TEXT,datatype TEXT,language TEXT);
CREATE TABLE statements (
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

formatting this like the other declarations

s1.datatype AS value
FROM statements AS s1, statements AS s2 ON (s1.predicate=s2.predicate)
FROM statements AS s1
JOIN statements AS s2 ON (s1.predicate=s2.predicate)
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

MySQL doesn't understand , for JOINs so making it explicit

Comment on lines +1603 to +1604
-- patch statements table
ALTER TABLE statements ADD COLUMN graph TEXT;
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This currently gets added in the build.Makefile. Is there a reason for not adding it to the schema?

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We wanted to avoid it going into the SQL models, because that would cause errors on older sqlite builds when using that version of semsql (e.g. in OAK). This has been out for some time so we should just put it into the schema for the next release in the minor series

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I remembered the reason. rdftab is hardwired for fewer columns, so this has to be done as postprocessing for now.

@cmungall
Copy link
Collaborator

I'll merge this but it will get overridden next generation time, here is the upstream culprit:

https://github.com/linkml/linkml/blob/a49b69df1516b40153b709b605a4611fff304154/linkml/generators/sqltablegen.py#L210-L211

@cmungall cmungall merged commit 64a1df4 into INCATools:main Feb 21, 2025
2 checks passed

DROP TABLE owl_axiom;
CREATE VIEW owl_axiom AS SELECT * FROM owl_reified_axiom UNION SELECT NULL AS id, * FROM statements;
CREATE VIEW owl_axiom AS SELECT * FROM owl_reified_axiom UNION SELECT NULL AS id, statements.* FROM statements;
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

- sqlview>> SELECT * FROM owl_reified_axiom UNION SELECT NULL AS id, * FROM statements

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

Successfully merging this pull request may close these issues.

2 participants