protected BaseAuthority(Authority definition) { this.definition = definition; for (String p : definition.getInitialProperties()) { Knowledge.createProperty(p, getOntology()); } for (String c : definition.getInitialConcepts()) { Knowledge.createConcept(c, getOntology()); } }
IConcept ret = getOntology().getConcept(getBaseTraitName()); if (ret == null) { ArrayList<IAxiom> ax = new ArrayList<>(); getOntology().define(ax); ret = getOntology().getConcept(getBaseTraitName());
public IConcept createIdentity(String id, String authorityId) { /* * check and if necessary, create the trait in our ontology. TODO we should cache * all the info related to the ID so that online search is minimized. For now we * don't do anything online anyway. */ String cId = getAuthorityId() + "_" + sanitizeID(id); IOntology o = getOntology(); IConcept ret = o.getConcept(cId); if (ret == null) { ArrayList<IAxiom> ax = new ArrayList<>(); ax.add(Axiom.ClassAssertion(cId)); ax.add(Axiom.SubClass(getBaseTrait(id).toString(), cId)); ax.add(Axiom .AnnotationAssertion(cId, NS.AUTHORITY_ID_PROPERTY, getAuthorityId())); /* * TODO get descriptor, add label and other metadata to identify the * authority. */ o.define(ax); ret = o.getConcept(cId); } return ret; }