Skip to content

Commit

Permalink
Merge pull request #137 from e4ong1031/master
Browse files Browse the repository at this point in the history
Updated inverseOf object properties display.
  • Loading branch information
e4ong1031 authored Jul 12, 2018
2 parents 53d0148 + 46c194f commit 776a97d
Showing 1 changed file with 23 additions and 0 deletions.
23 changes: 23 additions & 0 deletions application/RDFStore/RDFStore.php
Original file line number Diff line number Diff line change
Expand Up @@ -803,6 +803,19 @@ public function describeProperty( $graph, $propertyIRI ) {
$this->sparql->add( 'ontology', $query );
$queries[] = $query;
# Check if there exists a property which is inverseOf query property
$query =
<<<END
PREFIX owl: <{$this->prefixNS['owl']}>
SELECT ?s FROM <$graph> WHERE {
?s owl:inverseOf ?o .
FILTER ( ?o = <$propertyIRI> ) .
FILTER ( isIRI( ?s ) ) .
}
END;
$this->sparql->add( 'inverse', $query );
$queries[] = $query;
$results = $this->sparql->execute();
$describeArray = json_decode( $results['describe'], true );
Expand Down Expand Up @@ -870,6 +883,16 @@ public function describeProperty( $graph, $propertyIRI ) {
}
}
}
if ( sizeof( RDFQueryHelper::parseSPARQLResult( $results['inverse'] ) ) > 0 ) {
foreach( RDFQueryHelper::parseSPARQLResult( $results['inverse'] ) as $inverse ) {
$axiom['inverse'][] = $inverse['s'];
$property['describe'][$this->prefixNS['owl'] . 'inverseOf'][] = array(
"type" => 'uri',
"value" => $inverse['s']
);
}
}
$property['axiom'] = $axiom;
return array( $property, $queries );
Expand Down

0 comments on commit 776a97d

Please sign in to comment.