get_source_params($source_id); if ($params["PARAMETERS"]) { $vars=unserialize($params["PARAMETERS"]); $params["PARAMETERS"]=$vars; } return $params; } function get_libelle($message) { if (substr($message,0,4)=="msg:") return $this->msg[substr($message,4)]; else return $message; } function source_get_property_form($source_id) { $params=$this->get_source_params($source_id); if ($params["PARAMETERS"]) { //Affichage du formulaire avec $params["PARAMETERS"] $vars=unserialize($params["PARAMETERS"]); foreach ($vars as $key=>$val) { global $$key; $$key=$val; } } $form="
"; return $form; } function make_serialized_source_properties($source_id) { global $sparql_endpoint_url; $t["sparql_endpoint_url"]=$sparql_endpoint_url; $this->sources[$source_id]["PARAMETERS"]=serialize($t); } //Récupération des proriétés globales par défaut du connecteur (timeout, retry, repository, parameters) function fetch_default_global_values() { $this->timeout=5; $this->repository=2; $this->retry=3; $this->ttl=1800; $this->parameters=""; } //Formulaire des propriétés générales function get_property_form() { return ""; } function make_serialized_properties() { $this->parameters = serialize(array()); } function enrichment_is_allow(){ return true; } function getEnrichmentHeader(){ global $lang; $header= array(); return $header; } function getTypeOfEnrichment($source_id){ $type['type'] = array( array( 'code' => "databnf_oeuvre", 'label' => $this->msg["databnf_oeuvre_label"] ), array( 'code' => "databnf_bio", 'label' => $this->msg["databnf_bio_label"] ) ); $type['source_id'] = $source_id; return $type; } function getEnrichment($notice_id,$source_id,$type="",$enrich_params=array()){ $enrichment= array(); $params=$this->unserialize_source_params($source_id); $sparql_end_point=$params["PARAMETERS"]["sparql_endpoint_url"]; //on renvoi ce qui est demandé... si on demande rien, on renvoi tout.. switch ($type){ case "databnf_bio" : $enrichment['databnf_bio']['content'] = $this->get_author_page($notice_id,$sparql_end_point); break; case "databnf_oeuvre" : default : $enrichment['databnf_oeuvre']['content'] = $this->noticeInfos($notice_id,$sparql_end_point); break; } $enrichment['source_label']=$this->msg['databnf_enrichment_source']; return $enrichment; } function get_author_page($notice_id,$sparql_end_point){ global $lang; global $charset; if($enrich_params['label']!=""){ $author = $enrich_params['label']; }else{ //on va chercher l'auteur principal... $query = "select responsability_author, authority_number from responsability join authorities_sources on (authority_type='author' and num_authority=responsability_author) where responsability_notice =".$notice_id." and responsability_type=0"; $result = mysql_query($query); if(mysql_num_rows($result)){ $author_id = mysql_result($result,0,0); $author_number = mysql_result($result,0,1); $author_class = new auteur($author_id); $author = $author_class->isbd_entry; //On y va ! $config = array( 'remote_store_endpoint' => $sparql_end_point, 'remote_store_timeout' => 10 ); $store = ARC2::getRemoteStore($config); //Recherche de l'URI de l'auteur ! $sparql="prefix skos: SELECT * WHERE { ?auteur rdf:type skos:Concept . FILTER regex(?auteur, \"^http://data\.bnf\.fr:8080/ark:/12148/cb".$author_number."\") . }"; $rows=$store->query($sparql,'rows'); if ($rows[0]["auteur"]) { $uri_auteur=$rows[0]["auteur"]; //Biographie... $sparql="prefix foaf: prefix dc: prefix dcterm: prefix bnf-onto: prefix rdagroup2elements: prefix skos: SELECT * WHERE { <$uri_auteur> foaf:focus ?person . <$uri_auteur> skos:prefLabel ?isbd . ?person foaf:page ?page . OPTIONAL { ?person rdagroup2elements:biographicalInformation ?biographie . } OPTIONAL { ?person rdagroup2elements:dateOfBirth ?naissance . } OPTIONAL { ?person rdagroup2elements:placeOfBirth ?lieunaissance . } OPTIONAL { ?person rdagroup2elements:dateOfDeath ?mort . } OPTIONAL { ?person rdagroup2elements:placeOfDeath ?lieumort . } }"; try { $rows=$store->query($sparql,'rows'); } catch(Exception $e) { $rows=array(); } $rows=array_uft8_decode($rows); $template="{% for record in result %}

{{record.isbd}}


Biographie (BNF)

Date de naissance{{record.naissance}}
Lieu de naissance{{record.lieunaissance}}
Date de décès{{record.mort}}
Lieu de décès{{record.lieumort}}

{{record.biographie}}


{% endfor %}"; $html_to_return = H2o::parseString($template)->render(array("result"=>$rows)); //Vignettes $sparql="prefix foaf: prefix dc: prefix dcterm: SELECT * WHERE { <$uri_auteur> foaf:focus ?person . ?person foaf:depiction ?url . } LIMIT 5"; try { $rows=$store->query($sparql,'rows'); } catch(Exception $e) { $rows=array(); } $rows=array_uft8_decode($rows); $template="

Vignettes (BnF)

{% for record in result %} {% endfor %}
"; $html_to_return .= H2o::parseString($template)->render(array("result"=>$rows)); //Bibliographie $sparql="prefix foaf: prefix dc: prefix dcterm: prefix frbr-rda: prefix rdarelationships: SELECT ?oeuvre ?oeuvre_concept ?date ?title ?url ?gallica WHERE { <$uri_auteur> foaf:focus ?person . ?oeuvre dc:creator ?person . ?oeuvre_concept foaf:focus ?oeuvre . OPTIONAL { ?oeuvre dc:date ?date } . ?oeuvre dc:title ?title . OPTIONAL { ?oeuvre foaf:depiction ?url } . OPTIONAL { ?manifestation rdarelationships:workManifested ?oeuvre . ?manifestation rdarelationships:electronicReproduction ?gallica . } . } group by ?oeuvre order by ?date"; try { $rows=$store->query($sparql,'rows'); } catch(Exception $e) { $rows=array(); } $rows=array_uft8_decode($rows); $template="

Bibliographie (BNF)

{% for record in result %} {% endfor %} {% for record in result %} {% endfor %} {% for record in result %} {% endfor %}
{% if record.date %}{{record.date}}{% else %} {% endif %}
{% if loop.odd %} {% if record.url %} {% else %}   {% endif %} {% if record.gallica %} {% endif %}
{{record.title}} {% else %} {% endif %}
{% if loop.even %}{% if record.url %} {% else %}   {% endif %} {% if record.gallica %} {% endif %}
{{record.title}}{% else %} {% endif %}
"; $html_to_return .= H2o::parseString($template)->render(array("result"=>$rows)); } } } // print $html_to_return; return $html_to_return; } function noticeInfos($notice_id,$sparql_end_point){ global $lang,$charset; //On va rechercher l'isbn si il existe.... $requete="select code from notices where notice_id=$notice_id"; $resultat=mysql_query($requete); if (mysql_num_rows($resultat)) { $isbn=mysql_result($resultat,0,0); } else $isbn=""; if ($isbn) { //On y va ! $config = array( 'remote_store_endpoint' => $sparql_end_point, 'remote_store_timeout' => 10 ); $store = ARC2::getRemoteStore($config); $sparql="prefix bnf-onto: prefix rdarelationships: SELECT ?oeuvre WHERE { ?manifestation bnf-onto:ISBN '$isbn' . ?manifestation rdarelationships:workManifested ?oeuvre }"; try { $rows=$store->query($sparql,'rows'); } catch(Exception $e) { $rows=array(); } if ($rows[0]["oeuvre"]) { $oeuvre=$rows[0]["oeuvre"]; $sparql="prefix skos: prefix foaf: prefix dc: prefix bnf-onto: prefix rdarelationships: prefix rdagroup1Elements: SELECT * WHERE { <$oeuvre> rdfs:label ?titre . OPTIONAL { <$oeuvre> dc:date ?date } . OPTIONAL { <$oeuvre> foaf:depiction ?vignette } . OPTIONAL { <$oeuvre> dc:description ?description } . OPTIONAL { <$oeuvre> bnf-onto:subject ?sujet } . OPTIONAL { <$oeuvre> dc:creator ?auteur . ?auteur_concept foaf:focus ?auteur . ?auteur_concept skos:prefLabel ?auteur_isbd . } . OPTIONAL { <$oeuvre> rdagroup1Elements:placeOfOriginOfTheWork ?lieu } }"; try { $rows=$store->query($sparql,'rows'); } catch(Exception $e) { $rows=array(); } $rows=array_uft8_decode($rows); $template="

{{result.0.titre}}


Détail de l'oeuvre (BNF)

{% if result.0.vignette %}
{% endif %}
Date{{result.0.date}}
Sujet{{result.0.sujet}}
Auteur{{result.0.auteur_isbd}}
{% if result.0.vignette %}
{% endif %}

{{result.0.description}}

"; $html_to_return .= H2o::parseString($template)->render(array("result"=>$rows)); //Récupération des exemplaires de Gallica $sparql="prefix skos: prefix foaf: prefix dc: prefix bnf-onto: prefix rdarelationships: prefix rdagroup1Elements: SELECT * WHERE { ?manifestation rdarelationships:workManifested <$oeuvre> . OPTIONAL { ?manifestation rdarelationships:electronicReproduction ?gallica } . OPTIONAL { ?manifestation bnf-onto:ISBN ?isbn } . OPTIONAL { <$oeuvre> foaf:depiction ?vignette } . OPTIONAL { ?manifestation dc:date ?date } . OPTIONAL { ?manifestation rdagroup1Elements:publishersName ?publisher } . OPTIONAL { ?manifestation rdagroup1Elements:note ?note } . OPTIONAL { ?manifestation rdagroup1Elements:placeOfPublication ?place } . OPTIONAL { ?manifestation rdagroup1Elements:dateOfCapture ?numerisele } . } group by ?manifestation order by ?date "; try { $rows=$store->query($sparql,'rows'); } catch(Exception $e) { $rows=array(); } $rows=array_uft8_decode($rows); $template="

Editions numérisées dans Gallica


{% for record in result %} {% if record.gallica %} {% endif %} {% endfor %}
Edition : {{record.date}} par {{record.publisher}} à {{record.place}} {{record.note}} {{record.numerisele}}
"; $html_to_return .= H2o::parseString($template)->render(array("result"=>$rows)); $template="

Editions dans la bibliothèque


{% for record in result %} {% if record.isbn %} {% sqlvalue i_catalog %} select count(expl_id) as nb,notice_id from exemplaires join notices on expl_notice=notice_id where code='{{record.isbn}}' group by notice_id {% endsqlvalue %} {% if i_catalog.0.nb %} {% endif %} {% endif %} {% endfor %}
{% if record.vignette %}{% else %} {% endif %} Edition : {{record.date}} par {{record.publisher}} à {{record.place}} {{record.note}} {{i_catalog.0.nb}} exemplaires disponible(s)
"; try { $html_to_return .= H2o::parseString($template)->render(array("result"=>$rows)); } catch (Exception $e) { $html_to_return.=highlight_string(print_r($e,true),true); } } } return $html_to_return; } } ?>