Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
…ary-Server

fixed definition note and exact match import, added bibliographic note import #86 by @RicPiz
  • Loading branch information
tematres committed Aug 1, 2023
2 parents 6f50df4 + 76cd1a7 commit ecea5ff
Showing 1 changed file with 25 additions and 14 deletions.
39 changes: 25 additions & 14 deletions common/include/inc.importSkos.php
Original file line number Diff line number Diff line change
Expand Up @@ -117,11 +117,24 @@ function addSkosTerm($skos, $node)

$lang_nota=($value["lang"]) ? $value["lang"] : $node_stringPreferedTermLang;

ALTAnota($term_id, "NA", $lang_nota, $value["value"]);
ALTAnota($term_id, "DF", $lang_nota, $value["value"]);
}
}


// Bibliographic notes
foreach ($skos->xpath->query('./skos:note', $node) as $defNote) {
$value = setI18nValue($skos, $defNote);

if (isset($value["value"])) {
$node_defnotes[] = $value;

$lang_nota=($value["lang"]) ? normalizeLangCode($value["lang"]): $node_stringPreferedTermLang;

ALTAnota($term_id, "NB", $lang_nota, $value["value"]);
}
}

// exampleNote
foreach ($skos->xpath->query('./skos:example', $node) as $defNote) {
$value = setI18nValue($skos, $defNote);
Expand All @@ -148,19 +161,17 @@ function addSkosTerm($skos, $node)
}
}



//~ // exactMatch
$sqlMatchTypes=SQLfetchValue('URI_TYPE');
while ($arrayMatchTypes=$sqlMatchTypes->FetchRow()) {
foreach ($skos->xpath->query("./skos:$arrayMatchTypes[value]", $node) as $matchNode) {
// find URI
$uri_match = $matchNode->getAttributeNodeNS('http://www.w3.org/1999/02/22-rdf-syntax-ns#', 'resource');
if ($uri_match instanceof DOMAttr) {
abmURI("A", $term_id, array("uri"=>$uri_match->nodeValue,"uri_type_id"=>$arrayMatchTypes["value_id"]));
};
}
}
// exactMatch
$sqlMatchTypes=SQLfetchValue('URI_TYPE');
while ($arrayMatchTypes=$sqlMatchTypes->FetchRow()) {
foreach ($skos->xpath->query("./skos:$arrayMatchTypes[value]/skos:Concept", $node) as $matchNode) {
// find URI
$uri_match = $matchNode->getAttributeNS('http://www.w3.org/1999/02/22-rdf-syntax-ns#', 'about');
if ($uri_match) {
abmURI("A", $term_id, array("uri"=>$uri_match,"uri_type_id"=>$arrayMatchTypes["value_id"]));
};
}
}

// Find and add narrow terms
// TODO: Merge broader/narrower relations for this term, as defining
Expand Down

0 comments on commit ecea5ff

Please sign in to comment.