Hi Team,
I'm trying to create a stardog mapping syntax (SMS) to virtual graph from mongo data source.
For the below data and mapping i couldn't see any relationship "productionCompany" which is in the array format in the mongo db.
Could somebody please advise if anything needs to be corrected or any points needs to be considerd ?
as i'm following the base instructions from Bring More Structure to MongoDB With a Knowledge Graph | Stardog and Mapping Data Sources | Stardog Documentation Latest for different dataset
References:
Output:
Sample Mongo Data:
{
"_id": ObjectId("6135b2a3885ba5ff8c3d0df9"),
"genres": "[{'id': 18, 'name': 'Drama'}]",
"id": 16420,
"imdb_id": "tt0114057",
"original_language": "en",
"original_title": "Othello",
"overview": "The evil Iago pretends to be friend of Othello in order to manipulate him to serve his own end in the film version of this Shakespeare classic.",
"popularity": 1.845899,
"production_companies": "[{'name': 'Columbia Pictures', 'id': 5}, {'name': 'Castle Rock Entertainment', 'id': 97}]",
"production_countries": "[{'iso_3166_1': 'IT', 'name': 'Italy'}]",
"release_date": "15-12-1995",
"revenue": 0,
"runtime": 123,
"status": "Released",
"tagline": "Envy, greed, jealousy and love.",
"title": "Othello",
"vote_average": 7,
"vote_count": 33
}
Mapping:
PREFIX : <http://ac.com/movies/>
MAPPING <urn:movies>
FROM JSON {
"movies":{
"id":"?movieId",
"imdb_id":"?imdbId",
"original_language":"?lang",
"original_title":"?title",
"overview":"?overView",
"popularity":"?popularity",
"productionCompany":[ {
"name":"?productionCompanyName",
"id":"?productionCompanyId"
} ],
"release_date":"?releaseDate",
"revenue":"?revenue",
"runtime":"?time",
"status":"?status",
"tagline":"?movieTagline",
"title":"?movieTitle",
"vote_average":"?voteavg",
"vote_count":"?voteCount"
}
}
TO {
?movies a :Movie ;
:movieid ?movieId;
:imdb_id ?imdbId;
:origlanguage ?lang;
:origtitle ?title;
:overview ?overView;
:popularity ?popularity;
:daterelease ?releaseDate;
:revenuecost ?revenue;
:runningtime ?time;
:moviestatus ?status;
:movietagline ?movieTagline;
:movietitle ?movieTitle;
:avgvote ?voteavg;
:votecount ?voteCount ;
:productionCompany ?productionCompany .
?productionCompany a :Org ;
:name ?productionCompanyName ;
:id ?productionCompanyId .
}
WHERE {
BIND (template("http://ac.com/movies/{productionCompanyId}") AS ?productionCompany)
BIND (xsd:string(?movieId) AS ?movies)
}
NOTE: with below kind of mapping i can get results in an embeeded json way. but i need to assign only "Id" as object for relationship "productioncompanies"
result: