Cross Reference: hets.rb
xref
: /
ontohub
/
lib
/
hets.rb
Home
History
Annotate
Line#
Navigate
Download
Search
only in
./
require
'date'
module
Hets
include
Errors
def
self.minimal
_version_string
"v#{minimum_version}, #{minimum_revision}"
end
def
self.minimum
_revision
Settings.hets.version
_minimum_revision
end
def
self.minimum
_version
Settings.hets.version
_minimum_version
end
def
self.qualified
_loc_id_for
(
resource
)
locid
=
URI.escape
(
resource.versioned
_locid
)
"#{
Hostname.url
_authority}#{locid}"
end
def
self.parse
_via_api
(
resource
,
hets_options
,
structure_only
:
false
)
mode
=
structure_only
? :
fast_run
: :
default
HetsInstance.with
_instance
!
do
|
hets_instance
|
parse_caller
=
Hets
::
ParseCaller.new
(
hets_instance
,
hets_options
)
parse_caller.call
(
qualified_loc_id_for
(
resource
)
,
with_mode
:
mode
)
end
end
def
self.prove
_via_api
(
resource
,
prove_options
)
HetsInstance.with
_instance
!
do
|
hets_instance
|
prove_caller
=
Hets
::
ProveCaller.new
(
hets_instance
,
prove_options
)
prove_caller.call
(
qualified_loc_id_for
(
resource
)
)
end
end
def
self.provers
_via_api
(
resource
,
provers_options
)
HetsInstance.with
_instance
!
do
|
hets_instance
|
provers_caller
=
Hets
::
ProversCaller.new
(
hets_instance
,
provers_options
)
provers_caller.call
(
qualified_loc_id_for
(
resource
)
)
end
end
def
self.filetype
(
resource
)
iri
=
qualified_loc_id_for
(
resource
)
HetsInstance.with
_instance
!
do
|
hets_instance
|
filetype_caller
=
Hets
::
FiletypeCaller.new
(
hets_instance
)
response_iri
,
filetype
=
filetype_caller.call
(
iri
)
.
split
(
': '
)
end
if
response_iri
==
iri
Mime
::
Type.lookup
(
filetype
)
else
raise
FiletypeNotDeterminedError.new
(
"#{response_iri}: #{filetype}"
)
end
end
end