test_graph v0.1.0 NeoSemantics.Extension

Module providing simple wrapper functions for the neosemantics library extension functions.

TODO - format support

Link to this section Summary

Functions

Produces an RDF serialization of the nodes and relationships returned by the query

Produces an RDF serialization of the nodes and relationships returned by the query

Exports from Neo4j an LPG graph transformed into an RDF graph. The graph is centered on a node identified by node_id

Exports from Neo4j an LPG graph transformed into an RDF graph. The graph is centered on a node identified by node_uri

Pings the Neo4j service

Link to this section Functions

Link to this function

cypher(cypher, show_only_mapped \\ false)

Produces an RDF serialization of the nodes and relationships returned by the query.

Currently only RDF Turtle is supported. Also have a problem with supporting the showOnlyMapped parameter.

Examples

iex> cypher = TestGraph.LPG.read_query("node1.cypher").data
"match (n) return n limit 1\n"
iex> IO.puts (cypher |> NeoSemantics.Extension.cypher)
@prefix neovoc: <neo4j://defaultvocabulary#> .
@prefix neoind: <neo4j://indiv#> .


neoind:919 a neovoc:Resource;
  neovoc:rdfs__label "Hello World";
  neovoc:uri "http://dbpedia.org/resource/Hello_World" .

:ok
Link to this function

cypher_on_rdf(cypher)

Produces an RDF serialization of the nodes and relationships returned by the query.

Currently only RDF Turtle is supported.

Examples

iex> cypher = TestGraph.LPG.read_query("nodes.cypher").data
"match (n) return distinct n\n"
iex> cypher |> NeoSemantics.Extension.cypher_on_rdf
Link to this function

node_by_id(node_id, exclude_context \\ false)

Exports from Neo4j an LPG graph transformed into an RDF graph. The graph is centered on a node identified by node_id.

This returns the full context unless an optional boolean arg exclude_context is passed as true which will exclude context if present.

Examples

iex> NeoSemantics.Extension.node_by_id(1783)
"@prefix neovoc: <neo4j://defaultvocabulary#> .\n@prefix neoind: <neo4j://indiv#> .\n\n\nneoind:1783 a neovoc:Resource;\n  neovoc:ns0__creator neoind:1785;\n  neovoc:ns0__homepage neoind:1784;\n  neovoc:ns0__license neoind:1786;\n  neovoc:ns0__name "Elixir";

neovoc:uri "http://example.org/Elixir" .\n"

Link to this function

node_by_uri(node_uri, exclude_context \\ false)

Exports from Neo4j an LPG graph transformed into an RDF graph. The graph is centered on a node identified by node_uri.

This returns the full context unless an optional boolean arg exclude_context is passed as true which will exclude context if present.

Examples

iex> NeoSemantics.Extension.node_by_uri("http://example.org/Elixir")
"@prefix neovoc: <neo4j://vocabulary#> .\n\n\n<http://example.org/Elixir> <http://example.org/creator> <http://dbpedia.org/resource/José_Valim>;\n  <http://example.org/homepage> <http://elixir-lang.org>;\n  <http://example.org/license> <http://dbpedia.org/resource/Apache_License>;\n  <http://example.org/name> "Elixir" .\n"

Pings the Neo4j service.

This returns a JSON confirmation that the service is up.

Examples

iex> NeoSemantics.Extension.ping
{"ping":"here!"}
:ok