Package au.csiro.ontology.model

Examples of au.csiro.ontology.model.Concept


            if (factory.isVirtualConcept(key) || NamedConcept.BOTTOM == id) {
                continue;
            }
           
            Concept rhs = getNecessary(contextIndex, taxonomy, key);

            final Concept lhs = new NamedConcept(id);
            if (!lhs.equals(rhs) && !rhs.equals(NamedConcept.TOP_CONCEPT)) { // skip trivial axioms
                inferred.add(new ConceptInclusion(lhs, rhs));
            }
        }

        return inferred;
View Full Code Here


                int valueInt = itr2.next();
                if (!factory.isVirtualConcept(valueInt)) {
                    final String valueId = factory.lookupConceptId(valueInt).toString();
                    result.add(new Existential(role, new NamedConcept(valueId)));
                } else {
                    final Concept valueConcept = getNecessary(contextIndex, taxonomy, valueInt);
                    final Existential x = new Existential(role, Builder.build(no, valueConcept));
                    result.add(x);
                }
            }
        }
View Full Code Here

            final List<Existential> remove = new ArrayList<Existential>();
            boolean subsumed = false;

            for (Existential candidate: items) {
                final Concept value = candidate.getConcept();
                if (!(value instanceof NamedConcept)) {
                    log.debug("WARNING: pass through of nested complex value: " + value);
                    continue;
                }
View Full Code Here

        Set<Inclusion> res = new HashSet<Inclusion>();
       
        for(Axiom aa : axioms) {
            if(aa instanceof ConceptInclusion) {
                ConceptInclusion ci = (ConceptInclusion)aa;
                Concept lhs = ci.getLhs();
                Concept rhs = ci.getRhs();
                res.add(new GCI(transformConcept(lhs), transformConcept(rhs)));
            } else if(aa instanceof RoleInclusion) {
                RoleInclusion ri = (RoleInclusion)aa;
                Role[] lh = ri.getLhs();
                NamedRole[] lhs = new NamedRole[lh.length];
                for(int i = 0; i < lh.length; i++) {
                    lhs[i] = (NamedRole) lh[i];
                }
                NamedRole rhs = (NamedRole) ri.getRhs();
                int[] lhsInt = new int[lhs.length];
                for(int i = 0; i < lhsInt.length; i++) {
                    lhsInt[i] = factory.getRole(lhs[i].getId());
                }
                res.add(new RI(lhsInt, factory.getRole(rhs.getId())));
            }
        }
       
        return res;
    }
View Full Code Here

            }
            return new au.csiro.ontology.model.Conjunction(concepts);
        } else if(o instanceof Existential) {
            Existential e = (Existential)o;
            AbstractConcept c = e.getConcept();
            Concept iconcept = transform(c);
            int role = e.getRole();
            NamedRole irole = new NamedRole(factory.lookupRoleId(role).toString());
            return new au.csiro.ontology.model.Existential(irole, iconcept);
        } else if(o instanceof Datatype) {
            Datatype d = (Datatype) o;
View Full Code Here

        // implementing classes
        Factory f = new Factory();
       
        // The factory returns IConcepts - in this case the actual type is
        // INamedConcept<String>
        Concept endocardium = f.createNamedConcept("Endocardium");
        Concept tissue = f.createNamedConcept("Tissue");
        Concept heartWall = f.createNamedConcept("HeartWall");
        Concept heartValve = f.createNamedConcept("HeartValve");
        Concept bodyWall = f.createNamedConcept("BodyWall");
        Concept heart = f.createNamedConcept("Heart");
        Concept bodyValve = f.createNamedConcept("BodyValve");
        Concept endocarditis = f.createNamedConcept("Endocarditis");
        Concept inflammation = f.createNamedConcept("Inflammation");
        Concept disease = f.createNamedConcept("Disease");
        Concept heartDisease = f.createNamedConcept("HeartDisease");
        Concept criticalDisease = f.createNamedConcept("CriticalDisease");
       
        // The factory can also be used to create roles
        Role actsOn = f.createNamedRole("acts-on");
        Role partOf = f.createNamedRole("part-of");
        Role contIn = f.createNamedRole("cont-in");
        Role hasLoc = f.createNamedRole("has-loc");
       
        // Finally, the factory can be used to create axioms
        Concept lhs = endocardium;
        Concept rhs = f.createConjunction(
                tissue,
                f.createExistential((NamedRole) contIn, heartWall),
                f.createExistential((NamedRole) contIn, heartValve)
        );
        baseAxioms.add(f.createConceptInclusion(lhs, rhs));
       
        lhs = heartWall;
        rhs = f.createConjunction(
                bodyWall,
                f.createExistential((NamedRole) partOf, heart)
        );
        baseAxioms.add(f.createConceptInclusion(lhs, rhs));
       
        lhs = heartValve;
        rhs = f.createConjunction(
                bodyValve,
                f.createExistential((NamedRole) partOf, heart)
        );
        baseAxioms.add(f.createConceptInclusion(lhs, rhs));
       
        lhs = endocarditis;
        rhs = f.createConjunction(
                inflammation,
                f.createExistential((NamedRole) hasLoc, endocardium)
        );
        baseAxioms.add(f.createConceptInclusion(lhs, rhs));

        lhs = inflammation;
        rhs = f.createConjunction(
                disease,
                f.createExistential(actsOn, tissue)
        );
        baseAxioms.add(f.createConceptInclusion(lhs, rhs));
       
        lhs = f.createConjunction(
                heartDisease,
                f.createExistential(hasLoc, heartValve)
        );
        rhs = criticalDisease;
        baseAxioms.add(f.createConceptInclusion(lhs, rhs));
       
        // There is no direct support in the API to create an equivalence axiom
        // so it has to be created using two concept inclusion axioms
        lhs = heartDisease;
        rhs = f.createConjunction(
                disease,
                f.createExistential(hasLoc, heart)
        );
        baseAxioms.add(f.createConceptInclusion(lhs, rhs));
        baseAxioms.add(f.createConceptInclusion(rhs, lhs));
       
        Role[] rlhs = new Role[]{partOf, partOf};
        Role rrhs = partOf;
        baseAxioms.add(f.createRoleInclusion(rlhs, rrhs));
       
        rlhs = new Role[]{partOf};
        rrhs = contIn;
        baseAxioms.add(f.createRoleInclusion(rlhs, rrhs));
       
        rlhs = new Role[]{hasLoc, contIn};
        rrhs = hasLoc;
        baseAxioms.add(f.createRoleInclusion(rlhs, rrhs));
       
        // The first time the classify method is called it runs a full
        // classification
        reasoner.loadAxioms(baseAxioms);
        reasoner.classify();
       
        // If classification worked properly then Endocarditis should be
        // classified not only as an Inflammation but also as a HeartDisease
        // and a CriticalDisease
        Ontology t = reasoner.getClassifiedOntology();
       
        // We use the same id that was used to create the concept to look for
        // the corresponding node in the taxonomy
        Node endocarditisNode = t.getNode("Endocarditis");
        System.out.println("Node for endocarditis:\n  "+
                endocarditisNode.getEquivalentConcepts());
       
       
        // We can now print the equivalent concepts in the node and the parent
        // nodes
        Set<Node> parentNodes = endocarditisNode.getParents();
        System.out.println("Parents of endocarditis:");
        for(Node parentNode : parentNodes) {
            System.out.println("  "+parentNode.getEquivalentConcepts());
        }
       
        // We can now add more axioms to the ontology and re-run the
        // classification
        Set<Axiom> additionalAxioms = new HashSet<Axiom>();
       
        Concept heartInflammation = f.createNamedConcept("HeartInflammation");
       
        lhs = heartInflammation;
        rhs = inflammation;
        additionalAxioms.add(f.createConceptInclusion(lhs, rhs));
       
View Full Code Here

        // implementing classes
        Factory f = new Factory();
       
        // The factory returns IConcepts - in this case the actual type is
        // INamedConcept<String>
        Concept nonCardiacChestPain = f.createNamedConcept("274668005");
        Concept duringExcersice = f.createNamedConcept("309604004");
        Concept interview = f.createNamedConcept("108217004");
        Concept present = f.createNamedConcept("52101004");
       
        // The factory can also be used to create roles
        Role associatedWith = f.createNamedRole("47429007");
       
        // We need to define exactly what the identifier for the new concept
        // will be
        Concept historyCardioStandardNonAnginalChestPainExertion = f.createNamedConcept("pce_24220");
       
        // This is the axiom created for the discernable
        axioms.add(
            f.createConceptInclusion(
                historyCardioStandardNonAnginalChestPainExertion,
View Full Code Here

        System.out.println("Adding test axiom");
        Factory f = new Factory();
        String newId = UUID.randomUUID().toString();
        uuidToDescMap.put(newId, "Special Appendicits");
       
        Concept specialAppendicitis = f.createNamedConcept(newId);
        String appendicitsUuid = "55450fab-6786-394d-89f9-a0fd44bd7e7e";
        Concept appendicitis = f.createNamedConcept(appendicitsUuid);
        Axiom a1 = f.createConceptInclusion(specialAppendicitis, appendicitis);
        Set<Axiom> axioms = new HashSet<Axiom>();
        axioms.add(a1);
       
        // 4. Classify incrementally
View Full Code Here

    public static void bottlesExample() {
        // A factory is used to create expressions and axioms
        Factory f = new Factory();
       
        // Create all the concepts
        Concept bottle = f.createNamedConcept("bottle");
        Concept plasticBottle = f.createNamedConcept("plasticBottle");
        Concept glassBottle = f.createNamedConcept("glassBottle");
        Concept purplePlasticBottle = f.createNamedConcept("purplePlasticBottle");
        Concept plastic = f.createNamedConcept("plastic");
        Concept tallBottle = f.createNamedConcept("tallBottle");
        Concept wideBottle = f.createNamedConcept("wideBottle");
        Concept wineBottle = f.createNamedConcept("wineBottle");
       
        // Create all the roles
        Role isMadeOf = f.createNamedRole("isMadeOf");
       
        // Create all the features
View Full Code Here

            }
            return new Conjunction(conjs.toArray(new Concept[conjs.size()]));
        } else if(obj instanceof au.csiro.snorocket.core.model.Existential) {
            au.csiro.snorocket.core.model.Existential ex = (au.csiro.snorocket.core.model.Existential) obj;
            String roleId = (String) factory.lookupRoleId(ex.getRole());
            Concept con = transformToModel(ex.getConcept());
            return new Existential(new NamedRole(roleId), con);
        } else if(obj instanceof au.csiro.snorocket.core.model.Datatype) {
            au.csiro.snorocket.core.model.Datatype dt = (au.csiro.snorocket.core.model.Datatype) obj;
            String featureId = factory.lookupFeatureId(dt.getFeature());
            Literal l = transformLiteralToModel(dt.getLiteral());
View Full Code Here

TOP

Related Classes of au.csiro.ontology.model.Concept

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.