All Downloads are FREE. Search and download functionalities are using the official Maven repository.

uk.ac.manchester.cs.factplusplusad.AOStructure Maven / Gradle / Ivy

There is a newer version: 5.5.1
Show newest version
package uk.ac.manchester.cs.factplusplusad;

import java.util.HashSet;
import java.util.List;
import java.util.Set;
import java.util.stream.Stream;
import org.semanticweb.owlapitools.decomposition.OntologyAtom;

/**
 * atomical ontology structure
 */
class AOStructure {

    List atoms;

    /**
     * @return create a new atom and get a pointer to it
     */
    OntologyAtom newAtom() {
        OntologyAtom ret = new OntologyAtom();
        ret.setId(atoms.size());
        atoms.add(ret);
        return ret;
    }

    /**
     * reduce graph of the atoms in the structure
     */
    void reduceGraph() {
        Set checked = new HashSet<>();
        atoms.forEach(p -> p.getAllDepAtoms(checked));
    }

    Stream begin() {
        return atoms.stream();
    }

    /**
     * @param i index
     * @return RW atom by its index
     */
    OntologyAtom get(int i) {
        return atoms.get(i);
    }

    /**
     * @return size of the structure
     */
    int size() {
        return atoms.size();
    }
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy