How to use the ontospy.core.manager.get_localontologies function in ontospy

To help you get started, we’ve selected a few ontospy examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github lambdamusic / Ontospy / ontospy / extras / shell_lib.py View on Github external
choice = self._selectFromList(out, line)
            if choice:
                fullpath = self.LOCAL_MODELS + "/" + choice
                print(fullpath)
                if os.path.isfile(fullpath):

                    self._print("--------------")
                    self._print("Please enter a new name for <%s>, including the extension (blank=abort)"
                                % choice)
                    var = input()
                    if var:
                        try:
                            os.rename(fullpath, self.LOCAL_MODELS + "/" + var)
                            manager.rename_pickled_ontology(choice, var)
                            self._print("<%s> was renamed succesfully." % choice)
                            self.all_ontologies = manager.get_localontologies()
                        except:
                            self._print("Not a valid name. An error occurred.")
                            return
                    else:
                        return

                else:
                    self._print("File not found.")
                # delete
                if self.current and self.current['fullpath'] == fullpath:
                    self.current = None
                    self.currentEntity = None
                    self.prompt = _get_prompt()

        return
github lambdamusic / Ontospy / ontospy / extras / shell_lib.py View on Github external
for each in self.all_ontologies:
                if line in each:
                    out += [each]
            choice = self._selectFromList(out, line)
            if choice:
                fullpath = self.LOCAL_MODELS + "/" + choice
                if os.path.isfile(fullpath):

                    self._print("--------------")
                    self._print("Are you sure? [Y/N]")
                    var = input()
                    if var == "y" or var == "Y":
                        os.remove(fullpath)
                        manager.del_pickled_ontology(choice)
                        self._print("<%s> was deleted succesfully." % choice)
                        self.all_ontologies = manager.get_localontologies()
                    else:
                        return

                else:
                    self._print("File not found.")
                # delete
                if self.current and self.current['fullpath'] == fullpath:
                    self.current = None
                    self.currentEntity = None
                    self.prompt = _get_prompt()

        return
github lambdamusic / Ontospy / ontospy / extras / shell_lib.py View on Github external
def __init__(self, uri=None):
        """
        self.current = {'file' : filename, 'fullpath' : fullpath, 'graph': g}
        self.currentEntity = {'name' : obj.locale or obj.uri, 'object' : obj, 'type' : 'class'}
                                                                    # or 'property' or 'concept'
        """
        # init repo if necessary
        manager.get_or_create_home_repo()
        # useful vars
        self.LOCAL = ONTOSPY_LOCAL
        self.LOCAL_MODELS = manager.get_home_location()
        self.all_ontologies = manager.get_localontologies()
        self.current = None
        self.currentEntity = None
        if uri:
            self._load_ontology(uri, preview_mode=True)
        cmd.Cmd.__init__(self)
github lambdamusic / Ontospy / ontospy / extras / shell_lib.py View on Github external
"------------------\nEnter a full file path: (e.g. '/Users/mike/Desktop/journals.ttl')")
            var = input()
            if var:
                try:
                    actions.action_import(var)
                except:
                    self._print(
                        "OPS... An Unknown Error Occurred - Aborting installation of <%s>" % var)

        elif line and line[0] == "repo":
            actions.action_webimport()

        else:
            self.help_import()

        self.all_ontologies = manager.get_localontologies()
        return