Example #1
0
    def __init__(self, args, cfgfile_required=True, config=None):
        """
        args: A "struct" of configuration options (typically, parsed
            command-line arguments).  The required members are 'merge_imports'
            (boolean), 'reason' (boolean), 'no_def_expand' (boolean),
            'release_date' (string), and 'config_file' (string).
        cfgfile_required (optional): Whether a config file is required.
        config (optional): An OntoConfig object.
        """
        BuildTargetWithConfig.__init__(self, args, cfgfile_required, config)

        # Each release will include a merged, prereasoned ontology file, a
        # merged, unreasoned ontology file, and an unmerged, unreasoned
        # ontology file.  So we need to set dependencies for each of those
        # build targets.
        newargs = _ArgsType(args)
        newargs.merge_imports = True
        self.mobt_merged = ModifiedOntoBuildTarget(newargs, False, self.config)

        newargs = _ArgsType(args)
        newargs.merge_imports = True
        newargs.reason = True
        self.mobt_merged_reasoned = ModifiedOntoBuildTarget(
            newargs, False, self.config)

        self.addDependency(self.mobt_merged)
        self.addDependency(self.mobt_merged_reasoned)

        self.release_dir = self._generateReleaseDirPath(args.release_date)
Example #2
0
 def __init__(self, args, cfgfile_required=True, config=None):
     """
     args: A "struct" of configuration options (typically, parsed
         command-line arguments).  The only required member is 'config_file'
         (string).
     cfgfile_required (optional): Whether a config file is required.
     config (optional): An OntoConfig object.
     """
     BuildTargetWithConfig.__init__(self, args, cfgfile_required, config)
Example #3
0
    def __init__(self, args, cfgfile_required=True, config=None):
        """
        args: A "struct" of configuration options (typically, parsed
            command-line arguments).  The required members are
            'no_def_expand' (boolean) and 'config_file' (string).
        cfgfile_required (optional): Whether a config file is required.
        config (optional): An OntoConfig object.
        """
        BuildTargetWithConfig.__init__(self, args, cfgfile_required, config)

        self.obt = OntoBuildTarget(args, False, self.config)

        self.addDependency(self.obt)
    def __init__(self, args, cfgfile_required=False, config=None):
        """
        args: A "struct" of configuration options (typically, parsed
            command-line arguments).  The only required member is
            'config_file', which should provide the path to a configuration
            file (although this is only used if the config argument is None).
        cfgfile_required (optional): Whether a config file is required.
        config (optional): An OntoConfig object.
        """
        BuildTargetWithConfig.__init__(self, args, cfgfile_required, config)

        # This build target does not have any dependencies, since all input is
        # external and does not depend on other build tasks.

        self.srcpath = args.input_data.strip()
        self.outpath = args.fileout.strip()

        self._checkInputFile()
Example #5
0
    def __init__(self, args, cfgfile_required=True, config=None):
        """
        args: A "struct" of configuration options (typically, parsed
            command-line arguments).  The required members are
            'no_def_expand' (boolean) and 'config_file' (string).
        cfgfile_required (optional): Whether a config file is required.
        config (optional): An OntoConfig object.
        """
        BuildTargetWithConfig.__init__(self, args, cfgfile_required, config)

        # Set the imports modules as a dependency.  This is not strictly
        # required just to update the imports set in the base ontology.
        # However, setting this dependency has the advantage of ensuring that
        # all imports specifications are correct and that the imports modules
        # compile before we try to update the base ontology.  This should help
        # eliminate "silent" errors in the import modules specifications.
        self.ibt = ImportsBuildTarget(args, False, self.config)
        self.addDependency(self.ibt)
Example #6
0
    def __init__(self, args, cfgfile_required=True, config=None):
        """
        args: A "struct" of configuration options (typically, parsed
            command-line arguments).  The required members are 'merge_imports'
            (boolean), 'reason' (boolean), 'no_def_expand' (boolean),
            'release_date' (string), and 'config_file' (string).
        cfgfile_required (optional): Whether a config file is required.
        config (optional): An OntoConfig object.
        """
        BuildTargetWithConfig.__init__(self, args, cfgfile_required, config)

        # Use the reasoned version of the ontology to generate the
        # documentation.
        newargs = _ArgsType(args)
        newargs.reason = True
        self.mobt_reasoned = ModifiedOntoBuildTarget(newargs, False,
                                                     self.config)

        self.addDependency(self.mobt_reasoned)
    def __init__(self, args, cfgfile_required=True, config=None):
        """
        args: A "struct" of configuration options (typically, parsed
            command-line arguments).  The required members are 'merge_imports'
            (boolean), 'reason' (boolean), 'no_def_expand' (boolean), and
            'config_file' (string).
        cfgfile_required (optional): Whether a config file is required.
        config (optional): An OntoConfig object.
        """
        BuildTargetWithConfig.__init__(self, args, cfgfile_required, config)

        self.mergeimports = args.merge_imports
        self.prereason = args.reason

        self.obt = OntoBuildTarget(args, False, self.config)

        # If we have nothing to do, then there are no dependencies.
        if self.mergeimports or self.prereason:
            self.addDependency(self.obt)
Example #8
0
    def __init__(self, args, cfgfile_required=True, config=None):
        """
        args: A "struct" of configuration options (typically, parsed
            command-line arguments).  The required members are
            'no_def_expand' (boolean) and 'config_file' (string).
        cfgfile_required (optional): Whether a config file is required.
        config (optional): An OntoConfig object.
        """
        BuildTargetWithConfig.__init__(self, args, cfgfile_required, config)

        # Determine whether to add IDs to term references in definitions.
        self.expanddefs = self.config.getExpandEntityDefs()

        # Set the imports modules as a dependency, regardless of whether we're
        # using in-source or out-of-source builds.  Either way, it is probably
        # best for end users to make sure imports modules remain updated.  Of
        # course, for out-of-source builds, it is up to the user to make sure
        # the imports modules get copied to their destination location.
        self.ibt = ImportsBuildTarget(args, False, self.config)
        self.addDependency(self.ibt)
Example #9
0
    def __init__(self, args, cfgfile_required=True, config=None):
        """
        args: A "struct" of configuration options (typically, parsed
            command-line arguments).  The only required member is 'config_file'
            (string).
        cfgfile_required (optional): Whether a config file is required.
        config (optional): An OntoConfig object.
        """
        BuildTargetWithConfig.__init__(self, args, cfgfile_required, config)

        self.addDependency(BuildDirTarget(args, False, self.config))

        # The string builddir is the path to a build directory where, at a
        # minimum, source ontologies can be cached.  If we are doing an
        # out-of-source build, this will also be the location for the compiled
        # imports modules, specified by outputdir.  For in-source builds,
        # outputdir will be the final destination for the imports modules.
        self.builddir = self.config.getBuildDir()
        if self.config.getDoInSourceBuilds():
            self.outputdir = self.config.getImportsDir()
        else:
            self.outputdir = self.builddir

        self._checkFiles()
        self._readImportsSource()

        # Initialize the ImportModuleBuilder.
        self.mbuilder = ImportModuleBuilder(self.config.getImportsDevBaseIRI(),
                                            self.config.getImportModSuffix(),
                                            self.builddir, self.outputdir)

        # Update the IRI mappings for the import modules so that the local
        # files are loaded instead of the versions at the remote IRIs.
        for modinfo in self.getImportsInfo():
            if modinfo.filename != '':
                doc_iristr = urlparse.urljoin(
                    'file://localhost', urllib.pathname2url(modinfo.filename))
                oom_manager.addNewIRIMapping(IRI.create(modinfo.iristr),
                                             IRI.create(doc_iristr))