Commit 2621e44d authored by R.W.Majeed's avatar R.W.Majeed
Browse files

configurable hasPart relation

parent 8a78cf19
...@@ -51,8 +51,8 @@ public class Store implements Ontology, Plugin { ...@@ -51,8 +51,8 @@ public class Store implements Ontology, Plugin {
private Resource scheme; private Resource scheme;
private String[] registeredPrefixes; private String[] registeredPrefixes;
private String[] registeredNamespaces; private String[] registeredNamespaces;
private URI hasPartRelation;
/// XXX namespace resolver
/** /**
* Plugin constructor which accepts configuration parameters. * Plugin constructor which accepts configuration parameters.
* *
...@@ -176,6 +176,8 @@ public class Store implements Ontology, Plugin { ...@@ -176,6 +176,8 @@ public class Store implements Ontology, Plugin {
inferred += inferInverseRelations(SKOS.BROADER, SKOS.NARROWER); inferred += inferInverseRelations(SKOS.BROADER, SKOS.NARROWER);
inferred += inferInverseRelations(SKOS.NARROWER, SKOS.BROADER); inferred += inferInverseRelations(SKOS.NARROWER, SKOS.BROADER);
inferred += inferInverseRelations(HIStreamOntology.DWH_IS_PART_OF, HIStreamOntology.DWH_HAS_PART); inferred += inferInverseRelations(HIStreamOntology.DWH_IS_PART_OF, HIStreamOntology.DWH_HAS_PART);
// set default relations
this.hasPartRelation = HIStreamOntology.DWH_HAS_PART;
// TODO a isPartOf b -> b hasPart a // TODO a isPartOf b -> b hasPart a
if( inferred != 0 ){ if( inferred != 0 ){
log.fine("Inferred "+inferred+" statements."); log.fine("Inferred "+inferred+" statements.");
...@@ -237,7 +239,7 @@ public class Store implements Ontology, Plugin { ...@@ -237,7 +239,7 @@ public class Store implements Ontology, Plugin {
return getRelatedConcepts(concept.getResource(), SKOS.NARROWER); return getRelatedConcepts(concept.getResource(), SKOS.NARROWER);
} }
Concept[] getParts(ConceptImpl concept, boolean inherited)throws OntologyException{ Concept[] getParts(ConceptImpl concept, boolean inherited)throws OntologyException{
return getRelatedConcepts(concept.getResource(), HIStreamOntology.DWH_HAS_PART); return getRelatedConcepts(concept.getResource(), hasPartRelation);
} }
public void printTopConcepts() throws OntologyException{ public void printTopConcepts() throws OntologyException{
...@@ -261,6 +263,18 @@ public class Store implements Ontology, Plugin { ...@@ -261,6 +263,18 @@ public class Store implements Ontology, Plugin {
} }
public void setPartOfRelations(URI hasPart, URI inverseHasPart) throws RepositoryException{
if( inverseHasPart != null ){
inferInverseRelations(inverseHasPart, hasPart);
}
this.hasPartRelation = hasPart;
}
/**
* Set namespace prefixes to be used to shorten concept IDs.
* @param namespaces namespace names
* @param prefixes prefixes for the namespaces
*/
public void setNamespacePrefixes(String[] namespaces, String prefixes[]){ public void setNamespacePrefixes(String[] namespaces, String prefixes[]){
// TODO order namespaces by length // TODO order namespaces by length
this.registeredNamespaces = namespaces; this.registeredNamespaces = namespaces;
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment