DESCRIPTION
The resim . jar file is an implementation of RESIM (REsource SIMilarity) measure. The measure is designed to calculate the semantic similarity between two resources in a Knowlege Graph (e.g., DBpedia, zhishi . me) with a SPARQL Endpoint. RESIM is presented in [1] and then it is improved in [2] and the summary of the measure is presented in [3]. The implementation extends the measure further by enabling different properties for two resources, e.g., for incoming indirect link between dbpedia : Steve_Jobs and dbpedia : Apple_Inc., it can be connected by dbpedia : Steve_Jobs<-dbpedia-owl: keyPerson <-dbpedia : NexT->dbpedia-owl: successor->dbpedia : Apple_Inc. while in the paper we restrict the property should be the same.
When writing a paper or producing a software application, tool, or interface based on the library, please kindly cite the source [2].
REQUIREMENT
- Java 1.7
- JENA 2.11.2
EXAMPLE 1
public static void main(String[] args) {
// similarity measure settings
List<String> additionalPropertyList = Arrays.asList(
"<http://purl.org/dc/terms/subject>",
"<http://www.w3.org/2000/01/rdf-schema#subClassOf>",
"<http://www.w3.org/2004/02/skos/core#narrowerOf>",
"<http://www.w3.org/2004/02/skos/core#broaderOf>",
"<http://www.w3.org/1999/02/22-rdf-syntax-ns#type>"
);
List<String> includePropertyList = Arrays.asList(
"<http://purl.org/dc/terms/subject>",
"<http://www.w3.org/2000/01/rdf-schema#subClassOf>",
"<http://www.w3.org/2004/02/skos/core#narrower>",
"<http://www.w3.org/2004/02/skos/core#broader>",
"<http://www.w3.org/1999/02/22-rdf-syntax-ns#type>"
);
List<String> excludePropertyList = Arrays.asList(
"<http://dbpedia.org/ontology/wikiPageWikiLink>"
);
// initialize similarity measure
// param1: SPARQL Endpoint URL
// param2: pattern for property - default: "http://dbpedia.org/ontology/
// param3: include property list
// param4: additional property list to pattern
// param5: exclude property list
ResourceSimilarityMeasure rsm = new ResourceSimilarityMeasure("http://dbpedia.org/sparql", null, null, additionalPropertyList, excludePropertyList);
System.out.println(rsm.getSimilarity("<http://dbpedia.org/resource/Drink>", "<http://dbpedia.org/resource/Mouth>", 2));
}
EXAMPLE 2
public static void main( String[ ] args) {
List<String> excludePropertyList = Arrays. asList ( "<http://dbpedia.org/ontology/wikiPageWikiLink>");
ResourceSimilarityMeasure rsm = new ResourceSimilarityMeasure("http://dbpedia.org/sparql", null , null, null, excludePropertyList );
System. out. println ( rsm . getSimilarity ( "<http://dbpedia.org/resource/Apple_Inc.>", "<http://dbpedia.org/resource/Steve_Jobs>", 2));
System. out. println ( rsm . getSimilarity ( "<http://dbpedia.org/resource/Apple_Inc.>", "<http://dbpedia.org/resource/Steve_Wozniak>", 2));
System. out. println ( rsm . getSimilarity ( "<http://dbpedia.org/resource/Apple_Inc.>", "<http://dbpedia.org/resource/Jonathan_Ive>", 2));
System. out. println ( rsm . getSimilarity ( "<http://dbpedia.org/resource/Apple_Inc.>", "<http://dbpedia.org/resource/Microsoft>", 2));
System. out. println ( rsm . getSimilarity ( "<http://dbpedia.org/resource/Apple_Inc.>", "<http://dbpedia.org/resource/IPad>", 2));
// Printed results
0.7107697604926099
0.26084710667467736
0.13425729687979637
0.6239711506085717
0.7341358492281069
Started: 18.1.2016 21:54:42 Finished: 18.1.2016 21:55:12
}
- The ResourceSimilarityMeasure requires 5 parameters. The first one is a SPARQL Endpoint (e.g., DBpedia SPARQL Endpoint) and the other ones are used for
controling the property list for this measure. - The 2nd parameter (pattern) is used with 4th, 5th parameters. For example, the default pattern of property for this measure is "http://dbpedia.org/ontology/" (i.e., DBpedia Ontology properties) and it will consider/exclude the list of properties if there is an additional property list or an exclude property list exist.
- The 3rd parameter is an include property list that controls
property list for this measure in a strict way. That is, the measure will only consider this property list if you define the list.
REFENRECES
- Computing the Semantic Similarity of Resources in DBpedia for Recommendation Purposes, Guangyuan Piao, Safina
showkat Ara, John G. Breslin 5th Joint International Semantic Technology Conference, Yichang, China, 2015 - Measuring Semantic Similarity for Linked Open Data-enabled Recommender Systems, Guangyuan Piao and John G. Breslin, The 31st ACM/SIGAPP Symposium on Applied Computing, Pisa, Italy, 2016
- Exploiting the Semantic Similarity of Interests in a Semantic Interest Graph for Social Recommendations, Guangyuan Piao, The 31st ACM/SIGAPP Symposium on Applied Computing, Pisa, Italy, 2016