You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
webanno: if the predicate is an iri and the value looks like an IRI where the base url corresponds to one of the extra contexts, then strip this prefix and reduce the IRI value to an alias
// If the predicate is an IRI and the value *(looks like* an IRI, then the latter will be interpreted as an IRI rather than a string literal
458
-
// (This is not formally defined in the spec! the predicate check is needed because we don't want this behaviour if the predicate is an alias defined in the JSON-LD context)
// if the predicate is an iri and the value looks like an IRI where the base url correspondonds to one of the added contexts, then strip this prefix and reduce the IRI value to an alias
459
+
s
460
+
}else{
461
+
// Else: If the predicate is an IRI and the value *(looks like* an IRI, then the latter will be interpreted as an IRI rather than a string literal
462
+
// (This is not formally defined in the spec! the predicate check is needed because we don't want this behaviour if the predicate is an alias defined in the JSON-LD context)
/// if the predicate is an iri and the value looks like an IRI where the base url correspondonds to one of the added contexts, then strip this prefix and reduce the IRI value to an alias
480
+
/// Returns None if this is not the case
481
+
fnvalue_to_alias(
482
+
predicate:&str,
483
+
datavalue:&DataValue,
484
+
config:&WebAnnoConfig,
485
+
) -> Option<String>{
486
+
if !config.extra_context.is_empty(){
487
+
ifletDataValue::String(datavalue) = datavalue {
488
+
for prefix in config.extra_context.iter(){
489
+
if datavalue.starts_with(&format!("{}/", prefix.as_str()))
let value_is_iri = ifletDataValue::String(s) = datavalue {
475
506
is_iri(s)
476
507
}else{
477
508
false
478
509
};
479
510
ifis_iri(predicate) && value_is_iri {
480
-
// If the predicate is an IRI and the value *(looks like* an IRI, then the latter will be interpreted as an IRI rather than a string literal
481
-
// (This is not formally defined in the spec! the predicate check is needed because we don't want this behaviour if the predicate is an alias defined in the JSON-LD context)
// if the predicate is an iri and the value looks like an IRI where the base url correspondonds to one of the added contexts, then strip this prefix and reduce the IRI value to an alias
513
+
s
514
+
}else{
515
+
// If the predicate is an IRI and the value *(looks like* an IRI, then the latter will be interpreted as an IRI rather than a string literal
516
+
// (This is not formally defined in the spec! the predicate check is needed because we don't want this behaviour if the predicate is an alias defined in the JSON-LD context)
0 commit comments