Beispiel #1
0
		<td bgcolor="#AAAAAA"><strong>Total</strong></td>
	</tr>


<?php 
foreach ($rs as $row) {
    $o = $row['ontology_abbrv'];
    $settings = getSettings($o);
    $classQueryString = "\nPREFIX rdf: <{$settings['ns_rdf']}>\nPREFIX owl: <{$settings['ns_owl']}>\nSELECT  count(distinct ?s) as ?cCount\nFROM <{$settings['ns_main']}>\nWHERE\n{\n?s a owl:Class .\nFILTER (isIRI(?s)).\n}\n";
    $objectQueryString = "\nPREFIX rdf: <{$settings['ns_rdf']}>\nPREFIX owl: <{$settings['ns_owl']}>\nSELECT  count(distinct ?s) as ?oCount\nFROM <{$settings['ns_main']}>\nWHERE\n{\n?s a owl:ObjectProperty .\nFILTER (isIRI(?s)).\n}\n";
    $datatypeQueryString = "\nPREFIX rdf: <{$settings['ns_rdf']}>\nPREFIX owl: <{$settings['ns_owl']}>\nSELECT  count(distinct ?s) as ?dCount\nFROM <{$settings['ns_main']}>\nWHERE\n{\n?s a owl:DatatypeProperty .\nFILTER (isIRI(?s)).\n}\n";
    $annotationQueryString = "\nPREFIX rdf: <{$settings['ns_rdf']}>\nPREFIX owl: <{$settings['ns_owl']}>\nSELECT  count(distinct ?s) as ?aCount\nFROM <{$settings['ns_main']}>\nWHERE\n{\n?s a owl:AnnotationProperty .\nFILTER (isIRI(?s)).\n}\n";
    $cCountResult = json_query($classQueryString);
    $aCountResult = json_query($annotationQueryString);
    $dCountResult = json_query($datatypeQueryString);
    $oCountResult = json_query($objectQueryString);
    $cCount = $cCountResult[0]['cCount'];
    $aCount = $aCountResult[0]['aCount'];
    $dCount = $dCountResult[0]['dCount'];
    $oCount = $oCountResult[0]['oCount'];
    $total = $cCount + $aCount + $dCount + $oCount;
    ?>
	<tr align="center" height="25" <?php 
    if ($index % 2 == 0) {
        echo "bgcolor = \"#CCECFB\"";
    }
    ?>
>
		<td><strong><?php 
    echo $index;
    ?>
Beispiel #2
0
function getSubClassAndProperty($ontology_uri, &$results, $tmp_iri)
{
    global $ns_rdf, $ns_rdfs, $ns_owl, $num_queries, $processed_iris, $included_iris, $parent_included_iris, $strOutput;
    $querystring = "\r\nPREFIX rdf: <{$ns_rdf}>\r\nPREFIX rdfs: <{$ns_rdfs}>\r\nPREFIX owl: <{$ns_owl}>\r\n\r\nSELECT DISTINCT *\r\n\r\nFROM <{$ontology_uri}>\r\n\t\r\nWHERE { \r\n\t{\r\n\t\t?s rdfs:subClassOf <{$tmp_iri}> .\r\n\t\t?s rdfs:label ?o\r\n\t}\r\n\tUNION\r\n\t{\r\n\t\t?s owl:equivalentClass ?s1 .\r\n\t\t?s1 owl:intersectionOf ?s2 .\r\n\t\t?s2 rdf:first <{$tmp_iri}> .\r\n\t\t?s rdfs:label ?o\r\n\t}\r\n}";
    $tmp_results = json_query($querystring);
    $num_queries++;
    if (!empty($tmp_results)) {
        foreach ($tmp_results as $tmp_result) {
            $tmp_iri0 = $tmp_result['s'];
            if (!isset($processed_iris[$tmp_iri0]) && !isset($included_iris[$tmp_iri0]) && !iriImported($tmp_iri0)) {
                $strOutput .= "\r\n<rdf:Description rdf:about=\"{$tmp_iri0}\">\r\n\t\t\t<rdfs:subClassOf rdf:resource=\"{$tmp_iri}\"/>\r\n\t\t  </rdf:Description>\r\n";
                $results[$tmp_iri0] = $tmp_result['o'];
                getSubClassAndProperty($ontology_uri, $results, $tmp_iri0);
            }
        }
    }
    $querystring = "\r\nPREFIX rdf: <{$ns_rdf}>\r\nPREFIX rdfs: <{$ns_rdfs}>\r\nPREFIX owl: <{$ns_owl}>\r\n\r\nSELECT DISTINCT *\r\n\r\nFROM <{$ontology_uri}>\r\n\t\r\nWHERE { \r\n\t{\r\n\t\t?s rdfs:subPropertyOf <{$tmp_iri}> .\r\n\t\t?s rdfs:label ?o\r\n\t}\r\n\tUNION\r\n\t{\r\n\t\t?s owl:equivalentProperty ?s1 .\r\n\t\t?s1 owl:intersectionOf ?s2 .\r\n\t\t?s2 rdf:first <{$tmp_iri}> .\r\n\t\t?s rdfs:label ?o\r\n\t}\r\n}";
    $tmp_results = json_query($querystring);
    $num_queries++;
    if (!empty($tmp_results)) {
        foreach ($tmp_results as $tmp_result) {
            $tmp_iri0 = $tmp_result['s'];
            if (!isset($processed_iris[$tmp_iri0]) && !isset($included_iris[$tmp_iri0]) && !iriImported($tmp_iri0)) {
                $strOutput .= "\r\n<rdf:Description rdf:about=\"{$tmp_iri0}\">\r\n\t\t\t<rdfs:subPropertyOf rdf:resource=\"{$tmp_iri}\"/>\r\n\t\t  </rdf:Description>\r\n";
                $results[$tmp_iri0] = $tmp_result['o'];
                getSubClassAndProperty($ontology_uri, $results, $tmp_iri0);
            }
        }
    }
}
Beispiel #3
0
</br>

<p>Total #: <strong><?php 
    echo $index;
    ?>
</strong></p>
<?php 
} elseif ($prefix == "total" && $type == "totalCount") {
    $classQueryString = "\nSELECT ?s as ?class ?l as ?label\nFROM <{$domain}>\nWHERE\n{\n?s a owl:Class .\n\nOPTIONAL\n{\n?s rdfs:label ?l.\n}\n\nFILTER (isIRI(?s)).\n\n}\n";
    $objectQueryString = "\nSELECT ?s as ?object ?l as ?label\nFROM <{$domain}>\nWHERE\n{\n?s a owl:ObjectProperty .\n\nOPTIONAL\n{\n?s rdfs:label ?l.\n}\n\nFILTER (isIRI(?s)).\n\n}\n";
    $datatypeQueryString = "\nSELECT ?s as ?datatype ?l as ?label\nFROM <{$domain}>\nWHERE\n{\n?s a owl:DatatypeProperty .\n\nOPTIONAL\n{\n?s rdfs:label ?l.\n}\n\nFILTER (isIRI(?s)).\n\n}\n";
    $annotationQueryString = "\nSELECT ?s as ?annotation ?l as ?label\nFROM <{$domain}>\nWHERE\n{\n?s a owl:AnnotationProperty .\n\nOPTIONAL\n{\n?s rdfs:label ?l.\n}\nFILTER (isIRI(?s)).\n\n}\n";
    $classQueryResult = json_query($classQueryString);
    $objectQueryResult = json_query($objectQueryString);
    $datatypeQueryResult = json_query($datatypeQueryString);
    $annotationQueryResult = json_query($annotationQueryString);
    $index = 0;
    ?>
</br>
</br>
<table align="center" width="800">

<tr height="25" align="center">
	<td  bgcolor="#AAAAAA" ><strong>IRI</strong></td>
	<td  bgcolor="#AAAAAA"><strong>label</strong></td>
</tr>
<?php 
    if (sizeof($classQueryResult) != 0) {
        foreach ($classQueryResult as $result) {
            ?>
	<tr height="25" <?php 
Beispiel #4
0
            $first_letter_filter = '.
FILTER regex(?o, "^[^A-Z]")';
        }
        $querystring = "\nPREFIX rdf: <{$settings['ns_rdf']}>\nSELECT distinct ?s ?o\n";
        if ($graph != '') {
            $querystring .= "\nFROM <{$graph}>\n";
        } else {
            $querystring .= "\nFROM <{$settings['ns_main']}>\n";
        }
        $querystring .= "\nWHERE {\n\t{ ?s rdf:type <{$iri}> .\n\tFILTER (isIRI(?s)).\n\tOPTIONAL { ?s rdfs:label  ?o } \n\t}\n";
        if ($iri == $settings['ns_owl'] . 'ObjectProperty') {
            $querystring .= "\n\tUNION {?s rdf:type owl:TransitiveProperty.\n\tFILTER (isIRI(?s)).\n\tOPTIONAL { ?s rdfs:label  ?o } \n\t} \n\tUNION {?s rdf:type owl:SymmetricProperty.\n\tFILTER (isIRI(?s)).\n\tOPTIONAL { ?s rdfs:label  ?o } \n\t}\n";
        }
        $querystring .= "\n\n}\n\nLIMIT 10000\n";
        //	print($querystring);
        $results = json_query($querystring);
        $final_results = array();
        if (!empty($results)) {
            foreach ($results as $result) {
                $sub = $result['s'];
                $obj = isset($result['o']) ? $result['o'] : '';
                $final_results[$sub] = $obj != '' ? $obj : getShortTerm($sub);
                if ($final_results[$sub] == '') {
                    $final_results[$sub] = 'NA';
                }
            }
        } else {
        }
        asort($final_results);
        if (!empty($final_results)) {
            $numOfRecords = sizeof($final_results);
Beispiel #5
0
 $rs = $db->Execute($strSql);
 if (!$rs->EOF) {
     $filename = $ontology;
     //		print(filemtime("userfiles/$filename.xls") - time());
     if (!file_exists("userfiles/{$filename}.xls") || time() - filemtime("userfiles/{$filename}.xls") > 60 * 60 * 8) {
         $end_point = $rs->Fields('end_point');
         $graph_url = $rs->Fields('ontology_graph_url');
         $querystring = "\nPREFIX rdf: <http://www.w3.org/1999/02/22-rdf-syntax-ns#>\nPREFIX rdfs: <http://www.w3.org/2000/01/rdf-schema#>\nPREFIX owl: <http://www.w3.org/2002/07/owl#>\n\nSELECT *\n\nFROM <{$graph_url}>\n\nWHERE\n{\n\t?s rdf:type owl:Class .\n\t?s rdfs:label ?l .\n\tFILTER (isIRI(?s)).\n\tOPTIONAL {?s <http://purl.obolibrary.org/obo/IAO_0000118> ?alt_names}.\n\tOPTIONAL {?s <http://purl.obolibrary.org/obo/IAO_0000115> ?definition}.\n\tOPTIONAL {?s rdfs:subClassOf ?pTerm.\n\t\tFILTER (isIRI(?pTerm)).\n\t\t?pTerm rdfs:label ?pLabel}.\n\t\n}\n\nlimit 10000\n";
         //print($querystring);
         $tmp_results = json_query($querystring, $end_point);
         $terms = array();
         foreach ($tmp_results as $result) {
             $terms[$result['s']] = $result;
         }
         $querystring = "\nPREFIX rdf: <http://www.w3.org/1999/02/22-rdf-syntax-ns#>\nPREFIX rdfs: <http://www.w3.org/2000/01/rdf-schema#>\nPREFIX owl: <http://www.w3.org/2002/07/owl#>\n\nSELECT *\n\nFROM <{$graph_url}>\n\nWHERE\n{\n\t?s rdf:type ?o .\n\t?s rdfs:label ?l .\n\tFILTER (?o in(<" . join('>, <', $a_signature_term_type) . ">)).\n\tFILTER (isIRI(?s)).\n\tOPTIONAL {?s <http://purl.obolibrary.org/obo/IAO_0000118> ?alt_names}.\n\tOPTIONAL {?s <http://purl.obolibrary.org/obo/IAO_0000115> ?definition}.\n\tOPTIONAL {?s rdfs:subPropertyOf ?pTerm.\n\t\tFILTER (isIRI(?pTerm)).\n\t\t?pTerm rdfs:label ?pLabel}.\n\t\n}\n\nlimit 10000\n";
         $tmp_results = json_query($querystring, $end_point);
         foreach ($tmp_results as $result) {
             $terms[$result['s']] = $result;
         }
         /** PHPExcel */
         require_once 'inc/PHPExcel.php';
         /** PHPExcel_Cell_AdvancedValueBinder */
         require_once 'inc/PHPExcel/Cell/AdvancedValueBinder.php';
         /** PHPExcel_IOFactory */
         require_once 'inc/PHPExcel/IOFactory.php';
         // Set value binder
         PHPExcel_Cell::setValueBinder(new PHPExcel_Cell_AdvancedValueBinder());
         // Create new PHPExcel object
         $objPHPExcel = new PHPExcel();
         $objPHPExcel->getActiveSheet()->getColumnDimension('A')->setWidth(45);
         $objPHPExcel->getActiveSheet()->getColumnDimension('B')->setWidth(45);
Beispiel #6
0
             } else {
                 $annotationPrefixArray[$prefix] = 1;
             }
         } elseif (preg_match('/\\/([a-z]+)_[0-9]+/', $property['annotation'], $match)) {
             $prefix = $match[1];
             if (array_key_exists($prefix, $annotationPrefixArray)) {
                 $annotationPrefixArray[$prefix] += 1;
             } else {
                 $annotationPrefixArray[$prefix] = 1;
             }
         } else {
             $annotationNoPrefixCount++;
         }
     }
 }
 $dpropertyResult = json_query($DatatypePropertyQueryString);
 $datatypePrefixArray = array();
 $datatypeNoPrefixCount = 0;
 if (count($dpropertyResult) != 0) {
     foreach ($dpropertyResult as $property) {
         if (preg_match('/\\/([A-Za-z\\.\\-_]+)#[a-zA-Z_0-9]+/', $property['datatype'], $match)) {
             $prefix = $match[1];
             if (array_key_exists($prefix, $datatypePrefixArray)) {
                 $datatypePrefixArray[$prefix] += 1;
             } else {
                 $datatypePrefixArray[$prefix] = 1;
             }
         } elseif (preg_match('/\\/([A-Z][A-Za-z]+)_[-a-zA-Z_0-9]+/', $property['datatype'], $match)) {
             $prefix = $match[1];
             if (array_key_exists($prefix, $datatypePrefixArray)) {
                 $datatypePrefixArray[$prefix] += 1;
Beispiel #7
0
        if (preg_match('/[a-zA-Z]+[:_]\\d{7,}/', $keywords)) {
            $search_term_url = 'http://purl.obolibrary.org/obo/' . preg_replace('/:/', '_', $keywords);
            $querystring = "SELECT   distinct ?s ?o\nfrom <{$settings['ns_main']}>\nWHERE{\n?s ?p ?o .\nfilter (?p in (<" . join('>,<', $array_property) . ">)).\nfilter (?s in (<{$search_term_url}>)).\n}\nlimit 5000\n";
        } else {
            $querystring = "SELECT  distinct ?s ?o\nfrom <{$settings['ns_main']}>\nWHERE{\n?s ?p ?o .\nfilter (?p in (<" . join('>,<', $array_property) . ">)).\nFILTER (isIRI(?s)).\n?o bif:contains \"'{$keywords}*'\".\n}\nlimit 5000\n";
        }
    } else {
        if (preg_match('/[a-zA-Z]+[:_]\\d{7,}/', $keywords)) {
            $search_term_url = 'http://purl.obolibrary.org/obo/' . preg_replace('/:/', '_', $keywords);
            $querystring = "SELECT  distinct ?g ?s ?o\nWHERE{\ngraph ?g \n{\n?s ?p ?o .\nfilter (?p in (<" . join('>,<', $array_property) . ">)).\nfilter (?s in (<{$search_term_url}>)).\n}\n}\nlimit 5000\n";
        } else {
            $querystring = "SELECT  distinct ?g ?s ?o\nWHERE{\ngraph ?g \n{\n?s ?p ?o .\nfilter (?p in (<" . join('>,<', $array_property) . ">)).\nFILTER (isIRI(?s)).\n?o bif:contains \"'{$keywords}*'\".\n}\n}\nlimit 5000\n";
        }
    }
    //	print ($querystring);
    $results = json_query($querystring, $default_end_point);
    if (!empty($results)) {
        $tkeywords = preg_replace('/\\W/', ' ', $keywords);
        ?>
<p>

Terms with '<?php 
        echo $keywords;
        ?>
' included in their label:
<ol>
<?php 
        $results2 = array();
        foreach ($results as $result) {
            if (strtolower($result['o']) == strtolower($keywords)) {
                if (isset($result['g'])) {