SMS2 for Cosmos using CDATA JDBC Driver

We try to virtually map JSON data from Cosmos to Stardog using the CDATA JDBC Driver. The following script works:

PREFIX owl: <>
PREFIX rdf: <>
PREFIX rdfs: <>
PREFIX stardog: <tag:stardog:api:>
PREFIX xsd: <>

  FROM [myDB].[myFile]
TO {
  ?subject <> ?value_1 .
  ?subject <> ?value_2 .
  BIND(template("{value_1}") AS ?subject)

However, the JSON data is nested. E.g., the example structure looks like the following:

"prop1" : "value_1",
 "prop2" : {[
                "prop2_1" : "value_2_1",
                "prop2_2" : "value_2_2",

Is there a way to apply the "FROM JSON" mapper techniques together with the "FROM SQL"? The goal would be to have resulting RDF like the following:

  ?subject <> ?value_1 .
  ?subject <> ?value_2_1 .
  ?subject <> ?value_2_2 .

Is this possible using the JDBC Driver? Or would we have to use a Mongo one?

The MongoDB driver is the supported one, though we do support many of the other CData drivers. If you do choose to try the CData driver then you must use FROM SQL. Any JSON to relational mapping will have to be done through the CData schema mapping file, though, as indicated, this is not the supported method for accessing MongoDB/CosmoDB from Stardog.


Thanks, Paul.

Just to clarifiy for a slightly different input. I guess there is no way to catch all the elements of the list "prop2" using the "FROM SQL" route, is there?

E.g., in a "From JSON" section one can do that like that:

"prop1" : "value_1",
 "prop2" : {[
                    {"id" : "?my_id"},
                    {"id" : "?my_id"}
} TO {
?s :has_prop2 ?my_id         

I am struggling to do a similar thing here. At what point could I use the schema mappring approach from CData? Or ist this rather a CData related question?

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.