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 = jdbc:cosmosdb:AccountEndpoint=host.cosmos.azure.com:10255;AccountKey=******

sms mapping :
PREFIX : http://stardog.com/movies/
MAPPING urn:movies
FROM JSON {
"movies":{
"_id":"?movieId",
"name":"?name",
"datePublished":"?datePublished",
"genre":["?genre"],
"boxOffice":"?boxOffice",
"description":"?description",
"director":[ {
"director":"?directorId",
"name":"?directorName"
}
],
"actor":[ {
"actor":"?actorId",
"name":"?actorName"
}
]
}
}
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 .
}
WHERE {
//removed other bindings due to link constraint while creating a post //
BIND (xsd:date(?datePublished) AS ?xsdDatePublished)
}

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

Jess

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.

Jess

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