Generated with sparks and insights from 32 sources
Introduction
-
Install Neosemantics Plugin: Download the Neosemantics (n10s) .jar file from GitHub and place it in the plugins folder of your Neo4j installation.
-
Create Uniqueness Constraint: Ensure a uniqueness constraint on the property 'uri' of nodes with the label 'Resource' using the command: CREATE CONSTRAINT n10s_unique_uri ON (r:Resource) ASSERT r.uri IS UNIQUE;
-
Initialize Graph Config: Set up the graph configuration by calling the procedure n10s.graphconfig.init(). This can be done with default settings or customized parameters.
-
Import RDF Data: Use the n10s.rdf.import.fetch procedure to import RDF data from a URL. The command format is: CALL n10s.rdf.import.fetch(url, format, params).
-
Handle Multivalued Properties: Configure how to handle multivalued properties by setting the handleMultival parameter in the Graph Config to 'ARRAY' if needed.
-
Filter Triples: Exclude certain triples during import by specifying a list of predicates in the predicateExclusionList parameter.
-
Advanced Fetching: For dynamic RDF data, use the payload and headerParams parameters to send HTTP requests with specific headers and payloads.
Installation [1]
-
Download Neosemantics: Obtain the Neosemantics (n10s) .jar file from the official GitHub repository.
-
Place in Plugins Folder: Move the downloaded .jar file to the plugins directory of your Neo4j installation.
-
Restart Neo4j: Restart the Neo4j server to load the new plugin.
Graph Configuration [2]
-
Initialize Graph Config: Use the command CALL n10s.graphconfig.init() to set up the graph configuration with default settings.
-
Customize Config: Pass a map of parameters to n10s.graphconfig.init() to customize settings such as handleMultival and handleVocabUris.
-
Show Config: Use CALL n10s.graphconfig.show to display the current configuration settings.
-
Drop Config: Remove the current graph configuration with CALL n10s.graphconfig.drop.
Import Procedures [3]
-
Fetch RDF Data: Use the n10s.rdf.import.fetch procedure to import RDF data from a URL. Example: CALL n10s.rdf.import.fetch('file:///path/to/file.rdf', 'RDF/XML').
-
Inline RDF Data: Use n10s.rdf.import.inline to import RDF data passed as a parameter. Example: CALL n10s.rdf.import.inline(payload, 'N-Triples').
-
Supported Formats: The import procedures support various RDF serialization formats including Turtle, N-Triples, JSON-LD, RDF/XML, TriG, and N-Quads.
Handling Multivalued Properties [3]
-
Default Behavior: By default, n10s keeps only one value for multivalued properties, typically the last one read.
-
Store as Arrays: Set handleMultival to 'ARRAY' in the Graph Config to store multivalued properties as arrays.
-
Specify Properties: Use the multivalPropList parameter to specify which properties should be stored as arrays.
-
Example Command: CALL n10s.graphconfig.set({ handleMultival: 'ARRAY', multivalPropList: ['http://example.com/keyword'] }).
Filtering Triples [3]
-
Exclude Triples: Use the predicateExclusionList parameter to exclude specific triples during import.
-
Specify Predicates: Provide a list of full URIs for the predicates to be excluded.
-
Example Command: CALL n10s.rdf.import.fetch('file:///path/to/file.ttl', 'Turtle', { predicateExclusionList: ['http://example.com/version', 'http://example.com/releaseDate'] }).
Advanced Fetching [3]
-
Dynamic RDF Data: Use the payload and headerParams parameters to send HTTP requests with specific headers and payloads.
-
SPARQL Endpoints: Submit SPARQL queries to RDF-producing endpoints using the payload parameter.
-
Example Command: CALL n10s.rdf.import.fetch('https://example.com/sparql', 'Turtle', { headerParams: { Accept: 'application/turtle' }, payload: 'query=DESCRIBE http://example.com/resource' }).
Related Videos
<br><br>
<div class="-md-ext-youtube-widget"> { "title": "Neo4j and RDF; Linked Data & Ontologies [Neo4j Ninjas ...", "link": "https://www.youtube.com/watch?v=eDRfKAKZMQE", "channel": { "name": ""}, "published_date": "Sep 17, 2020", "length": "" }</div>
<div class="-md-ext-youtube-widget"> { "title": "Going Meta - Ep 17: RDF-ing between OpenAI and Neo4j", "link": "https://www.youtube.com/watch?v=w-PwMyzokSw", "channel": { "name": ""}, "published_date": "Jun 2, 2023", "length": "" }</div>
<div class="-md-ext-youtube-widget"> { "title": "Part 11: Import RDF data from Wikidata", "link": "https://www.youtube.com/watch?v=joG3zZ4vLno", "channel": { "name": ""}, "published_date": "Oct 15, 2021", "length": "" }</div>