module RDF::AllegroGraph::Parser
A module containg the URL parser of AllegroGraph
objects such as :
-
servers
-
catalogs
-
repositories
Public Class Methods
parse_uri(url)
click to toggle source
Parse a full URI and extract the server/catalog and the repository ID.
The parsing uses the default AllegroGraph
URI schema : server:port/catalogs/catalog_name/repositories/repository_name This function can be overwritten to parse a custom URI schema system.
@param [String] uri the uri the parse @return [Array]
# File lib/rdf/allegro_graph/parser.rb, line 16 def parse_uri(url) hash = {} url = URI.parse(url) path = Pathname.new(url.path) hash[:id] = path.basename.to_s path = path.parent.parent url.path = path.to_s if path.parent.basename.to_s == 'catalogs' hash[:catalog] = Catalog.new(url.to_s) else hash[:server] = Server.new(url.to_s) end hash end
Private Instance Methods
parse_uri(url)
click to toggle source
Parse a full URI and extract the server/catalog and the repository ID.
The parsing uses the default AllegroGraph
URI schema : server:port/catalogs/catalog_name/repositories/repository_name This function can be overwritten to parse a custom URI schema system.
@param [String] uri the uri the parse @return [Array]
# File lib/rdf/allegro_graph/parser.rb, line 16 def parse_uri(url) hash = {} url = URI.parse(url) path = Pathname.new(url.path) hash[:id] = path.basename.to_s path = path.parent.parent url.path = path.to_s if path.parent.basename.to_s == 'catalogs' hash[:catalog] = Catalog.new(url.to_s) else hash[:server] = Server.new(url.to_s) end hash end