Building a Knowledge Graph from Open Data

Building a Knowledge Graph from Open Data

A knowledge graph is a graph of entities, their types and their relationships, organised around a documented vocabulary and maintained as a queryable dataset. It differs from a collection of RDF triples in three respects: entities have stable identifiers, the vocabulary is documented, and the graph is maintained over time. Open data adds a fourth condition: the sources are published under licences that permit reuse, which makes the graph publishable in turn, subject to attribution and share-alike terms.

Building such a graph from open data is not a format conversion. A CSV file and a GeoJSON file can be converted to RDF mechanically, but the result is usually a set of tables in triples, not a graph that answers questions across sources. The work is in modelling, identity and reconciliation.

From open data to a knowledge graph

Open data portals publish files: CSV, JSON, XML, GeoJSON, shapefiles, spreadsheets and PDFs. Each file is designed for a publisher's process, not for integration. Column names differ between releases, codes are undocumented, units are implicit, and the same entity appears under different keys in different files. A knowledge graph imposes a single entity model on this material and keeps links back to the source records.

The first design decision is the set of questions the graph must answer. These are usually called competency questions. A question such as "which bus stops lie in each district, and what population does each route serve?" determines which entities, relationships and identifiers are needed. Without such questions, the graph tends to model everything and answer nothing.

A pipeline for knowledge graph construction

  1. Scope and questions. Write the competency questions and the expected result shape. Decide which sources are in scope and which are out of scope for the first release.
  2. Source inventory and licence review. Record the publisher, version, update cadence, attribution requirements and any restrictions on personal data or derived works.
  3. Profiling. Examine keys, missing values, code lists, units, date formats and coordinate reference systems. A column called year may contain a fiscal year, a calendar year or a string.
  4. Vocabulary design. Reuse existing terms where they fit and define local terms only where they do not. Document the meaning, domain and range of each term.
  5. Mapping. Transform rows into triples, either with a direct mapping from a relational schema or with an explicit mapping language. Mint IRIs from stable source keys, not from labels.
  6. Entity resolution. Find duplicates within a source and matches across sources. Use blocking keys, similarity measures and manual review; record the method and confidence for each link.
  7. Fusion. Choose values when sources disagree, record provenance for the chosen value, and keep conflicting statements when the conflict is informative rather than an error.
  8. Validation. Parse the output, test constraints, sample the links and compare aggregate counts with the sources. Treat validation as a release gate, not a final inspection.
  9. Publication and maintenance. Expose dereferenceable IRIs, a dump, an endpoint and dataset metadata. Schedule refresh, change detection and deprecation.

A worked example: a city transport graph

A city publishes three files. stops.csv contains stop_id, name, latitude, longitude and route codes. districts.geojson contains district_code, name and polygon geometry. population.csv contains district_code, year and population. The graph needs bus stops, districts, routes and population observations, linked so that a query can aggregate stops by district and population by district.

stop_id to ex:stop/{id}
Stable source key, not the stop name.
latitude and longitude to geo:lat and geo:long
WGS84, typed as xsd:decimal.
district_code to ex:district/{code}
Authoritative where present.
population and year to ex:population and ex:asOf
An observation, not a fixed property.

Each stop receives an IRI derived from the publisher's key. Coordinates become typed literals with a declared reference system. If the stop file has a district code, that code is used. A spatial containment test is a fallback, because a stop on a boundary can fall into either polygon depending on the geometry engine, and a derived district should be marked as derived.

Population is modelled as an observation rather than as a property of the district. A district has a population value for a year, from a source. This allows several years and several sources to coexist. A fuller model uses an observation resource with a value, a time and a provenance record; the simpler form is adequate when only one source and one year are in scope.

Entity resolution is the hardest stage. Stop names repeat across operators, and a name is not an identifier. Matching uses proximity, route overlap and the national stop registry where one exists. A confident match can be asserted with owl:sameAs when the external resource is the same entity; a concept-level equivalence uses skos:exactMatch. A probable match should be recorded as a local link with a confidence value and kept out of identity reasoning.

Failure modes

  • Identifier churn. Source keys are reused or reassigned. Version the IRIs and keep the previous identifiers as owl:sameAs or redirects.
  • Unit and coordinate errors. Metres mixed with feet, or WGS84 mixed with a local grid. Declare units and reference systems in the data, not only in a README.
  • Over-linking. owl:sameAs to an ambiguous external entity merges unrelated statements. Require evidence and prefer a weaker match predicate where identity is uncertain.
  • Blank nodes as public identifiers. A blank node cannot be referenced from outside the graph, so it cannot serve as an entity identifier for consumers.
  • Licence laundering. Derived data inherits attribution and share-alike requirements. Record the licence per source and check compatibility before publication.
  • Stale graph. One-off publication decays. Schedule refresh, detect source schema changes and publish a changelog.
  • Aggregation traps. Summing populations across overlapping districts double-counts. Aggregate over distinct entities and state the spatial assumptions.

What makes it a knowledge graph

A graph becomes a knowledge graph when it has an explicit vocabulary, stable entity identifiers, links that carry meaning, provenance for statements and a maintenance process. RDF is a convenient encoding for these properties, but it is not sufficient on its own. A triple store filled with untyped strings and duplicate entities is a data dump with a graph syntax.

The test is a query that crosses sources. If the graph can answer "which districts are served by route 12, and how has their population changed since 2010?" without a manual join in a spreadsheet, the modelling and reconciliation work has succeeded. If it cannot, the missing piece is usually identity rather than syntax.

The construction steps above connect to the rest of the stack. Linked data supplies the publication principles, RDF and SPARQL supply the data model and query language, and ontology design supplies the vocabulary. Tools such as Silk and D2R Server automate link discovery and relational mapping, but they do not make the modelling decisions.


Testimonials

Dr. Mateja Verlič (Zemanta d.o.o., R&D)

We read a lot about people doing important things, however this time we – LOD2 partners – are the ones changing the history of Web by revolutionizing information use and reuse, contributing to semantic data standards and pushing the limits of almost every WWW-related aspect (sc… read

Dr. Jens Lehmann (Universität Leipzig, Research Group Leader)

The size and number of Semantic Web knowledge bases published as Linked Open Data has been growing tremendously over the past years. The LOD2 project will be a key factor for sustaining this momentum. More importantly, the quality of knowledge bases and the scalability of methods accessing… read

Jindřich Mynarz (University of Economics, Czech Republic)

Apart from being legally open, linked open data is an open technology. Due to its non-exclusive, non-proprietary, well-formalized, and standards-based nature, linked open data supports a wide spectrum of uses. It does not exclude any application from using it and thus it is open to be mixe… read

Dr. Mladen Stanojevic (Institute Mihajlo Pupin, Serbia)

The richness of any semantic model and the usability of represented data is dependent on the links between them. LOD2 is an important step in this direction that will enable an efficient exploration and processing of vast quantity of open data on the Web.

read

Mun Yong Yi (Korea Advanced Institute of Science and Technology (KAIST))

Data becomes more meaningful and powerful as they are linked and integrated. As I learn more about what LOD can do, I am convinced that it will not only change the future of the Internet but also the quality of human life. I am glad that I am participating in this project, which will defin… read

Orri Erling (OpenLink Software, Virtuoso Program Manager)

Value from information increasingly depends on integration. RDF is a great model for this. LOD2 will make RDF a cost competitive alternative in the database space, without compromising ad hoc flexibility and expressive power. read

Vojtech Svatek (University of Economics, Czech Republic)

As researcher in ontological engineering, I am excited to see LOD2 provide tools that make the generation of semantically structured data easy and thus widespread. I believe that ontological research is deemed to build upon the world views already expressed by means of simpl… read

Andreas Blumauer (Semantic Web Company, CEO)

15 years ago we all were excited when we published HTML for the first time and it didn't take a long time until all of us were "on the internet". Now we are starting to publish data on the web. Based on semantic web technologies professional data management will be possible in distributed … read

Kingsley Idehen (OpenLink Software, CEO)

Three years ago, OpenLink Software enthusiastically contributed the prowess of Virtuoso to the grassroots effort that lead to DBpedia and the Linked Open Data cloud that coalesced around it. Today, we are both honored and enthusiastic about Virtuoso's critical infrastructure role in this n… read

Bastiaan Deblieck (TenForce, Partner and Business Development Manager)

An internet of data opens up tremendous opportunities for our corporate and government customers. We intend to be on the forefront of this evolution. read

Christian Dirschl (Wolters Kluwer, Content Architect)

Linked (Open) Data will change the existing publishing paradigms! Creating high quality content for professional usage will remain an important factor in future publishing, but additional access points and new usage environments will equally define its success. read

Dr. Giovanni Tummarello (National University of Ireland, Galway, Research Unit Leader)

Semantic Markups on the Web could drive information reuse to enable scenarios and applications which we can now only dream of. The idea is extraordinarely compelling, but we know now it won't simply realize itself. The LOD2 project is now a great opportunity for inspired and coordinated re… read

Gregory Grefenstette (Exalead, Chief Science Officer)

Enterpise search is all about providing correct, complete, and appropriate information to the employee and decision maker. LOD2 promises to not only allow internal company information to be linked up to the growing amount of Open Data on the web, but to also provide the mechanisms for val… read

Hugh Williams (OpenLink Software)

It is exciting to see the LOD2 project finally kick off in its quest to take the Linked Open Data cloud to the next level of scalability, performance and integration for the exploitation of the Web as a viable platform for enterprise level data and information integration. read

Martin Kaltenböck (Semantic Web Company, CFO)

Linked (Open) Data technologies offer a new way of data integration for the enterprise! Smooth interoperability between internal data sets can reduce costs as well as the enrichment of these data sets by external data can support new market intelligence paradigms for a better decision making. read

Dr. Peter Boncz (Centrum Wiskunde & Informatica)

The publishing of ever more datasets by e.g. governments adds value for many key applications including business intelligence, which will drive the Linked Open Data (LOD) paradigm going forward. In the LOD2 project, CWI is working to increase the scalability and performance of querying int… read

Dr. Sören Auer (Universität Leipzig, LOD2 coordinator)

The Linked Data paradigm is a simple and efficient way for integration of heterogeneous information on the Web. Ultimately, we will, for example, be able to search for a new appartment and a close-by available spot in child care in one go. read

Tassilo Pellegrini (Semantic Web Company, R&D)

Semantic interoperability changes the technological and economic nature of metadata opening up exciting opportunities for value creation in various comercial and non-commercial areas. Linked Data is the blueprint for this new ecosystem and it will change the way we think about and use the web today. read

Wouter Dewanckel (TenForce, WP Project Leader)

It is an honor to take part in this challenging integration project to create solutions that can generate business value out of emerging technologies. read