SimilarityReasoner

This reasoner, implemented in Java, is built upon PELLET (OWL-DL reasoner) to reason on similarities. The provided API consists of a SPARQL interface which allows accessing the reasoner’s functionalities pervasively.

Similarities can be defined according to the ontology similarity (examples in the file similarity.owl).

A full similarity (or similarity-on-undividual) can be defined as follows:

<owl:NamedIndividual rdf:about="http://www.semanticweb.org/flavio/2016/4/similarity#un1">
    <rdf:type rdf:resource="http://www.flaviopileggi.net/Ontology/similarity#uncertainElement"/>
    <similarTo rdf:resource="http://www.semanticweb.org/flavio/2016/4/UC1#Flavio"/>
</owl:NamedIndividual> 

That OWL statement defines un1 as an uncertainty (uncertainElement) similar to Flavio (in the context of the ontology UC1).

Partial similarity (or similarity-on-property) can be defined as in the example below:

<owl:NamedIndividual rdf:about="http://www.semanticweb.org/flavio/2016/4/similarity#un1">
    <rdf:type rdf:resource="http://www.flaviopileggi.net/Ontology/similarity#uncertainElement"/>
    <similarTo rdf:resource="http://www.semanticweb.org/flavio/2016/4/UC1#Flavio"/>
    <onProperty rdf:datatype="http://www.w3.org/2001/XMLSchema#string">http://www.semanticweb.org/flavio/2016/4/UC1#detectedAt</onProperty>
    <onProperty rdf:datatype="http://www.w3.org/2001/XMLSchema#string">http://www.semanticweb.org/flavio/2016/4/UC1#lives</onProperty>
</owl:NamedIndividual>

The individual un1 is stated similar to Flavio only on the properties detectedAt and lives.

Finally, similarity-on-value can be defined as follows:

<owl:NamedIndividual rdf:about="http://www.semanticweb.org/flavio/2016/4/similarity#un5">
    <rdf:type rdf:resource="http://www.flaviopileggi.net/Ontology/similarity#uncertainElement"/>
    <similarTo rdf:resource="http://www.semanticweb.org/flavio/2016/4/UC1#Mary"/>
    <onValue rdf:datatype="http://www.w3.org/2001/XMLSchema#string">http://www.w3.org/1999/02/22-rdf-syntax-ns#type,http://www.semanticweb.org/flavio/2016/4/UC1#Surfer</onValue>
</owl:NamedIndividual>

The individual un5 is declared similar to Mary but also of type surfer.

The class example.java includes a simple code to reason on the similarities (defined in similarity.owl) in the context of the example ontology in the file UC1.owl.

Current version:

Previous versions:

Run the example below (example.java) to quickly get started:

// The CONTEXT ontology + The SIMILARITY ontology
private String	ontology	= "file:///Users/spileggi/Desktop/UC1.owl";
private String	similarity	= "file:///Users/spileggi/Desktop/similarity.owl";

private String similarityPrefix = "http://www.flaviopileggi.net/Ontology/similarity#";
	
//query	
String queryString =        
    "select ?surfer "+
    "where { "+
    "?surfer a <http://www.semanticweb.org/flavio/2016/4/UC1#Surfer>  "+
    "} \n ";
			
public void run() {

	SFactorRS rs = new SFactorRS();
	SFactorRS rs1 = new SFactorRS();
	        
	//The class similarityOnIndividual considers ONLY full similarities (similarity-on-individual)
	rs = new similarityOnIndividual(similarityPrefix).QueryOnSimilarity(ontology, similarity, queryString);
        rs.printDeterministic(queryString);
        rs.printUncertain(queryString);
		    
	/*The class similarityOnProperty processes both full similarities (similarity-on-individual)
	and partial similarities (similarity-on-property)*/
		
	rs1 = new similarityOnProperty(similarityPrefix).QueryOnSimilarity(ontology, similarity, queryString);
	rs1.printDeterministic(queryString);
	rs1.printUncertain(queryString);
		    
}

Citation