コード例 #1
0
function create_clusters_rdf($req)
{
    global $CONFIG;
    set_time_limit(0);
    //this avoids timeouts
    require_once $CONFIG->path . "mod/profile_manager/views/default/profile_manager/members/config.php";
    require_once $CONFIG->path . "mod/profile_manager/views/default/profile_manager/members/classes.php";
    $outputfile = $CONFIG->path . "mod/profile_manager/views/default/profile_manager/members/output.log";
    file_put_contents($outputfile, "Starting creating RDF files for clusters...\n", FILE_APPEND);
    $clusters_metadata = unserialize(file_get_contents($IOdir . "clusters_metadata"));
    $clusters_uses = unserialize(file_get_contents($IOdir . "clusters_uses"));
    $clusters_tags = unserialize(file_get_contents($IOdir . "clusters_tags"));
    $clusters_replinks = unserialize(file_get_contents($IOdir . "clusters_replinks"));
    create_cluster_rdf($clusters_metadata);
    file_put_contents($outputfile, "RDF for METADATA clusters created...\n", FILE_APPEND);
    create_cluster_rdf($clusters_uses);
    file_put_contents($outputfile, "RDF for USES clusters created...\n", FILE_APPEND);
    create_cluster_rdf($clusters_tags);
    file_put_contents($outputfile, "RDF for TAGS clusters created...\n", FILE_APPEND);
    create_cluster_rdf($clusters_replinks);
    file_put_contents($outputfile, "RDF for REPLINKS clusters created...\n", FILE_APPEND);
    file_put_contents($outputfile, "RDF files created for all clusters...\n\n", FILE_APPEND);
    return "OK";
}
コード例 #2
0
                //Qua devi mettere l'uri delle risorse associate
                file_put_contents($file, "aaaaa---" . $resource["inherence"] . "----aaaaaa" . "\n", FILE_APPEND);
            } else {
                file_put_contents($file, " <mcc:containsResource rdf:resource=\"" . $resource . "\"/>" . "\n", FILE_APPEND);
                //Qua devi mettere l'uri delle risorse associate
                file_put_contents($file, "aaaaa---" . "0" . "----aaaaaa" . "\n", FILE_APPEND);
                //in this case we put 0
            }
        }
        file_put_contents($file, "</mcc:Cluster>", FILE_APPEND);
        //now write all the associated clusters (when you will get rid of the clusters files and you use only the RDF also for clusters, you will have to change my code in the web interface to see the type of the associated cluster (now no need because I specify it in the cluster)
    }
    if (PHP_OS == "Linux" && getmyuid() == fileowner($file)) {
        chmod($file, 0666);
    }
    //set rw permissions for everybody for this file
    //Now you have all the data in a file
    //Next step is to put it in the SESAME RDF
    $post_data = file_get_contents($file);
    //get data from the file
    //include_once("/var/www/elgg/engine/start.php");  //include the Elgg system, adjust the path, uncomment to use the function connectToSesame below
    //need to have and execute a function to delete all the clusters present on the SESAME repository, because they can't be updated, ask Stefan and Davide Taibi
    //the function to write on the SESAME RDF is similar to this (used for the resources, I don't know if it will work also for clusters)
    //uncomment it only when you are sure of what you are doing, otherwise you could cause damage to the SESAME RDF
    //$uuid=connectToSesame($CONFIG->API_URL,$post_data,"");
}
//main that takes the input parameter, retrieves data and calls the function
$file = $argv[1];
$array_clusters = unserialize(file_get_contents($file));
create_cluster_rdf($array_clusters);