Package au.csiro.snorocket.core.model

Examples of au.csiro.snorocket.core.model.Datatype


            } else if (rhs instanceof Existential) {
                final Existential existential = (Existential) rhs;
                result = NF2.getInstance(lhs.hashCode(), existential.getRole(),
                        existential.getConcept().hashCode());
            } else if (rhs instanceof Datatype) {
                final Datatype datatype = (Datatype) rhs;
                result = NF7.getInstance(lhs.hashCode(), datatype);
            } else {
                throw new IllegalStateException("GCI is not in Normal Form: " +
                    "lhs is Concept but rhs is neither Concept, " +
                    "Existential nor Datatype; it is " + rhs);
            }
        } else if (lhs instanceof Conjunction) {
            final Conjunction conjunction = (Conjunction) lhs;
            final AbstractConcept[] concepts = conjunction.getConcepts();
            if (concepts.length == 1) {
                result = NF1a.getInstance(concepts[0].hashCode(),
                        rhs.hashCode());
            } else if (concepts.length == 2) {
                result = NF1b.getInstance(concepts[0].hashCode(),
                        concepts[1].hashCode(), rhs.hashCode());
            } else {
                throw new IllegalStateException(
                        "Conjunction should have exactly one or two "
                                + "Concepts not " + concepts.length + ": "
                                + conjunction);
            }
        } else if (lhs instanceof Existential) {
            Existential existential = (Existential) lhs;
            result = NF3.getInstance(existential.getRole(), existential
                    .getConcept().hashCode(), rhs.hashCode());
        } else if (lhs instanceof Datatype) {
            Datatype datatype = (Datatype) lhs;
            result = NF8.getInstance(datatype, rhs.hashCode());
        } else {
            throw new IllegalStateException("GCI is not in Normal Form: "
                    + lhs + ", " + rhs);
        }
View Full Code Here


        for(final IntIterator itr = ontologyNF7.keyIterator(); itr.hasNext();) {
            MonotonicCollection<NF7> nf7s = ontologyNF7.get(itr.next());
            for(final Iterator<NF7> itr2 = nf7s.iterator(); itr2.hasNext();) {
                NF7 nf7 = itr2.next();
               
                Datatype rhs = nf7.getD();
                if(!containsDatatypeInNF8s(rhs)) {
                    NF8 nnf = NF8.getInstance(rhs, factory.getConcept(rhs));
                    //as.addAxiom(nnf); // Needed for incremental
                    addTerm(nnf);
                    numNf8++;
View Full Code Here

                cons[i] = transformConcept(modelCons[i]);
            }
            return new Conjunction(cons);
        } else if(c instanceof au.csiro.ontology.model.Datatype) {
            au.csiro.ontology.model.Datatype dt = (au.csiro.ontology.model.Datatype) c;
            return new Datatype(factory.getFeature(((NamedFeature) dt.getFeature()).getId()), dt.getOperator(),
                    transformLiteral(dt.getLiteral()));
        } else if(c instanceof au.csiro.ontology.model.Existential) {
            au.csiro.ontology.model.Existential e = (au.csiro.ontology.model.Existential) c;
            return new Existential(factory.getRole(((NamedRole) e.getRole()).getId()),
                    transformConcept(e.getConcept()));
View Full Code Here

            AbstractConcept c = e.getConcept();
            int role = e.getRole();
            return factory.lookupRoleId(role)+"."+printInternalObject(c);
        } else if(o instanceof Datatype) {
            StringBuilder sb = new StringBuilder();
            Datatype d = (Datatype)o;
            String feature = factory.lookupFeatureId(d.getFeature());
            sb.append(feature.toString());
            sb.append(".(");
            AbstractLiteral literal = d.getLiteral();
            sb.append(literal);
            sb.append(")");
            return sb.toString();
        } else if(o instanceof Concept) {
            Object obj = factory.lookupConceptId(((Concept)o).hashCode());
View Full Code Here

            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;
            String feature = factory.lookupFeatureId(d.getFeature());
            AbstractLiteral literal = d.getLiteral();
           
            if(literal instanceof DateLiteral) {
                return new au.csiro.ontology.model.Datatype(new NamedFeature(feature), d.getOperator(),
                        new au.csiro.ontology.model.DateLiteral(((DateLiteral) literal).getValue()));
            } else if(literal instanceof DecimalLiteral) {
                return new au.csiro.ontology.model.Datatype(new NamedFeature(feature), d.getOperator(),
                        new au.csiro.ontology.model.DecimalLiteral(((DecimalLiteral) literal).getValue()));
            } else if(literal instanceof IntegerLiteral) {
                return new au.csiro.ontology.model.Datatype(new NamedFeature(feature), d.getOperator(),
                        new au.csiro.ontology.model.IntegerLiteral(((IntegerLiteral) literal).getValue()));
            } else if(literal instanceof StringLiteral) {
                return new au.csiro.ontology.model.Datatype(new NamedFeature(feature), d.getOperator(),
                        new au.csiro.ontology.model.StringLiteral(((StringLiteral) literal).getValue()));
            } else {
                throw new RuntimeException("Unexpected literal " + literal.getClass().getName());
            }
           
View Full Code Here

            MonotonicCollection<NF7> entries = ontologyNF7.get(key);
           
            for(Iterator<NF7> it2 = entries.iterator(); it2.hasNext(); ) {
                NF7 nf7 = it2.next();
                int aId = nf7.lhsA;
                Datatype dt = nf7.rhsD;
                int fId = dt.getFeature();
               
                Object a = factory.lookupConceptId(aId);
                String as = (a instanceof String) ? (String) a : "[" + a.toString() + "]";
                String f = factory.lookupFeatureId(fId);
               
                System.out.println("NF7: " + as + " [ " + f + ".(" + dt.getLiteral() +")");
            }
        }
       
        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();
                Datatype dt = nf8.lhsD;
                int bId = nf8.rhsB;
                int fId = dt.getFeature();
               
                Object b = factory.lookupConceptId(bId);
                String bs = (b instanceof String) ? (String) b : "[" + b.toString() + "]";
                String f = factory.lookupFeatureId(fId);
               
                System.out.println("NF8: " + f + ".(" + dt.getLiteral() +")" + " [ " + bs);
            }
        }
       
    }
View Full Code Here

            if (!featureQueue.isEmpty()) {
                do {
                    done = false;
                    final IFeatureQueueEntry entry = featureQueue.remove();

                    Datatype d = entry.getD();

                    // Get right hand sides from NF8 expressions that
                    // match d on their left hand side
                    MonotonicCollection<NF8> entries = ontologyNF8.get(d.getFeature());

                    if (entries == null)
                        continue;

                    // Evaluate to determine the ones that match
                    MonotonicCollection<IConjunctionQueueEntry> res =
                            new MonotonicCollection<IConjunctionQueueEntry>(2);
                    for (final NF8 e : entries) {
                        Datatype d2 = e.lhsD;

                        // If they match add a conjunction queue entry
                        // to queueA
                        if (datatypeMatches(d, d2)) {
                            res.add(new IConjunctionQueueEntry() {
View Full Code Here

            if (!featureQueue.isEmpty()) {
                do {
                    done = false;
                    final IFeatureQueueEntry entry = featureQueue.remove();

                    Datatype d = entry.getD();

                    // Get right hand sides from NF8 expressions that
                    // match d on their left hand side
                    MonotonicCollection<NF8> entries =
                            ontologyNF8.get(d.getFeature());

                    if (entries == null)
                        continue;

                    // Evaluate to determine the ones that match
                    MonotonicCollection<IConjunctionQueueEntry> res =
                            new MonotonicCollection<IConjunctionQueueEntry>(2);
                    for (final NF8 e : entries) {
                        Datatype d2 = e.lhsD;

                        // If they match add a conjunction queue entry
                        // to queueA
                        if (datatypeMatches(d, d2)) {
                            res.add(new IConjunctionQueueEntry() {
View Full Code Here

            if (!featureQueue.isEmpty()) {
                do {
                    done = false;
                    final IFeatureQueueEntry entry = featureQueue.remove();

                    Datatype d = entry.getD();

                    // Get right hand sides from NF8 expressions that
                    // match d on their left hand side
                    MonotonicCollection<NF8> entries = ontologyNF8.get(d.getFeature());

                    if (entries == null)
                        continue;

                    // Evaluate to determine the ones that match
                    MonotonicCollection<IConjunctionQueueEntry> res =
                            new MonotonicCollection<IConjunctionQueueEntry>(2);
                    for (final NF8 e : entries) {
                        Datatype d2 = e.lhsD;

                        // If they match add a conjunction queue entry
                        // to queueA
                        if (datatypeMatches(d, d2)) {
                            res.add(new IConjunctionQueueEntry() {
View Full Code Here

            if (!featureQueue.isEmpty()) {
                do {
                    done = false;
                    final IFeatureQueueEntry entry = featureQueue.remove();

                    Datatype d = entry.getD();

                    // Get right hand sides from NF8 expressions that
                    // match d on their left hand side
                    MonotonicCollection<NF8> entries =
                            ontologyNF8.get(d.getFeature());

                    if (entries == null)
                        continue;

                    // Evaluate to determine the ones that match
                    MonotonicCollection<IConjunctionQueueEntry> res =
                            new MonotonicCollection<IConjunctionQueueEntry>(2);
                    for (final NF8 e : entries) {
                        Datatype d2 = e.lhsD;

                        // If they match add a conjunction queue entry
                        // to queueA
                        if (datatypeMatches(d, d2)) {
                            res.add(new IConjunctionQueueEntry() {
View Full Code Here

TOP

Related Classes of au.csiro.snorocket.core.model.Datatype

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.