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); } } } }
$tmp_results['nodeID://' . $match] = 'NA'; } } if ($includeAllAxiomsRecursively) { preg_match_all('/resource="(.+?)"/', $output, $matches); foreach ($matches[1] as $match) { if (!isset($processed_iris[$match]) && !isset($included_iris[$match]) && !iriImported($match)) { $tmp_results[$match] = 'NA'; } } } //get labels and types for related terms if ($includeAllAxioms) { preg_match_all('/resource="(.+?)"/', $output, $matches); foreach ($matches[1] as $match) { if (!isset($processed_iris[$match]) && !isset($included_iris[$match]) && !iriImported($match)) { $related_terms[$match] = 'NA'; } } } preg_match_all('/<rdf:Description rdf:about="([^"]+?)"><rdf:type rdf:resource="http:\\/\\/www.w3.org\\/2002\\/07\\/owl#Class"\\/><\\/rdf:Description>/', $output, $matches); foreach ($matches[1] as $match) { $strOutput .= " <rdf:Description rdf:about=\"{$match}\">\r\n\t<obo:IAO_0000412 rdf:resource=\"{$ontology_original_uri}\"/>\r\n </rdf:Description>\r\n"; } preg_match_all('/<rdf:Description rdf:about="([^"]+?)"><rdf:type rdf:resource="http:\\/\\/www.w3.org\\/2002\\/07\\/owl#ObjectProperty"\\/><\\/rdf:Description>/', $output, $matches); foreach ($matches[1] as $match) { $strOutput .= " <rdf:Description rdf:about=\"{$match}\">\r\n\t<obo:IAO_0000412 rdf:resource=\"{$ontology_original_uri}\"/>\r\n </rdf:Description>\r\n"; } preg_match_all('/<rdf:Description rdf:about="([^"]+?)"><rdf:type rdf:resource="http:\\/\\/www.w3.org\\/2002\\/07\\/owl#DatatypeProperty"\\/><\\/rdf:Description>/', $output, $matches); foreach ($matches[1] as $match) { $strOutput .= " <rdf:Description rdf:about=\"{$match}\">\r\n\t<obo:IAO_0000412 rdf:resource=\"{$ontology_original_uri}\"/>\r\n </rdf:Description>\r\n";