Cross Reference: owl.rb
xref
: /
ontohub
/
lib
/
parsing_callback
/
owl.rb
Home
History
Annotate
Line#
Navigate
Download
Search
only in
./
owl.rb revision e7b98e9afc1566c16deab31c630a1f272b549f1d
1516
N/A
module
ParsingCallback
::
OWL
3
N/A
3
N/A
IDENTIFIERS
= %w
(
OWL
OWL2
)
3
N/A
3
N/A
def
self.defined
_for
?
(
logic_name
)
3
N/A
IDENTIFIERS.include
?
(
logic_name
)
3
N/A
end
3
N/A
3
N/A
class
Callback
<
ParsingCallback
::
GenericCallback
3
N/A
3
N/A
def
pre_axiom
(
hash
)
3
N/A
if
is_annotation_sentence
?
(
hash
)
3
N/A
m =
hash
[
'text'
].
match
(%r
{
3
N/A
Class
:\s+
(?<
entity_name
><[^;]+>)
#
Entity
/
Symbol
Identifier
3
N/A
\s+
3
N/A
Annotations
:\s+
(?<
annotation_type
>
label
|
comment
)
# the type of annotation
3
N/A
\s+
3
N/A
"(?<annotation>.*)"
# The actual annotation
3
N/A
\s*
3
N/A
(?<
additionals
>[^\s].*)
# optional,
e.g
. a language tag like @pt}xm)
3
N/A
if
m
3
N/A
entity
=
Entity.where
(
name
: m[
'entity_name'
])
.
first
3
N/A
case
m[
'annotation_type'
]
2199
N/A
when
'label'
3
N/A
entity.label
= m[
'annotation'
]
3
N/A
when
'comment'
852
N/A
entity.comment
= m[
'annotation'
]
59
N/A
end
if
entity
59
N/A
entity.save
1698
N/A
end
3
N/A
false
30
N/A
else
175
N/A
true
30
N/A
end
30
N/A
end
30
N/A
30
N/A
def
axiom
(
hash
,
axiom
)
30
N/A
end
30
N/A
30
N/A
def
ontology_end
(
hash
,
ontology
)
30
N/A
begin
30
N/A
TarjanTree.for
(
ontology
)
30
N/A
rescue
ActiveRecord
::
RecordNotFound
=> e
30
N/A
Rails.logger.warn
"Could not create entity tree for: #{
ontology.name
} (#{
ontology.id
}) caused #{e}"
933
N/A
end
933
N/A
end
933
N/A
416
N/A
private
933
N/A
def
is_annotation_sentence
?
(
axiom_hash
)
933
N/A
axiom_hash
[
'symbol_hashes'
].
each
do
|
hash
|
3
N/A
return
true
if
hash
[
'kind'
] ==
'AnnotationProperty'
933
N/A
end
933
N/A
false
852
N/A
end
416
N/A
3
N/A
end
3
N/A
3
N/A
end
3
N/A