Error in creating a virtual graph with Azure Cosmos DB

Hi All,

I'm new to stardog. Getting irrelevant error of "SMS2 mappings for rel databases must use sql sources(Bad request)" when tried to create a virtual graph with azure cosmos db mongo api.

Tried creating a virtual graph with MySQL and mongo db and able to create it .

the same mapping i have used for virtualizing mongodb and it worked.

Trying to create a virtual graph by connecting with Azure CosmosDB Mongo API through stardog studio.

In Data Sources , the connection is created.

Populated the same sample movie json data provided for mongo db virtual graphs from documentation into the azure cosmos db mongo api .

Given a sms mapping file provided in documentation (Mapping Data Sources | Stardog Documentation 7.6.4) - but while creating a virtual graph from stardog studio.

Receiving the below error :

Used configs :

Database name : movies

Collection name : movies

Data source config :
jdbc.url =;AccountKey=******

sms mapping :
MAPPING urn:movies
"director":[ {
"actor":[ {
TO {
?movie a :Movie ;
:name ?name ;
:datePublished ?xsdDatePublished ;
:genre ?genre ;
:boxOffice "?boxOffice"^^xsd:integer ;
:description ?description ;
:directed ?directedMovie ;
:actedIn ?actedInMovie .

?directedMovie a :DirectedMovie ;
:director ?director ;
:name ?directorName .

?director a :Person .

?actedInMovie a :ActedInMovie ;
:actor ?actor ;
:name ?actorName .

?actor a :Person .
//removed other bindings due to link constraint while creating a post //
BIND (xsd:date(?datePublished) AS ?xsdDatePublished)

data in cosmos db:
"datePublished":new Date("1992-08-07T00:00:00.000Z"),
"genre":["Drama", "Western"],
"description":"Retired gunslinger reluctantly takes on one last job.",
{"director":"clintEastwood", "name":"Clint Eastwood"}
{"actor":"morganFreeman", "name":"Morgan Freeman"},
{"actor":"clintEastwood", "name":"Clint Eastwood"},
{"actor":"geneHackman", "name":"Gene Hackman"}
"name":"No Way Out",
"datePublished":new Date("1987-08-14T00:00:00.000Z"),
"genre":["Action", "Mystery", "Drama", "Thriller"],
"description":"A coverup and witchhunt occur after a politician accidentally kills his mistress.",
{"director":"rogerDonaldson", "name":"Roger Donaldson"}
{"actor":"geneHackman", "name":"Gene Hackman"},
{"actor":"kevinCostner", "name":"Kevin Costner"}

Hi Sam,

Thanks for the question. You should be creating a connection to CosmosDB using the MongoDB dialog, not SQL/JDBC. Can you try this and let us know if it works?


Thank you very much jess. Your suggestion worked .

Could you please tell us , which of the api's (SQL, Gremlin, Cassandra) in Azure Cosmos DB work with Azure Cosmos DB connector in stardog?

Does only SQL API of Azure cosmos DB work with Azure Cosmos DB connector of stardog ?

We have only tested Cosmos DB using the MongoDB API. You could perhaps try CDATA's Cosmos DB JDBC Driver.


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