Package au.csiro.ontology.importer

Examples of au.csiro.ontology.importer.ImportException


                    "file. (input type = "+inputType+", file="+md+")";
            try {
                iss.add(input.getInputStream(md));
            } catch (NullPointerException e) {
                log.error(message, e);
                throw new ImportException(message, e);
            } catch (IOException e) {
                log.error(message, e);
                throw new ImportException(message, e);
            }
        }

        IModuleDependencyRefset res = RefsetImporter.importModuleDependencyRefset(iss);
        return res;
View Full Code Here


                    }
                }
            }
        } catch (Throwable t) {
            log.error(t);
            throw new ImportException("Unable to load reference set file. Please check your input configuration file " +
                    "(input type = " + input.getInputType() + ", file=" + refsetFile + ")");
        } finally {
            for (String moduleId : unknownModules) {
                log.warn("Refset: No version information known for " + moduleId + " found in " + refsetFile);
            }
View Full Code Here

                    "(input type = "+inputType+", file="+conceptsFile+")";
            try {
                loadConceptRows(modMap, conceptMap, input.getInputStream(conceptsFile));
            } catch (NullPointerException e) {
                log.error(message, e);
                throw new ImportException(message, e);
            } catch (IOException e) {
                log.error(message, e);
                throw new ImportException(message, e);
            }
        }

        // Load relationships
        Set<String> relationshipsFiles = input.getStatedRelationshipsFiles();
        if(relationshipsFiles == null || relationshipsFiles.isEmpty()) {
            log.info("Read inferred relationships info");
            relationshipsFiles = input.getRelationshipsFiles();
        } else {
            log.info("Read stated relationships info");
        }

        if(relationshipsFiles == null || relationshipsFiles.isEmpty()) {
            throw new ImportException("No relationships files was specified.");
        }

        for(String relationshipsFile : relationshipsFiles) {
            final String message = "Unable to load relationships file. Please check your input configuration " +
                    "file. (input type = " + inputType+", file=" + relationshipsFile+")";
            try {
                loadRelationshipRows(modMap, relationshipMap, input.getInputStream(relationshipsFile));
            } catch (NullPointerException e) {
                log.error(message, e);
                throw new ImportException(message, e);
            } catch (IOException e) {
                log.error(message, e);
                throw new ImportException(message, e);
            }

            // Load concrete domains refsets
            log.info("Read concrete domains reference set info");
            for (String filename : input.getConcreteDomainRefsetFiles()) {
                try {
                    loadReferenceSet(input, filename, modMap, cdMap, IRefsetFactory.CD);
                } catch (ArrayIndexOutOfBoundsException e) {
                    final String msg = "Error loading concrete domains reference set: " + filename +
                            ". Possibly has wrong number of columns.";
                    log.error(msg, e);
                    throw new ImportException(msg, e);
                }
            }
        }

        VersionRows vr = new VersionRows(conceptMap.values(), relationshipMap.values(), cdMap.values());
View Full Code Here

            // 1. Load module dependencies
            log.info("Loading module dependencies");
            IModuleDependencyRefset mdr = loadModuleDependencies(in);

            if(mdr == null) {
                throw new ImportException("Couldn't load module dependency reference set for RF2 input files.");
            }

            // Each map entry contains a map of modules indexed by version
            Map<String, Map<String, ModuleDependency>> deps =
                    mdr.getModuleDependencies();
View Full Code Here

                                        cols[1], active , cols[3], cols[4],
                                        cols[5], cols[6], cols[7]);
                        members.add(m);
                    }
                } else {
                    throw new ImportException("Malformed module dependency reference set with " + cols.length + " columns "+Arrays.asList(cols));
                }
            } catch (IOException e) {
                log.error("Problem reading refset file "+refsetFile, e);
                throw new ImportException("Problem reading refset file ", e);
            } finally {
                if(br != null) {
                    try { br.close(); } catch(Exception e) {}
                }
            }
View Full Code Here

                    "file. (input type = "+inputType+", file="+md+")";
            try {
                iss.add(input.getInputStream(md));
            } catch (NullPointerException e) {
                log.error(message, e);
                throw new ImportException(message, e);
            } catch (IOException e) {
                log.error(message, e);
                throw new ImportException(message, e);
            }
        }

        IModuleDependencyRefset res = RefsetImporter.importModuleDependencyRefset(iss);
        return res;
View Full Code Here

                    }
                }
            }
        } catch (Throwable t) {
            log.error(t);
            throw new ImportException("Unable to load reference set file. Please check your input configuration file " +
                    "(input type = " + input.getInputType() + ", file=" + refsetFile + ")");
        } finally {
            for (String moduleId : unknownModules) {
                log.warn("Refset: No version information known for " + moduleId + " found in " + refsetFile);
            }
View Full Code Here

                    "(input type = "+inputType+", file="+conceptsFile+")";
            try {
                loadConceptRows(modMap, conceptMap, input.getInputStream(conceptsFile));
            } catch (NullPointerException e) {
                log.error(message, e);
                throw new ImportException(message, e);
            } catch (IOException e) {
                log.error(message, e);
                throw new ImportException(message, e);
            }
        }

        // Load relationships
        Set<String> relationshipsFiles = input.getStatedRelationshipsFiles();
        if(relationshipsFiles == null || relationshipsFiles.isEmpty()) {
            relationshipsFiles = input.getRelationshipsFiles();
            log.info("Reading inferred relationships info: " + relationshipsFiles.size());
        } else {
            log.info("Reading stated relationships info: " + relationshipsFiles.size());
        }

        if(relationshipsFiles == null || relationshipsFiles.isEmpty()) {
            throw new ImportException("No relationships files was specified.");
        }

        for(String relationshipsFile : relationshipsFiles) {
            final String message = "Unable to load relationships file. Please check your input configuration " +
                    "file. (input type = " + inputType+", file=" + relationshipsFile+")";
            try {
                loadRelationshipRows(modMap, relationshipMap, input.getInputStream(relationshipsFile));
            } catch (NullPointerException e) {
                log.error(message, e);
                throw new ImportException(message, e);
            } catch (IOException e) {
                log.error(message, e);
                throw new ImportException(message, e);
            }

            // Load concrete domains refsets
            final Set<String> concreteDomainRefsetFiles = input.getConcreteDomainRefsetFiles();
            log.info("Reading concrete domains reference set info: " + concreteDomainRefsetFiles.size());
            for (String filename : concreteDomainRefsetFiles) {
                try {
                    loadReferenceSet(input, filename, modMap, cdMap, IRefsetFactory.CD);
                } catch (ArrayIndexOutOfBoundsException e) {
                    final String msg = "Error loading concrete domains reference set: " + filename +
                            ". Possibly has wrong number of columns.";
                    log.error(msg, e);
                    throw new ImportException(msg, e);
                }
            }
        }

        VersionRows vr = new VersionRows(conceptMap.values(), relationshipMap.values(), cdMap.values());
View Full Code Here

            // 1. Load module dependencies
            log.info("Loading module dependencies");
            IModuleDependencyRefset mdr = loadModuleDependencies(in);

            if(mdr == null) {
                throw new ImportException("Couldn't load module dependency reference set for RF2 input files.");
            }

            // Each map entry contains a map of modules indexed by version
            Map<String, Map<String, ModuleDependency>> deps =
                    mdr.getModuleDependencies();

            // 2. Determine which modules and versions must be loaded
            log.info("Determining which root modules and versions to load");
            Map<String, Set<Version>> toLoad = getModuleVersionsToLoad(in);

            // 3. Create import entries
            log.info("Creating import entries");
            for(String rootModuleId : toLoad.keySet()) {
                Set<Version> versions = toLoad.get(rootModuleId);
                for(Version version : versions) {
                    String ver = version.getId();
                    Map<String, String> metadata = version.getMetadata();
                    Map<String, ModuleDependency> versionMap = deps.get(rootModuleId);
                    if (null == versionMap) {
                        throw new ImportException("Root module not found in MDRS: " + rootModuleId);
                    }
                    ModuleDependency md = versionMap.get(ver);
                    Set<Module> modules = new HashSet<Module>();

                    Queue<ModuleDependency> depends = new LinkedList<ModuleDependency>();
View Full Code Here

                                        cols[1], active , cols[3], cols[4],
                                        cols[5], cols[6], cols[7]);
                        members.add(m);
                    }
                } else {
                    throw new ImportException("Malformed module dependency reference set with " + cols.length + " columns "+Arrays.asList(cols));
                }
            } catch (IOException e) {
                log.error("Problem reading refset file "+refsetFile, e);
                throw new ImportException("Problem reading refset file ", e);
            } finally {
                if(br != null) {
                    try { br.close(); } catch(Exception e) {}
                }
            }
        }

        try {
            return new ModuleDependencyRefset(members, !Boolean.getBoolean("mdrs.ignoreErrors"));
        } catch (ValidationException e) {
            throw new ImportException("Can not continue import with invalid MDRS", e);
        }
    }
View Full Code Here

TOP

Related Classes of au.csiro.ontology.importer.ImportException

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.