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

Construct sparql queries #70

Open
gkirtzou opened this issue Apr 7, 2022 · 10 comments
Open

Construct sparql queries #70

gkirtzou opened this issue Apr 7, 2022 · 10 comments
Assignees
Labels

Comments

@gkirtzou
Copy link

gkirtzou commented Apr 7, 2022

Hi,
Does morph-rdb support construct sparql queries? I have a relational database with a mapping into RDF and I would like to extract a subgraph given a starting node x. I found that this could happen using the construct mechanism in a sparql endpoint, but when I tried it with morph-rdb it seems to generate an error.

@ocorcho
Copy link
Member

ocorcho commented Apr 7, 2022

No, there is no support for CONSTRUCT. @fpriyatna can you confirm?

@fpriyatna
Copy link
Collaborator

that's correct, there is no support for CONSTRUCT

@gkirtzou
Copy link
Author

gkirtzou commented Apr 8, 2022

Thank you very much for the quick response. That's so pity that morph-rdb does not support CONSTRUCT queries. Any idea how one could extract a subgraph other that construct queries? Because I need apart from the SPARQL endpoint, which is useful, to be able to get a whole subgraph.

Imagine that my tables are a Person (email, name, website, etc) with her addresses (street, number, area, etc) and her affiliations with institutes, where both Person-Address and Person-Affiliation are 1-n relations (from an relational perspective). I would like to be able to get the whole information for a Person along with the related addresses and institutes and their address and so on, in a structured way, ie the whole subgraph. Any idea if something like this is supported in morph-rdb?

@ocorcho
Copy link
Member

ocorcho commented Apr 8, 2022

Maybe for this type of need you should go for a materialisation engine rather than a virtualisation one, such as morph-RDB. Why don't you try with morph-kgc? https://github.com/oeg-upm/morph-kgc

@gkirtzou
Copy link
Author

gkirtzou commented Apr 8, 2022

I was trying to avoid having a materialized edition of my relational database, because I would need to keep them in sync, as the database is active and its data are constantly changing, via creation/edits/deletions/etc . That's why I was checking how morph-rdb is working. I would checkout morph-kgc, but keep them in sync the relational and the materialized knowledge graph is a painful problem.

@fpriyatna
Copy link
Collaborator

how about creating a view? then you map that view to your target ontology

@gkirtzou
Copy link
Author

An SQL view you mean? My data are records that spread across multiple tables. So what I would like is to extract a single record dynamically every time given only its primary key. Let's say that i merge my whole db into a single view. How could then use this view to get a single row of it using morph-rdb?

Maybe I am missing something.

@dachafra
Copy link
Member

@gkirtzou you can specify in R2RML a SQL view instead of the table name, see https://www.w3.org/TR/r2rml/#r2rml-views

@fpriyatna
Copy link
Collaborator

or you can also create a SQL view, refer it to a normal logicalTable, and use FILTER in your SPARQL query.

@gkirtzou
Copy link
Author

I have already played with using SQL queries, as I need to transform some of the fields anyway. Unfortunately in order to filter the appropriate subset it's not always feasible or easy. My data have more like a document hierarchical structure (model as an ER model across multiple tables) and the criteria whether or not something would need to be modelled/exported as RDF lies in the top of the hierarchy. In some case, with very complicated SQL queries I could extract it, but I trying to keep the mapping as much as simple and modular as possible (as my schema is actively changing).

I found that using the RDF/XML serialization without blank nodes I could get much closer to the hierarchical structure that I need, but I need to verify that this is true for a bigger depth. FYI using blank nodes with RDF/XML serializer generates errors in the log and does not show the correct structure.

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

No branches or pull requests

4 participants