Neosemantics (n10s)
Neo4j plugin for RDF and semantic web integration in ƒxyz Network
Neosemantics (n10s) is a Neo4j plugin that maps RDF (Resource Description Framework) and its vocabularies (OWL, RDFS, SKOS) into Neo4j's property graph model. It bridges W3C-standard RDF ontologies and the native graph storage used by ƒxyz Network.
Configuration
Graph config controls how URIs, labels, and multi-valued properties are stored in Neo4j. The current configuration uses:
CALL n10s.graphconfig.show()Key settings:
| Setting | Value | Meaning |
|---|---|---|
handleVocabUris | MAP | Prefix-mapped URIs stored as short names (e.g. fxyz:Member) |
handleMultival | ARRAY | Multi-valued RDF properties stored as arrays |
handleRDFTypes | LABELS_AND_NODES | RDF types become both Neo4j labels and linked nodes |
keepLangTag | false | Language tags stripped from literals |
keepCustomDataTypes | false | Custom XSD types coerced to native Neo4j types |
To initialise a fresh database with these settings:
CALL n10s.graphconfig.init({
handleVocabUris: 'MAP',
handleMultival: 'ARRAY',
handleRDFTypes: 'LABELS_AND_NODES'
})Registered Namespaces
All active namespace prefixes are stored in the _NsPrefDef node. List them with:
CALL n10s.nsprefixes.list()
YIELD prefix, namespace
RETURN prefix, namespace
ORDER BY prefixKey prefixes used in ƒxyz Network:
| Prefix | Namespace |
|---|---|
fxyz | https://fxyz.network/ontology/ |
fibo | https://spec.edmcouncil.org/fibo/ontology/ |
owl | http://www.w3.org/2002/07/owl# |
rdf | http://www.w3.org/1999/02/22-rdf-syntax-ns# |
rdfs | http://www.w3.org/2000/01/rdf-schema# |
skos | http://www.w3.org/2004/02/skos/core# |
xsd | http://www.w3.org/2001/XMLSchema# |
Add a new prefix before any import that references an unmapped namespace:
CALL n10s.nsprefixes.add('fxyz', 'https://fxyz.network/ontology/')RDF Export
Use n10s.rdf.export.cypher() to serialise a subgraph as RDF. The procedure accepts a Cypher query and a format string.
Export all Member nodes and their outgoing relationships as Turtle:
CALL n10s.rdf.export.cypher(
"MATCH (m:Member)-[r]->(t) RETURN m, r, t",
"Turtle"
)
YIELD payload
RETURN payloadExport a single concept node as JSON-LD for DKG publishing:
CALL n10s.rdf.export.cypher(
"MATCH (c:Concept {uri: 'https://fxyz.network/entity/concept/fx-spot'})
OPTIONAL MATCH (c)-[r]->(related)
RETURN c, r, related",
"JSON-LD"
)
YIELD payload
RETURN payloadThe payload field contains the serialised RDF string. Supported format strings: "Turtle", "N-Triples", "JSON-LD", "RDF/XML", "TriG".
RDF Import
Use n10s.rdf.import.fetch() to pull an RDF document from a URL directly into the graph. This is the standard path for FIBO ontology updates.
Import a FIBO module (Turtle format):
CALL n10s.rdf.import.fetch(
'https://spec.edmcouncil.org/fibo/ontology/FBC/ProductsAndServices/FinancialProductsAndServices/',
'Turtle',
{ commitSize: 5000, verifyUriSyntax: false }
)
YIELD terminationStatus, triplesLoaded, triplesParsed, namespaces, extraInfo
RETURN terminationStatus, triplesLoaded, triplesParsedFor inline RDF strings, use n10s.rdf.import.inline():
CALL n10s.rdf.import.inline(
'@prefix fxyz: <https://fxyz.network/ontology/> .
fxyz:spot-market a fxyz:MarketSegment ;
rdfs:label "Spot Market" .',
'Turtle'
)
YIELD terminationStatus, triplesLoaded
RETURN terminationStatus, triplesLoadedAfter import, verify the loaded triples with:
MATCH (n:_NsPrefDef) RETURN nSupported Formats
| Format | String | Notes |
|---|---|---|
| Turtle | "Turtle" | Preferred for human-readable ontology files |
| N-Triples | "N-Triples" | Line-by-line, streaming-friendly |
| JSON-LD | "JSON-LD" | Used for DKG publishing and API responses |
| RDF/XML | "RDF/XML" | Required for some FIBO modules |
| TriG | "TriG" | Named graphs, used for assertion partitioning |
N-Quads is NOT supported by the n10s version deployed in ƒxyz Network. Use TriG for named-graph scenarios instead.
URI Scheme
All ƒxyz entities have resolvable URIs following a consistent pattern:
| Entity type | URI pattern | Example |
|---|---|---|
| Member | https://fxyz.network/entity/member/{did} | .../member/did:privy:cmeh4kr8 |
| Concept | https://fxyz.network/entity/concept/{slug} | .../concept/fx-spot |
| Paper | https://fxyz.network/entity/paper/{id} | .../paper/arxiv-2301.00001 |
| Circle | https://fxyz.network/entity/circle/{id} | .../circle/trading-ops |
| Ontology class | https://fxyz.network/ontology/{Class} | .../ontology/Member |
| Ontology property | https://fxyz.network/ontology/{prop} | .../ontology/memberLevel |
The entity/ path is for data instances; the ontology/ path is for schema definitions. Both are registered in the n10s namespace registry under the fxyz prefix.
For more details, see the neosemantics documentation.