Import WikiData to Neo4j with Neosemantics library

Import WikiData to Neo4j with Neosemantics library

Import data from WikiData and Open Street Map API to create a knowledge graph in Neo4j. In the next parts of the series, we will take a look at the pathfinding algorithms available in the Neo4j Graph Data Science library.

After a short summer break, I have prepared a new blog series. In this first part, we will construct a knowledge graph of monuments located in Spain. As you might know, I have lately gained a lot of interest and respect for the wealth of knowledge that is available through the WikiData API. We will continue honing our SPARQL syntax knowledge and fetch the information regarding the monuments located in Spain from the WikiData API. I wasn’t aware of this before, but scraping the RDF data available online and importing it into Neo4j is such a popular topic that Dr. Jesus Barrasa developed a Neosemantics library to help us with this process.

In the next parts of the series, we will take a look at the pathfinding algorithms available in the Neo4j Graph Data Science library.

Agenda

  1. Install Neosemantics library
  2. Graph model
  3. Construct WikiData SPARQL query
  4. Import RDF Graph
  5. Reverse Geocode with OSM API
  6. Verify Data

Install Neosemantics library

In this blog series, we will use the standard APOC and GDS libraries, which we can install with a single click in the Neo4j Desktop application. On top of that, we will add the Neosemantics library to our stack. It is used to interact with RDF data in the Neo4j environment. We can either import RDF data to Neo4j or export property graph model in RDF format.

To install the Neosemantics library, we download the latest release and save it to the Neo4j plugins folder. We also need to add the following line to the Neo4j configuration file.

dbms.unmanaged_extension_classes=n10s.endpoint=/rdf

We are now ready to start our Neo4j instance. First, we need to initiate the Neosemantics configuration with the following cypher procedure.

CALL n10s.graphconfig.init({handleVocabUris: "IGNORE"})

Take a look at the documentation for information about the configuration options.

Graph model

Monuments are in the center of our graph. We have their name and the URL of the image stored as a node property. The monuments have been influenced by various architectural styles, which we indicate as a relationship to an Architecture node. We will save the city and the state of the monument as a two-level hierarchical location tree.

Image for post

Graph model created with draw.io

The Neosemantics library requires a unique constraint on the property “uri” of the nodes labeled Resource. We will also add indexes for the State and City nodes. The apoc.schema.assert procedure allows us to define many indexes and unique constraints with a single call.

CALL apoc.schema.assert(
  {State:['id'], City:['id']},
  {Resource:['uri']})

analytics spatial neo4j wikidata knowledge-graph data analytic

Bootstrap 5 Complete Course with Examples

Bootstrap 5 Tutorial - Bootstrap 5 Crash Course for Beginners

Nest.JS Tutorial for Beginners

Hello Vue 3: A First Look at Vue 3 and the Composition API

Building a simple Applications with Vue 3

Deno Crash Course: Explore Deno and Create a full REST API with Deno

How to Build a Real-time Chat App with Deno and WebSockets

Convert HTML to Markdown Online

HTML entity encoder decoder Online

Big Data Analytics: Unrefined Data to Smarter Business Insights - TopDevelopers.co

For Big Data Analytics, the challenges faced by businesses are unique and so will be the solution required to help access the full potential of Big Data.

Data Analytics For Beginners

🔥Intellipaat Data Analytics training course: https://intellipaat.com/data-analytics-master-training-course/ In this data analytics for beginners video you wi...

How to Define Data Analytics Capabilities | Hacker Noon

Disclaimer: Many points made in this post have been derived from discussions with various parties, but do not represent any individuals or organisations.

Silly mistakes that can cost ‘Big’ in Big Data Analytics

‘Data is the new science. Big Data holds the key answers’ - Pat Gelsinger The biggest advantage that the enhancement of modern technology has brought

Neo4j Graph Data Science Library – Graph Algorithms & Analytics

Enhance and accelerate data predictions with the Neo4j Graph Data Science Library, a powerful data structure for global computations with robust algorithms.