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

Mapping Submission IDs query fails in AllegroGraph #120

Closed
mdorf opened this issue Jul 7, 2021 · 2 comments
Closed

Mapping Submission IDs query fails in AllegroGraph #120

mdorf opened this issue Jul 7, 2021 · 2 comments

Comments

@mdorf
Copy link
Member

mdorf commented Jul 7, 2021

The SPARQL query in the method def self.retrieve_latest_submission_ids(options = {}) of /lib/ontologies_linked_data/mappings/mappings.rb works in 4store but quietly fails in AllegroGraph (returns no results where results are expected):

SELECT (CONCAT(?ontology, "/submissions/", (MAX(?submissionId))) as ?id)
WHERE {
	?id <http://data.bioontology.org/metadata/ontology> ?ontology .
	?id <http://data.bioontology.org/metadata/submissionId> ?submissionId .
	?id <http://data.bioontology.org/metadata/submissionStatus> ?submissionStatus .
	?submissionStatus <http://data.bioontology.org/metadata/code> "RDF" .
	OPTIONAL {
		?id <http://data.bioontology.org/metadata/ontology> ?ontJoin .
	}
	OPTIONAL {
		?ontJoin <http://data.bioontology.org/metadata/viewOf> ?viewOf .
	}
	FILTER(!BOUND(?viewOf))
}
GROUP BY ?ontology
@mdorf
Copy link
Member Author

mdorf commented Jul 7, 2021

Turns out AG has a stricter interpretation of CONCAT, which takes in String values as arguments. The solution is to explicitly cast the arguments in CONCAT to strings:

PREFIX xsd: <http://www.w3.org/2001/XMLSchema#>
SELECT (CONCAT(xsd:string(?ontology), "/submissions/", xsd:string(MAX(?submissionId))) as ?id)
WHERE {
	?id <http://data.bioontology.org/metadata/ontology> ?ontology .
	?id <http://data.bioontology.org/metadata/submissionId> ?submissionId .
	?id <http://data.bioontology.org/metadata/submissionStatus> ?submissionStatus .
	?submissionStatus <http://data.bioontology.org/metadata/code> "RDF" .
	OPTIONAL {
		?id <http://data.bioontology.org/metadata/ontology> ?ontJoin .
	}
	OPTIONAL {
		?ontJoin <http://data.bioontology.org/metadata/viewOf> ?viewOf .
	}
	FILTER(!BOUND(?viewOf))
}
GROUP BY ?ontology

@mdorf
Copy link
Member Author

mdorf commented Sep 29, 2021

This has been resolved and deployed to production.

@mdorf mdorf closed this as completed Sep 29, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

1 participant