Native MongoDB Support is Here!

Nov 8, 2018, 4 minute read
Stardog Newsletter

Get the latest in your inbox

We’re pleased to announce a major new release of Stardog that includes native support for unifying MongoDB data silos in Stardog.

Why MongoDB?

Unification of all data, far and wide, is crucial to building a comprehensive enterprise-level knowledge graph. At Stardog, we cater to the proliferation of different types of data sources as organizations grow and build new applications. By adding support for unifying data in MongoDB databases, it’s now possible to map JSON structured data into your knowledge graph.

MongoDB’s rise to popularity was quite sudden and shepherded an age of loosely structured data and a departure from the rigid schema of relational databases. With built-in clustering and a data model and API attractive to application developers, MongoDB instances started popping up everywhere. This included grassroots applications running on MongoDB instances sometimes outside the control of enterprise IT departments.

As applications matured, it became clear the momentum was unsustainable. Performance characteristics were unpredictable. Data quality could not be easily maintained. Analytics tools weren’t able to deal with the query language or nested structure. These issues have largely been addressed building MongoDB into a feature-rich platform suitable for production grade applications. For its intended purposes, we like MongoDB very much.

To learn more about our native MongoDB support, join our webinar. For more details about the new release, read on.

Enter Stardog

Stardog provides the tools necessary to build a global view over all your data. This requires, at a minimum, visibility of all your data to establish and operatioanlize meaningful relationships between disparate sources. The knowledge graph approach facilitates this through the use of a flexible, reusable graph-based data model.

Stardog’s virtual graph feature unifies structured data sources, e.g. databases and formatted data files, by simply providing a mapping from the source schema, which may be SQL, CSV, JSON, etc, to RDF. Virtual graphs are a powerful notion that provide the ability to access external databases, either directly via federation or by materializing the data into Stardog. A query over the combined graph can span any number of sources and Stardog handles the complexities of efficiently finding the answers.

Mapping JSON to the Graph

The task of mapping one data source to another begins with an understand of both schemas. Stardog exposes a declarative mapping syntax which simplifies writing mappings by allowing users to specify the source and target of the mapping intuitively in their native syntax.

Mapping MongoDB data into the graph is done by specifying a JSON or GraphQL template of the data in SMS2 format. SMS2, the native Stardog mapping language, is plain and simple if you’re familiar with JSON and RDF. There’s no obtuse mapping specification with a long learning curve. SMS2 is based on the SPARQL query language with a special provision to specify mapping sources in their native syntax.

The following mapping is a simple example of using GraphQL to specify the structure of the source data in MongoDB:

# Mapping using GraphQL source
MAPPING
FROM graphql {
  # Root indicates a query over the "movies" collection
  movies {
    _id
    name
    director @array {
        directorName: name
    }
  }
}

# RDF target
TO {
  ?movie a :Movie ;
    :name ?name ;
    :directedBy ?directorName .
}

# Transformations from source bindings to target bindings
WHERE {
  BIND (template("http://stardog.com/movies/Movie_{movieId}") AS ?movie)
}

Now we have a mapping from a source, which in this case is a MongoDB database, to an RDF graph. The source, here given in GraphQL syntax, clearly reflects the structure of the source JSON data. Each object in the MongoDB document collection will bind the ?_id, ?name and ?directorName variables. The WHERE clause here specifies transformations such as building IRIs from literal values. We can add more mappings here that would pull from various RDBMS systems and map other data into the knowledge graph.

SMS2 gives you the ability easily map data into the knowledge graph with a minimum of overhead. When combined with Stardog Studio, editing is a breeze.

MongoDB Virtual Graphs

With MongoDB databases mapped into the graph, we now have the full power of Stardog at our fingertips. Stardog’s Knowledge Toolkit provides powerful reasoning and machine learning capabilities. These tasks would require significant external effort when using MongoDB standalone. SPARQL queries can perform sophisticated operations including joins, filtering and aggregation, without explicit support from the underlying database!

In addition to virtual graphs over MongoDB, now Stardog also supports CosmosDB. Using CosmosDB’s ability to expose a MongoDB 3.6-compatible front-end, we now have full access to richly structured data in a globally-distributed database in the Azure and Microsoft universe.

Conclusion

With the ability to natively unify MongoDB databases, your Stardog knowledge graph can now encompass a wider range of your data without the need for any external ETL processes. This equals more value add and less maintenance burden. Download Stardog today.

Read more on why data silos are a huge liability here.

download our free e-guide

Knowledge Graphs 101

How to Overcome a Major Enterprise Liability and Unleash Massive Potential

Download for free
ebook