} $a_fields = array(); if (!empty($a_label_usage)) { $querystring = "\nSELECT *\n\nFROM <{$settings['ns_main']}>\n\nWHERE { ?s <http://www.w3.org/2000/01/rdf-schema#label> ?o.\nFILTER (?s in(<http://null>, <" . join('>, <', array_keys($a_label_usage)) . ">))\n}\n"; $strQueryPrint .= $querystring . ' =================================================================== '; $fields = array(); $fields['default-graph-uri'] = ''; $fields['format'] = 'application/sparql-results+json'; $fields['debug'] = 'on'; $fields['query'] = $querystring; $a_fields['query_key_usage_labels'] = $fields; } $a_query_results = curl_multi_post_contents($settings['remote_store_endpoint'], $a_fields); $usage_labels = isset($a_query_results['query_key_usage_labels']) ? parse_json_query($a_query_results['query_key_usage_labels']) : array(); foreach ($usage_labels as $result) { $a_label[$result['s']] = $result['o']; } foreach ($a_label as $term_uri => $label) { if ($label == NULL) { $a_label[$term_uri] = getShortTerm($term_uri); } } if (!empty($usage_results)) { ?> <div style="font-weight:bold">Uses in this ontology</div> <div style="background-color:#EAF1F2; border:#99CCFF 1px solid; margin-top:4px; margin-bottom:12px"> <ul> <?php foreach ($usage_results as $usage_result) {
function json_query($querystring, $endpoint = NULL) { global $settings; $fields = array(); $fields['default-graph-uri'] = ''; $fields['format'] = 'application/sparql-results+json'; $fields['debug'] = 'on'; $fields['query'] = $querystring; if ($endpoint == NULL) { $endpoint = $settings['remote_store_endpoint']; } // print($querystring); //error_log($querystring, 3, '/tmp/error.log'); $json = curl_post_contents($endpoint, $fields); // print($json); return parse_json_query($json); }
<!-- InstanceBeginEditable name="Main" --> <?php if ($vali->getErrorMsg() == '') { $a_fields = array(); $querystring = "\nPREFIX rdf: <{$settings['ns_rdf']}>\nPREFIX rdfs: <{$settings['ns_rdfs']}>\n\nPREFIX owl: <{$settings['ns_owl']}>\n\nSELECT DISTINCT ?s ?o ?sc\nFROM <{$settings['ns_main']}>\n\n\nWHERE { \n{\n?s rdfs:subClassOf <{$iri}> .\nFILTER (isIRI(?s)).\nOPTIONAL {?s rdfs:label ?o} .\nOPTIONAL {?sc rdfs:subClassOf ?s}\n}\nUNION\n{\n?s owl:equivalentClass ?s1 .\nFILTER (isIRI(?s)).\n?s1 owl:intersectionOf ?s2 .\n?s2 rdf:first <{$iri}> .\nOPTIONAL {?s rdfs:label ?o} .\nOPTIONAL {?sc rdfs:subClassOf ?s}\n}\nUNION\n{\n?s rdfs:subClassOf <{$iri}> .\nFILTER (isIRI(?s)).\nOPTIONAL {?s rdfs:label ?o} .\nOPTIONAL {?sc owl:equivalentClass ?s1 .\n?s1 owl:intersectionOf ?s2 .\n?s2 rdf:first ?s}\n}\nUNION\n{\n?s owl:equivalentClass ?s1 .\nFILTER (isIRI(?s)).\n?s1 owl:intersectionOf ?s2 .\n?s2 rdf:first <{$iri}> .\nOPTIONAL {?s rdfs:label ?o} .\nOPTIONAL {?sc owl:equivalentClass ?s3 .\n?s3 owl:intersectionOf ?s4 .\n?s4 rdf:first ?s}\n}\n}"; $strQueryPrint .= $querystring . ' =================================================================== '; $fields = array(); $fields['default-graph-uri'] = ''; $fields['format'] = 'application/sparql-results+json'; $fields['debug'] = 'on'; $fields['query'] = $querystring; $a_fields['query_key_sub_class_results'] = $fields; $a_query_results = curl_multi_post_contents($settings['remote_store_endpoint'], $a_fields); $sub_class_results = parse_json_query($a_query_results['query_key_sub_class_results']); if (isset($term_cbd[$iri])) { ?> <p> <b>Sub <?php print $term_type; ?> of <?php print $main_label; ?> :</b> </p> <?php