forked from egonw/chembl.rdf
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathdocs_ls_crossref.php
65 lines (53 loc) · 2.49 KB
/
docs_ls_crossref.php
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
<?php header('Content-type: application/rdf+xml'); ?>
<?php
include 'namespaces.php';
include 'functions.php';
$ini = parse_ini_file("vars.properties");
$rooturi = $ini["rooturi"];
$importedBy = $ini["importedBy"];
$db = $ini["dbprefix"] . $ini["version"];
$con = mysqli_connect(ini_get("mysqli.default_host"), ini_get("mysqli.default_user"), ini_get("mysqli.default_pw"), $db);
if (mysqli_connect_errno($con)) die(mysqli_connect_errno($con));
# VOID
$mastervoid = $rooturi . "void.ttl#";
$masterset = $mastervoid . "ChEMBLRDF";
$thisset = $mastervoid . "ChEMBLCrossRefMapping";
$thisSetTitle = "ChEMBL - CrossRef mappings";
$thisSetDescription = "Mappings between ChEMBL documents and CrossRef.";
$sourceSet = $mastervoid . "ChEMBLIDs";
$sourceSpace = $CHEMBL;
$targetSet = $mastervoid . "CrossRef";
$targetSpace = "http://dx.doi.org/";
$linkPredicate = $OWL . "sameAs";
$expresses = "http://purl.obolibrary.org/obo/MI_0574";
$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 * FROM docs WHERE doc_id > 0 AND doi IS NOT NULL " . $ini["limit"]);
while ($row = mysqli_fetch_assoc($allIDs)) {
$resource = $CHEMBL . $row['chembl_id'];
if ($row['doi']) {
echo triple( $resource, $OWL . "sameAs", "http://dx.doi.org/" . $row['doi'] );
}
}
?>