test_graph v0.1.0 TestGraph.Graph

Module providing a struct for graphs.

The %TestGraph.Graph{} struct is used to keep some related data fields together. One of the fields :type tracks whether this is a property graph (:lpg) or a semantic graph (:rdf). The other fields are straightforward data access fields:

  • :datagraph_data
  • :file – name of graph_file (within the graphs_dir)
  • :path – absolute path of graph_file
  • :uri – absolute URI of graph_file

Examples

iex> data |> TestGraph.Graph.new("temp.ttl", :rdf)
%TestGraph.Graph{
  data: "<GRAPH_DATA>"
  file: "temp.ttl",
  path:  ".../test_graph/priv/rdf/graphs/temp.ttl",
  type: :rdf,
  uri: "file:///.../test_graph/priv/rdf/graphs/temp.ttl"
}

Link to this section Summary

Functions

Creates a %TestGraph.Graph{} struct

Link to this section Functions

Link to this function

new(graph_data, graph_file, graph_type)

Creates a %TestGraph.Graph{} struct.

Examples

iex> data |> TestGraph.Graph.new("books.ttl", :rdf)
%TestGraph.Graph{
  data: "@prefix bibo: <http://purl.org/ontology/bibo/> \n..."
  file: "books.ttl",
  path:  ".../test_graph/priv/rdf/graphs/books.ttl",
  type: :rdf,
  uri: "file:///.../test_graph/priv/rdf/graphs/books.ttl"
}