function doRelacionesVDEX($tema_id = "")
{
    global $DBCFG;
    global $CFG;
    $_URI_BASE_ID = $CFG["_URI_BASE_ID"] ? $CFG["_URI_BASE_ID"] : $_SESSION["CFGURL"];
    $_URI_SEPARATOR_ID = $CFG["_URI_SEPARATOR_ID"] ? $CFG["_URI_SEPARATOR_ID"] : '?tema=';
    $sql = SQLTerminoRelacionesIDs($tema_id);
    while ($array = $sql->FetchRow()) {
        #Mantener vivo el navegador
        $time_now = time();
        if ($time_start >= $time_now + 10) {
            $time_start = $time_now;
            header('X-pmaPing: Pong');
        }
        switch ($array[t_relacion]) {
            case '2':
                //TR
                if ($array[id1] == $tema_id) {
                    $row .= '  <relationship>';
                    $row .= '      <sourceTerm>' . $_URI_BASE_ID . $_URI_SEPARATOR_ID . $array[id1] . '</sourceTerm>';
                    $row .= '      <targetTerm vocabIdentifier="' . $_URI_BASE_ID . $_URI_SEPARATOR_ID . $array[id2] . '">' . $array[t2] . '</targetTerm>';
                    $row .= '      <relationshipType source="http://www.imsglobal.org/vocabularies/iso2788_relations.xml">RT</relationshipType>';
                    $row .= '  </relationship>';
                }
                break;
            case '3':
                //TG-TE
                if ($array[id2] == $tema_id) {
                    $row .= '  <relationship>';
                    $row .= '      <sourceTerm>' . $_URI_BASE_ID . $_URI_SEPARATOR_ID . $array[id2] . '</sourceTerm>';
                    $row .= '      <targetTerm vocabIdentifier="' . $_URI_BASE_ID . $_URI_SEPARATOR_ID . $array[id1] . '">' . $array[tema1] . '</targetTerm>';
                    $row .= '      <relationshipType source="http://www.imsglobal.org/vocabularies/iso2788_relations.xml">BT</relationshipType>';
                    $row .= '  </relationship>';
                } else {
                    $row .= '  <relationship>';
                    $row .= '      <sourceTerm>' . $_URI_BASE_ID . $_URI_SEPARATOR_ID . $array[id1] . '</sourceTerm>';
                    $row .= '      <targetTerm vocabIdentifier="' . $_URI_BASE_ID . $_URI_SEPARATOR_ID . $array[id2] . '">' . $array[t2] . '</targetTerm>';
                    $row .= '      <relationshipType source="http://www.imsglobal.org/vocabularies/iso2788_relations.xml">NT</relationshipType>';
                    $row .= '  </relationship>';
                }
                break;
            case '4':
                //UP-USE
                if ($array[id2] == $tema_id) {
                    $row .= '  <relationship>';
                    $row .= '      <sourceTerm>' . $_URI_BASE_ID . $_URI_SEPARATOR_ID . $array[id2] . '</sourceTerm>';
                    $row .= '      <targetTerm vocabIdentifier="' . $_URI_BASE_ID . $_URI_SEPARATOR_ID . $array[id1] . '">' . $array[tema1] . '</targetTerm>';
                    $row .= '      <relationshipType source="http://www.imsglobal.org/vocabularies/iso2788_relations.xml">UF</relationshipType>';
                    $row .= '  </relationship>';
                } else {
                    $row .= '  <relationship>';
                    $row .= '      <sourceTerm>' . $_URI_BASE_ID . $_URI_SEPARATOR_ID . $array[id1] . '</sourceTerm>';
                    $row .= '      <targetTerm vocabIdentifier="' . $_URI_BASE_ID . $_URI_SEPARATOR_ID . $array[id2] . '">' . $array[t2] . '</targetTerm>';
                    $row .= '      <relationshipType source="http://www.imsglobal.org/vocabularies/iso2788_relations.xml">USE</relationshipType>';
                    $row .= '  </relationship>';
                }
                break;
        }
    }
    return $row;
}
예제 #2
0
function doRelacionesXTM($tema_id = "")
{
    global $DBCFG;
    global $CFG;
    $_URI_BASE_ID = $CFG["_URI_BASE_ID"] ? $CFG["_URI_BASE_ID"] : $_SESSION["CFGURL"];
    $_URI_SEPARATOR_ID = $CFG["_URI_SEPARATOR_ID"] ? $CFG["_URI_SEPARATOR_ID"] : '?tema=';
    $sql = SQLTerminoRelacionesIDs($tema_id);
    while ($array = mysqli_fetch_array($sql[datos])) {
        #Mantener vivo el navegador
        $time_now = time();
        if ($time_start >= $time_now + 10) {
            $time_start = $time_now;
            header('X-pmaPing: Pong');
        }
        switch ($array[t_relacion]) {
            case '2':
                //TR
                $row .= '  <association>';
                $row .= '    <instanceOf>';
                $row .= '      <topicRef xlink:href="#related-terms"/>';
                $row .= '    </instanceOf>';
                $row .= '    <member>';
                $row .= '      <roleSpec>';
                $row .= '  <topicRef xlink:href="#related-term"/>';
                $row .= '      </roleSpec>';
                $row .= '      <topicRef xlink:href="#' . $_URI_BASE_ID . $_URI_SEPARATOR_ID . $array[id1] . '"/>';
                $row .= '    </member>';
                $row .= '    <member>';
                $row .= '      <roleSpec>';
                $row .= '  <topicRef xlink:href="#related-term"/>';
                $row .= '      </roleSpec>';
                $row .= '      <topicRef xlink:href="#' . $_URI_BASE_ID . $_URI_SEPARATOR_ID . $array[id2] . '"/>';
                $row .= '    </member>';
                $row .= '  </association>';
                break;
            case '3':
                //TG-TE
                $row .= '  <association>';
                $row .= '    <instanceOf>';
                $row .= '      <topicRef xlink:href="#broader-narrower"/>';
                $row .= '    </instanceOf>';
                $row .= '    <member>';
                $row .= '      <roleSpec>';
                $row .= '  <topicRef xlink:href="#narrower"/>';
                $row .= '      </roleSpec>';
                $row .= '      <topicRef xlink:href="#' . $_URI_BASE_ID . $_URI_SEPARATOR_ID . $array[id2] . '"/>';
                $row .= '    </member>';
                $row .= '    <member>';
                $row .= '      <roleSpec>';
                $row .= '  <topicRef xlink:href="#broader"/>';
                $row .= '      </roleSpec>';
                $row .= '      <topicRef xlink:href="#' . $_URI_BASE_ID . $_URI_SEPARATOR_ID . $array[id1] . '"/>';
                $row .= '    </member>';
                $row .= '  </association>';
                break;
            case '4':
                //UP-USE
                $row .= '  <association>';
                $row .= '    <instanceOf>';
                $row .= '      <topicRef xlink:href="#synonym"/>';
                $row .= '    </instanceOf>';
                $row .= '    <member>';
                $row .= '      <roleSpec>';
                $row .= '  <topicRef xlink:href="#non-preferred-term"/>';
                $row .= '      </roleSpec>';
                $row .= '      <topicRef xlink:href="#' . $_URI_BASE_ID . $_URI_SEPARATOR_ID . $array[id1] . '"/>';
                $row .= '    </member>';
                $row .= '    <member>';
                $row .= '      <roleSpec>';
                $row .= '  <topicRef xlink:href="#preferred-term"/>';
                $row .= '      </roleSpec>';
                $row .= '      <topicRef xlink:href="#' . $_URI_BASE_ID . $_URI_SEPARATOR_ID . $array[id2] . '"/>';
                $row .= '    </member>';
                $row .= '  </association>';
                break;
        }
    }
    return $row;
}