Class: Cerberus::Annotations::Annotation

Inherits:
Object
  • Object
show all
Defined in:
app/models/cerberus/annotations/annotation.rb

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(graph) ⇒ Annotation

Returns a new instance of Annotation.



12
13
14
# File 'app/models/cerberus/annotations/annotation.rb', line 12

def initialize graph
  @graph = graph
end

Instance Attribute Details

#graphObject (readonly)

Returns the value of attribute graph.



10
11
12
# File 'app/models/cerberus/annotations/annotation.rb', line 10

def graph
  @graph
end

Class Method Details

.from_json(json) ⇒ Object



4
5
6
7
# File 'app/models/cerberus/annotations/annotation.rb', line 4

def from_json json
  graph = RDF::Graph.new << JSON::LD::API.toRdf(JSON.parse(json))
  self.new graph
end