예제 #1
0
def main(args):
    '''

    :param args: arguments passed from customized entry points
    :return:
    '''

    # Parse out the ontology object then print it nicely
    default_basepath = Filemgt.get_ontology_basepath()
    if args.sub is None:
        args.sub = default_basepath[0]
    if args.base is None:
        args.base = default_basepath[1]

    if (args.tptp or args.ladr or args.latex) and args.nocond is False:
        Parser.conditionals = True

    # TODO need to substitute base path
    full_path = args.file

    if os.path.isfile(full_path):
        logging.getLogger(__name__).info("Starting to parse " + args.file)
        convert_file(full_path, args=args)

    elif os.path.isdir(full_path):
        logging.getLogger(__name__).info("Starting to parse all CLIF files in folder " + args.file)
        convert_folder(full_path, args=args)
    else:
        logging.getLogger(__name__).error("Attempted to parse non-existent file or directory: " + full_path)
예제 #2
0
    def __init__(self, name, basepath=None):

        # The full path to the file
        self.name = os.path.abspath(name)

        # For the time being, just maintain a list of axioms
        self.axioms = []

        # for flexibility, maintain a separate list of conjectures
        self.conjectures = []

        # Imports we handle with a [path] : [ontologies] dict
        self.imports = {}

        # Dict with [URI] : [filepath] to serve as the substitution string
        if basepath is None:
            self.basepath = Filemgt.get_ontology_basepath()
        else:
            self.basepath = basepath
        #logging.getLogger(__name__).info('Using URI ' + self.basepath[0] + ' to substitute for path ' + self.basepath[1])

        self.resolve = False