Package au.csiro.ontology.model

Examples of au.csiro.ontology.model.ConceptInclusion


    public static Concept createDatatype(Feature feature, Operator operator, Literal literal) {
        return new Datatype(feature, operator, literal);
    }

    public static Axiom createConceptInclusion(Concept lhs, Concept rhs) {
        return new ConceptInclusion(lhs, rhs);
    }
View Full Code Here


        Feature hasWidth = f.createNamedFeature("hasWidth");
       
        Set<Axiom> axioms = new HashSet<Axiom>();
       
        // This is an example of a primitive child with no roles.
        Axiom a0 = new ConceptInclusion(glassBottle, bottle);
        axioms.add(a0);
       
        // This is an example of a fully defined child with one role. In this
        // case two axioms are needed because the API does not support
        // equivalence directly.
        Axiom a1 = new ConceptInclusion(
                plasticBottle,
                f.createConjunction(
                        bottle,
                        f.createExistential(isMadeOf, plastic)
                )
        );
        Axiom a1b = new ConceptInclusion(
                f.createConjunction(
                        bottle,
                        f.createExistential(isMadeOf, plastic)
                ),
                plasticBottle
        );
        axioms.add(a1);
        axioms.add(a1b);
       
        // This is an example of a primitive child with no roles
        Axiom a2 = new ConceptInclusion(
                purplePlasticBottle,
                plasticBottle
        );
        axioms.add(a2);
       
        // This is an example of a fully defined child with a concrete domain
        Axiom a3 = new ConceptInclusion(
                tallBottle,
                f.createConjunction(
                        bottle,
                        f.createDatatype(
                                hasHeight,
                                Operator.GREATER_THAN,
                                f.createIntegerLiteral(5))
                )
        );
       
        Axiom a3b = new ConceptInclusion(
                f.createConjunction(
                        bottle,
                        f.createDatatype(
                                hasHeight,
                                Operator.GREATER_THAN,
                                f.createIntegerLiteral(5))
                ),
                tallBottle
        );
        axioms.add(a3);
        axioms.add(a3b);
       
        // This is another example of a fully defined child with a concrete
        // domain
        Axiom a4 = new ConceptInclusion(
                wideBottle,
                f.createConjunction(
                        bottle,
                        f.createDatatype(
                                hasWidth,
                                Operator.GREATER_THAN,
                                f.createIntegerLiteral(5))
                )
        );
       
        Axiom a4b = new ConceptInclusion(
                f.createConjunction(
                        bottle,
                        f.createDatatype(
                                hasWidth,
                                Operator.GREATER_THAN,
                                f.createIntegerLiteral(5))
                ),
                wideBottle
        );
        axioms.add(a4);
        axioms.add(a4b);
       
        // Yet another example of a fully defined child with a concrete domain
        Axiom a5 = new ConceptInclusion(
                wineBottle,
                f.createConjunction(
                        glassBottle,
                        f.createDatatype(
                                hasWidth,
                                Operator.EQUALS,
                                f.createIntegerLiteral(2)),
                        f.createDatatype(
                                hasHeight,
                                Operator.EQUALS,
                                f.createIntegerLiteral(6))
                )
        );
        Axiom a5b = new ConceptInclusion(
                f.createConjunction(
                        glassBottle,
                        f.createDatatype(
                                hasWidth,
                                Operator.EQUALS,
View Full Code Here

           
            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

    private Set<Inclusion> transformAxiom(final Set<? extends Axiom> axioms) {
        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];
View Full Code Here

                int b = nf1.getB();
                // Build the axiom
                Object oa = factory.lookupConceptId(a);
                Object ob = factory.lookupConceptId(b);
                if(bi == IFactory.TOP_CONCEPT) {
                    res.add(new ConceptInclusion(transform(oa), transform(ob)));
                } else {
                    Object obi = factory.lookupConceptId(bi);
                    res.add(new ConceptInclusion(
                        new au.csiro.ontology.model.Conjunction(
                            new Concept[] {transform(oa), transform(obi)}), transform(ob)
                    ));
                }
            }
        }
       
        // These terms are of the form A [ r.B and are indexed by A.
        for(IntIterator it = ontologyNF2.keyIterator(); it.hasNext(); ) {
            int a = it.next();
            MonotonicCollection<NF2> mc = ontologyNF2.get(a);
            for(Iterator<NF2> it2 = mc.iterator(); it2.hasNext(); ) {
                NF2 nf2 = it2.next();
                Object oa = factory.lookupConceptId(nf2.lhsA);
                String r = factory.lookupRoleId(nf2.rhsR).toString();
                Object ob = factory.lookupConceptId(nf2.rhsB);
                res.add(new ConceptInclusion(
                    transform(oa),
                    new au.csiro.ontology.model.Existential(new NamedRole(r), transform(ob))
                ));
            }
        }
       
        // These terms are of the form r.A [ b and indexed by A.
        for(IntIterator it = ontologyNF3.keyIterator(); it.hasNext(); ) {
            int a = it.next();
            ConcurrentMap<Integer, Collection<IConjunctionQueueEntry>> mc =
                    ontologyNF3.get(a);
            Set<Integer> keys = mc.keySet();
            for (int i : keys) {
                Collection<IConjunctionQueueEntry> cc = mc.get(i);
                for(Iterator<IConjunctionQueueEntry> it2 = cc.iterator();
                        it2.hasNext(); ) {
                    IConjunctionQueueEntry nf3 = it2.next();
                    Object oa = factory.lookupConceptId(a);
                    String r = factory.lookupRoleId(i).toString();
                    Object ob = factory.lookupConceptId(nf3.getB());
                    res.add(new ConceptInclusion(
                        new au.csiro.ontology.model.Existential(new NamedRole(r), transform(ob)),
                        transform(oa
                    ));
                }
            }
        }
       
        for(Iterator<NF4> it = ontologyNF4.iterator(); it.hasNext(); ) {
            NF4 nf4 = it.next();
            int r = nf4.getR();
            int s = nf4.getS();
           
            res.add(
                new RoleInclusion(
                    new NamedRole(factory.lookupRoleId(r).toString()),
                    new NamedRole(factory.lookupRoleId(s).toString())
                )
            );
        }
       
        for(Iterator<NF5> it = ontologyNF5.iterator(); it.hasNext(); ) {
            NF5 nf5 = it.next();
            int r = nf5.getR();
            int s = nf5.getS();
            int t = nf5.getT();
           
            res.add(
                new RoleInclusion(
                    new Role[] {
                            new NamedRole(factory.lookupRoleId(r).toString()),
                            new NamedRole(factory.lookupRoleId(s).toString())
                    },
                    new NamedRole(factory.lookupRoleId(t).toString())
                )
            );
        }
       
        for(IntIterator it = reflexiveRoles.iterator(); it.hasNext(); ) {
            int r = it.next();
            res.add(
                new RoleInclusion(
                    new Role[] {},
                    new NamedRole(factory.lookupRoleId(r).toString())
                )
            );
        }
       
        // These terms are of the form A [ f.(o, v) and are indexed by A.
        for(IntIterator it = ontologyNF7.keyIterator(); it.hasNext(); ) {
            int a = it.next();
            MonotonicCollection<NF7> mc = ontologyNF7.get(a);
            for(Iterator<NF7> it2 = mc.iterator(); it2.hasNext(); ) {
                NF7 nf7 = it2.next();
                res.add(new ConceptInclusion(
                    transform(factory.lookupConceptId(a)),
                    transform(nf7.rhsD)
                ));
            }
        }
       
        // These terms are of the form f.(o, v) [ A. These are indexed by f.
        FeatureSet keys = ontologyNF8.keySet();
        for (int i = keys.nextSetBit(0); i >= 0; i = keys.nextSetBit(i+1)) {
            MonotonicCollection<NF8> mc = ontologyNF8.get(i);
            for(Iterator<NF8> it2 = mc.iterator(); it2.hasNext(); ) {
                NF8 nf8 = it2.next();
                res.add(new ConceptInclusion(
                    transform(nf8.lhsD),
                    transform(factory.lookupConceptId(nf8.rhsB))
                ));
            }
        }
View Full Code Here

TOP

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

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.