oeg-upm / morph-rdb

Virtual Knowledge Graph Creation from RDB with R2RML
https://morph.oeg.fi.upm.es/tool/morph-rdb
Other
40 stars 36 forks source link

SPARQL sub query feature #64

Open huanyu-li opened 3 years ago

huanyu-li commented 3 years ago

Hi,

May I ask a if there is any example like sparql sub query? I tried to write a sparql query which includes a sub query in my case. But the result generated is not correct. The query looks like below.

SELECT ?structure ?formula WHERE{ ?structure rdf:type core:Structure; structure:Composition ?composition. ?composition structure:formula ?formula. { select ?structure where{ ?structure structure:Composition ?composition1; structure:formula ?formula1. Filter (?formula1 in ("MnCl2", "YClO")) } } }

Thank you in advance.

Best, Huanyu

fpriyatna commented 3 years ago

hi Huanyu,

Thank you for using morph. I don't remember implementing subquery so we can assume that the feature has not been implemented yet.

Would it be possible for you to share with you the dataset/mapping?

Thanks again Freddy

huanyu-li commented 3 years ago

Thank you, Freddy. Here is the link of my example, including sql files, sparql query, mapping and morph properties config. https://drive.google.com/file/d/1fZHdxcMzn-iZ3h8ZCavgHDaJRAFXbStB/view?usp=sharing

In addition, following is the output transformed query after I run morph-rdb from a terminal.

SELECT V_72436.material_id AS "structure",V_82677.formula_pretty AS "formula",419792179 AS "mappingid_structure",2084863094 AS "mappingid_formula" FROM mp-1K-structure V_72436 INNER JOIN mp-1K-composition V_48056 ON (V_72436.material_id = V_48056.material_id) INNER JOIN mp-1K-composition V_82677 ON ((V_48056.material_id = V_82677.material_id) AND (V_82677.formula_pretty IS NOT NULL)) INNER JOIN mp-1K-structure V_11132 ON (1 = 1) INNER JOIN mp-1K-composition V_55637 ON (V_11132.material_id = V_55637.material_id) INNER JOIN mp-1K-composition V_49315 ON (((V_55637.material_id = V_49315.material_id) AND (V_49315.formula_pretty IS NOT NULL)) AND (V_49315.formula_pretty IN ('MnCl2', 'YClO')))