Skip to content

Commit a503473

Browse files
committed
Add map of equivalent Classes / Properties in Ontology
1 parent 000fe9d commit a503473

File tree

2 files changed

+12
-3
lines changed

2 files changed

+12
-3
lines changed

core/src/main/scala/org/dbpedia/extraction/ontology/Ontology.scala

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,5 +15,7 @@ class Ontology (
1515
val classes : Map[String, OntologyClass],
1616
val properties : Map[String, OntologyProperty],
1717
val datatypes : Map[String, Datatype],
18-
val specializations : Map[(OntologyClass, OntologyProperty), UnitDatatype]
18+
val specializations : Map[(OntologyClass, OntologyProperty), UnitDatatype],
19+
val equivalentPropertiesMap : Map[OntologyProperty,Set[OntologyProperty]],
20+
val equivalentClassesMap : Map[OntologyProperty,Set[OntologyProperty]]
1921
)

core/src/main/scala/org/dbpedia/extraction/ontology/io/OntologyReader.scala

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -72,10 +72,12 @@ class OntologyReader
7272
val name = getName(page.title, _.capitalize(page.title.language.locale))
7373

7474
ontologyBuilder.classes ::= loadClass(name, templateNode)
75+
// Fill the equivalentClass map
7576

76-
for(specificProperty <- loadSpecificProperties(name, templateNode))
77+
for(specificProperty <- loadSpecificProperties(name, templateNode))
7778
{
7879
ontologyBuilder.specializedProperties ::= specificProperty
80+
// To check for equivalent Property Map
7981
}
8082
}
8183
else if(templateName == OntologyReader.OBJECTPROPERTY_NAME || templateName == OntologyReader.DATATYPEPROPERTY_NAME)
@@ -85,6 +87,7 @@ class OntologyReader
8587
for(property <- loadOntologyProperty(name, templateNode))
8688
{
8789
ontologyBuilder.properties ::= property
90+
// Fill the equivalentProperty map
8891
}
8992
}
9093
// TODO: read datatypes
@@ -298,6 +301,8 @@ class OntologyReader
298301
var properties = List[PropertyBuilder]()
299302
var datatypes = List[Datatype]()
300303
var specializedProperties = List[SpecificPropertyBuilder]()
304+
var equivalentPropertiesMap = Map[OntologyProperty,Set[OntologyProperty]] ()
305+
var equivalentClassesMap = Map[OntologyProperty,Set[OntologyProperty]] ()
301306

302307
def build() : Ontology =
303308
{
@@ -308,7 +313,9 @@ class OntologyReader
308313
new Ontology( classes.flatMap(_.build(classMap)).map(c => (c.name, c)).toMap,
309314
properties.flatMap(_.build(classMap, typeMap)).map(p => (p.name, p)).toMap,
310315
datatypes.map(t => (t.name, t)).toMap,
311-
specializedProperties.flatMap(_.build(classMap, propertyMap, typeMap)).toMap )
316+
specializedProperties.flatMap(_.build(classMap, propertyMap, typeMap)).toMap,
317+
equivalentPropertiesMap,
318+
equivalentClassesMap)
312319
}
313320
}
314321

0 commit comments

Comments
 (0)