Rename to_term to to_neutral
Change-Id: Iba397c8c771adc82498ecf750f1250144810351f
diff --git a/lib/Krawfish/Koral/Compile/Enrich/Snippet/Context/Span.pm b/lib/Krawfish/Koral/Compile/Enrich/Snippet/Context/Span.pm
index c5a3b70..f9f9e6b 100644
--- a/lib/Krawfish/Koral/Compile/Enrich/Snippet/Context/Span.pm
+++ b/lib/Krawfish/Koral/Compile/Enrich/Snippet/Context/Span.pm
@@ -55,10 +55,10 @@
my $term = $self->{term};
- $self->{anno_id} = $dict->term_id_by_term($term->to_term);
+ $self->{anno_id} = $dict->term_id_by_term($term->to_neutral);
if (DEBUG) {
- print_log('k_ctx_span', 'Identify annotation for ' . $term->to_term);
+ print_log('k_ctx_span', 'Identify annotation for ' . $term->to_neutral);
};
# Term not found
diff --git a/lib/Krawfish/Koral/Document/Annotation.pm b/lib/Krawfish/Koral/Document/Annotation.pm
index 6ba7290..89e5a25 100644
--- a/lib/Krawfish/Koral/Document/Annotation.pm
+++ b/lib/Krawfish/Koral/Document/Annotation.pm
@@ -69,7 +69,7 @@
my $term_id;
my $term = $self->{term};
- my $term_str = $term->to_term;
+ my $term_str = $term->to_neutral;
$term_id = $dict->term_id_by_term($term_str);
@@ -131,7 +131,7 @@
}
else {
- $str .= squote($self->{term}->to_term);
+ $str .= squote($self->{term}->to_neutral);
};
return $str . '$' . join(',', @{$self->{data}});
};
diff --git a/lib/Krawfish/Koral/Query/Term.pm b/lib/Krawfish/Koral/Query/Term.pm
index 3ca4940..c6f1646 100644
--- a/lib/Krawfish/Koral/Query/Term.pm
+++ b/lib/Krawfish/Koral/Query/Term.pm
@@ -26,7 +26,8 @@
# Field is probably useless
# TODO:
-# Rename to_term to to_neutral!
+# The regex is valid for the value in case it is given.
+# Otherwise it's valid for the key.
use constant DEBUG => 0;
@@ -311,12 +312,6 @@
sub to_neutral {
- return $_[0]->to_term;
-};
-
-
-
-sub to_term {
my $self = shift;
return if $self->is_null;
@@ -338,9 +333,9 @@
};
-sub to_term_escaped {
+sub to_neutral_escaped {
my $self = shift;
- my $term = $self->to_term;
+ my $term = $self->to_neutral;
# (?:[^:]+?\:)?
if ($term =~ m!^(.(?:[^/]+?\/)?(?:[^=]+?)\=)(.+?)$!) {
return quotemeta($1). $2;
@@ -363,7 +358,7 @@
# Term is no regular expression
unless ($self->is_regex) {
- my $term = $self->to_term;
+ my $term = $self->to_neutral;
print_log('kq_term', "Translate term $term to term_id") if DEBUG;
@@ -375,7 +370,7 @@
};
# Get terms
- my $term = $self->to_term_escaped;
+ my $term = $self->to_neutral_escaped;
print_log('kq_term', 'Inflate /^' . $term . '$/') if DEBUG;
diff --git a/lib/Krawfish/Koral/Query/Token.pm b/lib/Krawfish/Koral/Query/Token.pm
index acaa2ec..7bb8e1d 100644
--- a/lib/Krawfish/Koral/Query/Token.pm
+++ b/lib/Krawfish/Koral/Query/Token.pm
@@ -228,6 +228,7 @@
}
};
+
# Return Koral fragment
sub to_koral_fragment {
my $self = shift;