<?php header('Content-type: application/rdf+xml'); ?> <?php include 'vars.php'; include 'namespaces.php'; include 'functions.php'; include 'to.php'; # classifications foreach ($array as $code => $array2) { $higher = $array2["higher"]; $uri = $array2["uri"]; $desc = $array2["label"]; $example = $array2["classification"]; echo triple($uri, $RDF . "type", $SKOS . "Concept"); echo triple($uri, $RDFS . "subClassOf", $higher); echo triple($higher, $SKOS . "narrower", $uri); echo data_triple($uri, $SKOS . "prefLabel", $desc); echo data_triple($uri, $SKOS . "scopeNote", $code); echo data_triple($uri, $SKOS . "example", $example); }
$current_date = gmDate("Y-m-d\\TH:i:s"); echo triple($thisset, $PAV . "createdBy", $importedBy); echo typeddata_triple($thisset, $PAV . "createdOn", $current_date, $XSD . "dateTime"); echo triple($thisset, $PAV . "authoredBy", $importedBy); echo typeddata_triple($thisset, $PAV . "authoredOn", $current_date, $XSD . "dateTime"); echo triple($thisset, $RDF . "type", $VOID . "Linkset"); echo triple($masterset, $VOID . "subset", $thisset); # echo triple( $molset, $RDF . "type", $VOID . "Dataset" ); echo data_triple($sourceSet, $VOID . "uriSpace", $sourceSpace); echo triple($masterset, $VOID . "subset", $sourceSet); # echo triple( $chebiset, $RDF . "type", $VOID . "Dataset" ); echo data_triple($targetSet, $VOID . "uriSpace", $targetSpace); echo triple($masterset, $VOID . "subset", $thisset); echo "\n"; echo data_triple($thisset, $DCT . "title", $thisSetTitle); echo data_triple($thisset, $DCT . "description", $thisSetDescription); echo triple($thisset, $VOID . "subjectsTarget", $sourceSet); echo triple($thisset, $VOID . "objectsTarget", $targetSet); echo triple($thisset, $VOID . "linkPredicate", $linkPredicate); echo triple($thisset, $DCT . "license", $ini["license"]); echo triple($thisset, $DUL . "expresses", $expresses); echo "\n"; # DATA $allIDs = mysqli_query($con, "SELECT DISTINCT molregno, chembl_id FROM molecule_dictionary " . $ini["limit"]); while ($row = mysqli_fetch_assoc($allIDs)) { $molregno = $row['molregno']; $molecule = $CHEMBL . $row['chembl_id']; # get the compound type, ChEBI, and ChEMBL identifiers $chebi = mysqli_query($con, "SELECT DISTINCT chebi_par_id FROM molecule_dictionary WHERE molregno = {$molregno}"); if ($chebiRow = mysqli_fetch_assoc($chebi)) { $chebiid = $chebiRow['chebi_par_id'];
$chemblChemInfRes = $assay . "/chemblid"; echo triple($assay, $CHEMINF . "CHEMINF_000200", $chemblChemInfRes); echo triple($chemblChemInfRes, $RDF . "type", $CHEMINF . "CHEMINF_000412"); echo data_triple($chemblChemInfRes, $CHEMINF . "SIO_000300", $row['chembl_id']); if ($row['assay_organism']) { echo data_triple($assay, $ONTO . "organism", $row['assay_organism']); } if ($row['assay_tax_id']) { echo triple($assay, $ONTO . "hasTaxonomy", "http://bio2rdf.org/taxonomy:" . $row['assay_tax_id']); } if ($row['description']) { # clean up description $description = $row['description']; $description = str_replace("\\", "\\\\", $description); $description = str_replace("\"", "\\\"", $description); echo data_triple($assay, $ONTO . "hasDescription", $description); } if ($row['doc_id']) { $docProps = mysqli_query($con, "SELECT DISTINCT chembl_id FROM docs WHERE doc_id = " . $row['doc_id']); while ($docProp = mysqli_fetch_assoc($docProps)) { echo triple($assay, $CITO . "citesAsDataSource", $CHEMBL . $docProp['chembl_id']); } } $props = mysqli_query($con, "SELECT DISTINCT * FROM assay2target WHERE assay_id = " . $row['assay_id']); while ($prop = mysqli_fetch_assoc($props)) { if ($prop['tid']) { $targetURI = $TRG . "t" . $prop['tid']; if ($prop['confidence_score']) { $targetScore = $assay . "/score/t" . $prop['tid']; echo triple($assay, $ONTO . "hasTargetScore", $targetScore); echo triple($targetScore, $ONTO . "forTarget", $targetURI);
$hier = ""; if ($classRow['l1']) { $hier = appendTo($hier, $classRow['l1']); } if ($classRow['l2']) { $hier = appendTo($hier, $classRow['l2']); } if ($classRow['l3']) { $hier = appendTo($hier, $classRow['l3']); } if ($classRow['l4']) { $hier = appendTo($hier, $classRow['l4']); } if ($classRow['l5']) { $hier = appendTo($hier, $classRow['l5']); } if ($classRow['l6']) { $hier = appendTo($hier, $classRow['l6']); } if ($classRow['l7']) { $hier = appendTo($hier, $classRow['l7']); } if ($classRow['l8']) { $hier = appendTo($hier, $classRow['l8']); } echo triple($target, $ONTO . "targetClass", $array[$hier]["uri"]); } if ($row['pref_name']) { echo data_triple($target, $DC . "title", $row['pref_name']); } }
$masterset = $mastervoid . "ChEMBLRDF"; $thisset = $mastervoid . "ChEMBLDocs"; $thisSetTitle = "ChEMBL Documents"; $thisSetDescription = "Document information from ChEMBL."; $current_date = gmDate("Y-m-d\\TH:i:s"); echo triple($thisset, $PAV . "createdBy", $importedBy); echo typeddata_triple($thisset, $PAV . "createdOn", $current_date, $XSD . "dateTime"); echo triple($thisset, $PAV . "authoredBy", $importedBy); echo typeddata_triple($thisset, $PAV . "authoredOn", $current_date, $XSD . "dateTime"); echo triple($thisset, $RDF . "type", $VOID . "Dataset"); echo triple($masterset, $VOID . "subset", $thisset); echo data_triple($thisset, $DCT . "title", $thisSetTitle); echo data_triple($thisset, $DCT . "description", $thisSetDescription); echo triple($thisset, $DCT . "license", $ini["license"]); echo "\n"; while ($row = mysqli_fetch_assoc($allIDs)) { $resource = $CHEMBL . $row['chembl_id']; echo triple($resource, $RDF . "type", $BIBO . "Article"); if ($row['doi']) { echo data_triple($resource, $BIBO . "doi", $row['doi']); } if ($row['pubmed_id']) { echo data_triple($resource, $BIBO . "pmid", $row['pubmed_id']); } echo data_triple($resource, $DC . "date", $row['year']); echo data_triple($resource, $BIBO . "volume", $row['volume']); echo data_triple($resource, $BIBO . "issue", $row['issue']); echo data_triple($resource, $BIBO . "pageStart", $row['first_page']); echo data_triple($resource, $BIBO . "pageEnd", $row['last_page']); echo triple($resource, $DC . "isPartOf", $JRN . "j" . md5($row['journal'])); }
if ($struct['standard_inchi']) { echo data_triple($molecule, $CHEM . "inchi", $struct['standard_inchi']); $molsmiles = $molecule . "/inchi"; echo triple($molecule, $CHEMINF . "CHEMINF_000200", $molsmiles); echo triple($molsmiles, $RDF . "type", $CHEMINF . "CHEMINF_000113"); echo data_triple($molsmiles, $CHEMINF . "SIO_000300", $struct['standard_inchi']); if (strlen($struct['standard_inchi']) < 1500) { echo triple($molecule, $OWL . "equivalentClass", "http://rdf.openmolecules.net/?" . $struct['standard_inchi']); } } if ($struct['standard_inchi_key']) { echo data_triple($molecule, $CHEM . "inchikey", $struct['standard_inchi_key']); $molsmiles = $molecule . "/inchikey"; echo triple($molecule, $CHEMINF . "CHEMINF_000200", $molsmiles); echo triple($molsmiles, $RDF . "type", $CHEMINF . "CHEMINF_000059"); echo data_triple($molsmiles, $CHEMINF . "SIO_000300", $struct['standard_inchi_key']); } } # get parent/child information $hierarchies = mysqli_query($con, "SELECT DISTINCT * FROM molecule_hierarchy WHERE molregno = {$molregno}"); while ($hierarchy = mysqli_fetch_assoc($hierarchies)) { if ($hierarchy['parent_molregno'] != $molregno) { $parent = $MOL . "m" . $hierarchy['parent_molregno']; echo triple($molecule, $ONTO . "parentCompound", $parent); } if ($hierarchy['active_molregno'] != $molregno) { $child = $MOL . "m" . $hierarchy['active_molregno']; echo triple($molecule, $ONTO . "activeCompound", $child); } } }