Neosemantics, also called n10s, is a Neo4j plugin for working with RDF.
It connects standards-based semantic data with the Neo4j property graph
and Cypher query model.
This overview follows the lifecycle of semantic data through Neo4j:
configuration, import, graph use, validation, reasoning, and export.
RDF and the property graph model emphasize different strengths.
RDF provides stable identifiers, shared vocabularies, and a standard
exchange model. Neo4j provides a direct graph model and Cypher.
The practical challenge is moving between them while retaining the
semantic details that make the data understandable and reusable.
Neosemantics sits at the boundary between the RDF ecosystem and Neo4j.
It handles RDF parsing and graph representation on the way in, then can
generate RDF again on the way out.
The round-trip guarantee depends on preserving the semantic identifiers
needed to reconstruct the original triples. Configuration therefore comes
before import, not after it.
The graph configuration defines the translation between the RDF model
and the property graph model. It affects names, values, types, and the
ability to export the graph as RDF later.
Neosemantics also requires a uniqueness constraint on Resource URI values.
The configuration should be treated as an architectural decision because
changing it after data has been loaded requires clearing the imported graph.
This slide shows the core transformation. Literal values become node
properties. Links between resources become graph relationships. RDF types
become labels by default, and the source URI remains on the resource node.
The exact labels, relationship types, and property names depend on how
vocabulary URIs are configured.
Neosemantics can stream parsed RDF as records before anything is written.
This gives teams a chance to inspect the source and apply their own Cypher
logic when the standard import transformation is not the desired model.
Import parameters can also narrow the data by predicate or language tag.
That is useful when only part of a large semantic dataset is relevant.
The main import procedure accepts a source URL, the RDF serialization,
and optional parameters. A source can be a static file or a service that
produces RDF dynamically.
Advanced request settings support headers and POST payloads, which makes
it possible to submit a query to an RDF-producing endpoint and import the
result directly.
Ontology import gives the graph an explicit semantic model. Because RDF
resources use URIs, ontology elements and instance data can connect when
they refer to the same identifiers.
The choice between representing RDF types as labels or nodes matters here.
Type nodes make the link between instances and ontology classes explicit,
while labels provide a simpler property graph representation.
Mapping separates the external semantic contract from the internal graph
vocabulary. For example, an RDF property with a long or inconvenient name
can map to a concise property name in Neo4j.
Mappings are one-to-one and can be used during both import and export.
That keeps the transformation explicit and reversible.
RDF vocabularies describe meaning. SHACL adds machine-readable expectations
about graph structure and values.
Neosemantics can validate Neo4j graph data against SHACL shapes and return
the violations. This creates a clear quality checkpoint between ingestion
and application use.
Semantic models often contain knowledge that is implied rather than written
as a direct statement. A class hierarchy is a simple example: membership in
a specific class can imply membership in a broader class.
Neosemantics exposes reasoning functions that let queries use this ontology
structure without copying every possible implied relationship into the graph.
Export completes the interoperability story. Neosemantics can generate RDF
from a graph created through RDF import and from a native property graph.
The export can target selected nodes or Cypher results and can use model
mappings. If an imported graph discarded namespace information, an exact
round trip is no longer possible, which reinforces the importance of the
initial configuration.
Close with a small, testable adoption path. One dataset is enough to prove
the decisions that matter: graph configuration, Cypher usability, semantic
validation, reasoning value, and RDF export fidelity.
Sources used for this deck:
https://neo4j.com/labs/neosemantics/4.0/
https://neo4j.com/labs/neosemantics/4.0/introduction/
https://neo4j.com/labs/neosemantics/4.0/import/
The main deck explains the lifecycle. This appendix makes four parts of
that lifecycle concrete by showing simplified RDF inputs, Neo4j graph
representations, and validation output.
The examples follow Neosemantics 4.0 behavior. Names can vary when a graph
uses different namespace prefixes or mapping definitions.
KEEP retains the full vocabulary URI in labels, relationship types, and
property names. SHORTEN replaces namespaces with registered prefixes.
IGNORE keeps only local names. MAP applies explicit one-to-one mappings.
The example names are simplified and use an ex prefix registered for
http://example.org/vocab#.
Source: https://neo4j.com/labs/neosemantics/4.0/config/
Neosemantics keeps one literal value by default when an RDF property occurs
multiple times. ARRAY preserves every value in a Neo4j list.
RDF types become labels by default. Setting typesToLabels to false keeps the
type as a relationship between URI-identified resources. The displayed
rdf__type relationship assumes shortened namespace handling.
Source: https://neo4j.com/labs/neosemantics/4.0/import/
The ontology loader stores named classes as Class nodes with URI and name
properties. It stores rdfs:subClassOf as SCO relationships by default.
When instance data is imported with typesToLabels false, the rdf:type object
is resolved by URI. If the ontology class already has that URI, the instance
connects to the existing class node rather than creating a disconnected copy.
Sources:
https://neo4j.com/labs/neosemantics/4.0/importing-ontologies/
https://neo4j.com/labs/neosemantics/4.0/import/
This is the mapping example from the Neosemantics guide. A relationship
named CHILD_CATEGORY in Neo4j is equivalent to skos:narrower in RDF.
Mappings are one-to-one pairs of equivalent vocabulary elements. The same
definition is used on import and export, so internal Cypher conventions do
not have to become the external semantic contract.
Source: https://neo4j.com/labs/neosemantics/4.0/mapping/
This simplified shape is based on the Person example in the guide. It says
that a Person name must be a string and may appear no more than once.
The example graph violates the datatype constraint because its name value
is numeric. Neosemantics loads SHACL from a URL or inline Turtle.
Source: https://neo4j.com/labs/neosemantics/4.0/validation/
The validation report identifies the failing node, its type, the constraint
component, the offending value, the property path, and severity.
Neosemantics 4.0 supports validation of the whole graph, a selected node set,
or changes inside a transaction. The guide notes that version 4 implements a
significant portion of SHACL, but not the entire language.
Source: https://neo4j.com/labs/neosemantics/4.0/validation/