Package au.csiro.snorocket.core

Examples of au.csiro.snorocket.core.NormalisedOntology$Pair


        // Classify ontology from stated form
        System.out.println("Classifying base ontology");

        IFactory factory = new CoreFactory();
        NormalisedOntology no = new NormalisedOntology(factory);
        System.out.println("Importing axioms");
        InputStream conceptsFile = this.getClass().getResourceAsStream("/"+conceptsBase);
        InputStream relsFile = this.getClass().getResourceAsStream("/"+relsBase);
        RF1Importer imp = new RF1Importer(conceptsFile, relsFile, version);
       
        Iterator<Ontology> it = imp.getOntologyVersions(new NullProgressMonitor());
       
        Ontology ont = null;
        while(it.hasNext()) {
            Ontology o = it.next();
            if(o.getVersion().equals("snomed")) {
                ont = o;
                break;
            }
        }
       
        if(ont == null) {
            System.out.println("Could not find version " + version + " in input files");
        }
        System.out.println("Loading axioms");
        no.loadAxioms(new HashSet<Axiom>(ont.getStatedAxioms()));
        System.out.println("Running classification");
        no.classify();
        System.out.println("Computing taxonomy");
        no.buildTaxonomy();
        System.out.println("Done");

        // If a relationship that is part of a role group is added incrementally
        // on its own then it will not be added to the correct role group
        // because that information is missing. Therefore care must be taken to
        // remove all relationships that belong to a role group when deriving
        // a test case for incremental classification using RF1.

        System.out.println("Running incremental classification");
        imp = new RF1Importer(
                this.getClass().getResourceAsStream("/"+conceptsInc),
                this.getClass().getResourceAsStream("/"+relsInc),
                version);

        long start = System.currentTimeMillis();
        System.out.println("Transforming axioms");
       
        it = imp.getOntologyVersions(new NullProgressMonitor());
       
        ont = null;
        while(it.hasNext()) {
            Ontology o = it.next();
            if(o.getVersion().equals("snomed")) {
                ont = o;
                break;
            }
        }
       
        res.setAxiomTransformationTimeMs(System.currentTimeMillis() - start);
        start = System.currentTimeMillis();
        System.out.println("Running classification");
        no.loadIncremental(new HashSet<Axiom>((Collection<? extends Axiom>) ont.getStatedAxioms()));
        no.classifyIncremental();
        res.setClassificationTimeMs(System.currentTimeMillis() - start);
        start = System.currentTimeMillis();
        System.out.println("Computing taxonomy");
        no.buildTaxonomy();
        res.setTaxonomyBuildingTimeMs(System.currentTimeMillis() - start);

        return res;
    }
View Full Code Here


       
        // Classify ontology from stated form
        System.out.println("Classifying ontology");
        long start = System.currentTimeMillis();
        IFactory factory = new CoreFactory();
        NormalisedOntology no = new NormalisedOntology(factory);
        System.out.println("Importing axioms");
       
        RF1Importer imp = new RF1Importer(
                this.getClass().getResourceAsStream(
                        "/sct1_Concepts_Core_INT_20110731.txt"),
                this.getClass().getResourceAsStream(
                        "/res1_StatedRelationships_Core_INT_20110731.txt"),
                version);
       
        Iterator<Ontology> it = imp.getOntologyVersions(new NullProgressMonitor());
       
        Ontology ont = null;
        while(it.hasNext()) {
            Ontology o = it.next();
            if(o.getVersion().equals("snomed")) {
                ont = o;
                break;
            }
        }

        // We can do this because we know there is only one ontology (RF1 does
        // not support multiple versions)
        if(ont == null) {
            System.out.println("Could not find version "+version+
                    " in input files");
        }
        res.setAxiomTransformationTimeMs(System.currentTimeMillis() - start);
        start = System.currentTimeMillis();
        System.out.println("Loading axioms");
        no.loadAxioms(new HashSet<Axiom>((Collection<? extends Axiom>) ont.getStatedAxioms()));
        res.setAxiomLoadingTimeMs(System.currentTimeMillis() - start);
        start = System.currentTimeMillis();
        System.out.println("Running classification");
        no.classify();
        res.setClassificationTimeMs(System.currentTimeMillis() - start);
        start = System.currentTimeMillis();
        System.out.println("Computing taxonomy");
        no.buildTaxonomy();
        res.setTaxonomyBuildingTimeMs(System.currentTimeMillis() - start);
        System.out.println("Done");

        return res;
    }
View Full Code Here

TOP

Related Classes of au.csiro.snorocket.core.NormalisedOntology$Pair

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.