$isOUR = "dlib"; } elseif (strpos($url, "rivista-statistica.unibo.it") !== false) { $isOUR = "RS"; } elseif (strpos($url, "montesquieu.unibo.it") !== false) { $isOUR = "AM"; } elseif (strpos($url, "antropologiaeteatro.unibo.it") !== false) { $isOUR = "AT"; } try { $doc = AddIDs($doc->getElementsByTagName('html')->item(0), ""); } catch (Exception $e) { echo "Indirizzo non raggiungibile."; exit; } $ArtTitle = $doc->getElementsByTagName('title')->item(0)->nodeValue; $ArtTitle = Normalize($ArtTitle); switch ($isOUR) { case "dlib": case "dlib2": $contentTable = $doc->getElementsByTagName('table')->item(8); // Prendo la tabella di posizione 8 break; case "RS": case "AM": case "AT": $contentTable = $xpath->query("//*[@id='div1_div2_div2_div3']", $doc)->item(0); break; default: $contentTable = $xpath->query("//*[@id='div1_div2_div2_div3']", $doc)->item(0); if ($contentTable == null) { $contentTable = $doc->getElementsByTagName('body')->item(0);
function Authors($autori, $del_Len, $autStartTmp, $Exp, $item, $autStart, $audID, $uri) { foreach ($autori as $node) { if (is_array($node) && count($node) > 1) { $autStartTmp = Authors($node, 1, $autStartTmp, $Exp, $item, $autStart, $audID, $uri) + 5; continue; } if (is_array($node)) { $autStartTmp = Authors($node, 5, $autStartTmp, $Exp, $item, $autStart, $audID, $uri) + 5; continue; } $end = 0; $autStartTmp = $autStartTmp + (strlen($node) - strlen(ltrim($node))); $end = strlen($node) - strlen(rtrim($node)); $node = trim($node); $node = Normalize($node); //print $node." ".$autStart.$autStartTmp."<br>"; CreateAuthors($Exp, $item, $node, $autStart + $autStartTmp, $autStart + $autStartTmp + strlen($node), $audID, $uri); $autStartTmp = $autStartTmp + strlen($node) + $end + $del_Len; } return $autStartTmp - $del_Len; }
function CreateNewAnnotation($obj) { global $mainExp, $item, $mURL; $Exp = $mainExp; try { $mE = $obj->subject->value; if ($mE == "cited") { $Exp . "_cited" . GetCiteIndex($obj->subject->value); } else { if (strpos(substr($mE, -8), "cited") !== false) { $cit = substr($mE, strrpos($mE, "_")); $Exp .= "_" . $cit; } } } catch (Exception $ex) { } switch ($obj->predicate->value) { case "http://purl.org/dc/terms/title": CreateTitle($Exp, $item, Normalize(html_entity_decode($obj->object->value)), $obj->start->value, $obj->end->value, $obj->id->value, $mURL, Normalize(html_entity_decode($obj->bLabel->value))); break; case "http://purl.org/dc/terms/creator": print CreateAuthors($Exp, $item, Normalize(html_entity_decode($obj->key->value)), $obj->start->value, $obj->end->value, $obj->id->value, $mURL, Normalize(html_entity_decode($obj->bLabel->value))); break; case "http://prismstandard.org/namespaces/basic/2.0/doi": CreateDoi($Exp, $item, Normalize(html_entity_decode($obj->object->value)), $obj->start->value, $obj->end->value, $obj->id->value, $mURL, Normalize(html_entity_decode($obj->bLabel->value))); break; case "http://purl.org/spar/fabio/hasPublicationYear": CreatePublicationYear($Exp, $item, Normalize(html_entity_decode($obj->object->value)), $obj->start->value, $obj->end->value, $obj->id->value, $mURL, Normalize(html_entity_decode($obj->bLabel->value))); break; case "http://purl.org/spar/fabio/hasURL": CreateUrl($Exp, $item, Normalize(html_entity_decode($obj->object->value)), $obj->start->value, $obj->end->value, $obj->id->value, $mURL, Normalize(html_entity_decode($obj->bLabel->value))); break; case "http://purl.org/spar/cito/cites": $citExpression = $Exp . "_cited" . GetCiteIndex($obj->subject->value); CreateCities("", $citExpression, $Exp, $item, Normalize(html_entity_decode($obj->key->value)), $obj->id->value, $obj->start->value, $obj->end->value, $mURL, Normalize(html_entity_decode($obj->bLabel->value))); break; case "http://schema.org/comment": CreateComment($Exp, $item, Normalize(html_entity_decode($obj->object->value)), $obj->start->value, $obj->end->value, $obj->id->value, $mURL); break; case "http://www.ontologydesignpatterns.org/cp/owl/semiotics.owl#denotes": CreateRethoric($Exp, $item, DecodeRethoric($obj->object->value), Normalize(html_entity_decode($obj->bLabel->value)), $obj->start->value, $obj->end->value, $obj->id->value, $mURL); break; } }