Successfully reported this slideshow.
We use your LinkedIn profile and activity data to personalize ads and to show you more relevant ads. You can change your ad preferences anytime.

JSON-LD and SHACL for Knowledge Graphs


Published on

Enterprise systems are increasingly complex, often requiring data and software components to be accessed and maintained by different company departments. This complexity often becomes an organization’s biggest challenge as changing data fields and adding new applications rapidly grow to meet business demands for increased customer insights.

These slides are from a Webinar discussing how using SHACL and JSON-LD with AllegroGraph helps our customers simplify the complexity of enterprise systems through the ability to loosely combine independent elements, while allowing the overall system to function smoothly.

In this Webinar we will demonstrate how AllegroGraph’s SHACL validation engine confirms whether JSON-LD data is conforming to the desired requirements. We will describe how SHACL provides a way for a Data Graph to specify the Shapes Graph that should be used for validation and describes how a given shape is linked to targets in the data.

The recording is at

Published in: Software
  • Be the first to comment

  • Be the first to like this

JSON-LD and SHACL for Knowledge Graphs

  1. 1. JSON-LD and SHACL for Knowledge Graphs Dr. Jans Aasman (
  2. 2. Contents • Knowledge Graphs are getting popular very fast, are you building a Knowledge Graph already? • JSON-LD will help you add and delete objects to a Knowledge Graph as easy as MongoDB • SHACL will help you validate your data in the Knowledge Graph.
  3. 3. Knowledge Graphs on the rise • Line one
  4. 4. All the big ones in the US heavily investing in it • Good luck trying to find a definition on the web that is not ideology or vendor based or very application specific
  5. 5. Many technologies make a Semantic Knowledge Graph
  6. 6. Documents: JSON, JSON-LD Graphs: RDF, Quads, Properties Storage: Triple Attributes, Security Filters, Compression, Indexing, Full-text Transactions: “Real” ACID, 2 Phase Commit Management: Security, Multi-Master Replication, Backup/Restore, Warm Failover Stored Procs: JavaScript Lisp Prolog SPARQL Magic Predicates Reasoning: RDFS++ OWL2-RL Prolog Probabilistic NLP: Taxonomies Entity Extract Text Classify Sentiment Machine Learning ETL: RDBMS CSV TEXT NoSQL Events: Geospatial Temporal Social REST GUI: GRUFF/AGWebView Java Python Lisp Built-In Integrations Cloud: Amazon AWS Microsoft Azure Data Science: Anaconda R Studio Knowledge: Linked Open Data Editors: Ontology, Taxonomy NoSQL: Cloudera, MongoDB, Solr Containers: Docker, VMWare Massively Parallel - Federation and Sharding OSS Clients SPARQL Prolog Don’t worry, it is all easily accessible in AllegroGraph Architecture
  7. 7. Successful Knowledge Graphs built on • SKOS Taxonomies & OWL Ontologies • RDF based Semantic Graph Technologies: • Based on the uniqueness principle: one Thing, one URL • If you don’t have that, you don’t have anything • Property graphs destined to reinvent semantics • But: • Your User Experience and Application developers don’t want to learn that entire stack
  8. 8. Challenge # 1 for UI and application developers: How do you make it easy to • Add data to a knowledge graph • Retrieve data from a knowledge graph • Validate your data
  9. 9. Solution: • Knowledge Graphs are getting popular very fast, are you building a Knowledge Graph already? • JSON-LD will help you add, retrieve and delete objects to a Knowledge Graph as easy as MongoDB • SHACL will help you validate your data in the Knowledge Graph.
  10. 10. JSON Won • Messaging: • the lingua franca for messaging and data exchange • Configuration: • JSON is replacing XML for configuration of nearly anything • Document and key/value store: • JSON is the main data format stored in Document Stores (Couchbase, Mongo, etc…)
  11. 11. JSON – the good • Simple standard: • spec is 5 pages, XML spec on W3C = 60 pages J • only a few datatypes and with arrays! • you can make your own complex data types if you want • Easy to read and parse by humans and machines • Easy to store in document stores • Easy to program: support in every programming language
  12. 12. JSON (and JSON stores) – the bad • No standards Schema (but close!) • How do I know that the data I received is good, how do I know that the data I’m going to send to my document store is good? • No Semantics for attributes • What does that attribute mean? • Not set up for linking data • How do I express linkage between JSON objects? • No joins or graph search in document stores • There simply is no concept of a relations between objects • Client side joins or awkward procedures in javascript in the DB
  13. 13. JSON-LD = 100 % JSON + • Add basic schema support to JSON: (but SHACL more complete) • Add semantics to JSON objects: what does this attribute mean • Designed to link JSON objects together • Enables joins and graph search in document stores
  14. 14. Learn from JSON-LD.ORG
  15. 15. Google for allegrograph python tutorial jsonld
  16. 16. It is everywhere: let’s look at this product
  17. 17. Search for @context in the source
  18. 18. JSON alone would lead to confusion, JSON-LD and SCHEMA.ORG to the rescue NO Meaning WITH Meaning
  19. 19. Demo JSON-LD in Python • Based on crunch base data from early 2000 till 2014 • Core objects: Investments, acquisitions, investors, companies • For developers: how can you implement basic CRUD with AllegroGraph JSONLD • You can add and retrieve Python dictionaries directly • Like many other document databases • Objects are indexed with triples but can also be stored as blobs • You can retrieve parts of objects in a SPARQL queries • And you can retrieve as dictionaries.
  20. 20. And now SHACL
  21. 21. Semantic graphs allow you to be very ‘wild’ with your data • Triples can be added without any schema definition • Sometimes too flexible for the enterprise • So the most asked question the last two years: • Ummm, do you guys support SHACL validation?
  22. 22. SHACL seems to be replacing OWL • Easier to read • Less complicated • OWL can still be derived automatically from SHACL • Great tutorials on the web.
  23. 23. title • Line one
  24. 24. SHACL • Is data modeling language developed by a W3C Working Group. • describes the “shapes” of the data so that applications can take better advantage of that data. • describes which properties go with which classes (like OWL) • defines constraints on data with standardized models instead of procedural code. • Has several built-in types of constraints such as cardinality (minCount/maxCount), value type and allowed values, but it is also possible to define more complex kinds of constraints for almost arbitrary validation conditions • SHACL validation tools can verify whether your data fulfills the constraints described by your data model, similar to how XML Schema or JSON Schema are being used. Derived from
  25. 25. Call SHACL validate from the command line
  26. 26. Deep integration with SPARQL
  27. 27. Conclusion: JSON-LD and SHACL for Knowledge Graphs • Make life easier for User Experience and Application Developers that need to work with Knowledge Graphs. • JSON-LD hides complexity of semantics and graphs • SHACL easy way to validate new data.
  28. 28. Thank you