Class: Chronicle::Schema::RDFParsing::TTLGraphBuilder
- Inherits:
-
Object
- Object
- Chronicle::Schema::RDFParsing::TTLGraphBuilder
- Defined in:
- lib/chronicle/schema/rdf_parsing/ttl_graph_builder.rb
Instance Attribute Summary collapse
-
#graph ⇒ Object
readonly
Returns the value of attribute graph.
-
#ttl_graph ⇒ Object
readonly
Returns the value of attribute ttl_graph.
-
#ttl_str ⇒ Object
readonly
Returns the value of attribute ttl_str.
Class Method Summary collapse
- .build_from_file(file_path, default_namespace:) ⇒ Object
- .build_from_ttl(ttl_str, default_namespace:) ⇒ Object
Instance Method Summary collapse
- #build ⇒ Object
-
#initialize(ttl_str, default_namespace: 'https://schema.org/') ⇒ TTLGraphBuilder
constructor
A new instance of TTLGraphBuilder.
Constructor Details
#initialize(ttl_str, default_namespace: 'https://schema.org/') ⇒ TTLGraphBuilder
Returns a new instance of TTLGraphBuilder.
13 14 15 16 17 |
# File 'lib/chronicle/schema/rdf_parsing/ttl_graph_builder.rb', line 13 def initialize(ttl_str, default_namespace: 'https://schema.org/') @ttl_str = ttl_str @default_namespace = default_namespace @graph = Chronicle::Schema::SchemaGraph.new(default_namespace:) end |
Instance Attribute Details
#graph ⇒ Object (readonly)
Returns the value of attribute graph.
11 12 13 |
# File 'lib/chronicle/schema/rdf_parsing/ttl_graph_builder.rb', line 11 def graph @graph end |
#ttl_graph ⇒ Object (readonly)
Returns the value of attribute ttl_graph.
11 12 13 |
# File 'lib/chronicle/schema/rdf_parsing/ttl_graph_builder.rb', line 11 def ttl_graph @ttl_graph end |
#ttl_str ⇒ Object (readonly)
Returns the value of attribute ttl_str.
11 12 13 |
# File 'lib/chronicle/schema/rdf_parsing/ttl_graph_builder.rb', line 11 def ttl_str @ttl_str end |
Class Method Details
.build_from_file(file_path, default_namespace:) ⇒ Object
31 32 33 |
# File 'lib/chronicle/schema/rdf_parsing/ttl_graph_builder.rb', line 31 def self.build_from_file(file_path, default_namespace:) new(File.read(file_path), default_namespace:).build end |
.build_from_ttl(ttl_str, default_namespace:) ⇒ Object
35 36 37 |
# File 'lib/chronicle/schema/rdf_parsing/ttl_graph_builder.rb', line 35 def self.build_from_ttl(ttl_str, default_namespace:) new(ttl_str, default_namespace:).build end |
Instance Method Details
#build ⇒ Object
19 20 21 22 23 24 25 26 27 28 29 |
# File 'lib/chronicle/schema/rdf_parsing/ttl_graph_builder.rb', line 19 def build reader = RDF::Reader.for(:ttl).new(@ttl_str) @ttl_graph = RDF::Graph.new << reader @graph.version = get_version @graph.types = build_type_graph @graph.properties = build_property_graph # build_datatype_graph @graph.build_references! @graph end |