Пример #1
0
    def __init__(self, config=None, db_name="GratefulDeadConcerts"):
        # This makes is easy to test different DBs
        #uri = self._get_uri(db_name) or self.default_uri

        self.configs = dict()
        self.request = dict()
        self.type_system = JSONTypeSystem()
        self.db_name = db_name

        for command in ['database', 'command']:
            uri = "%s/%s/%s" % (self.default_uri.rstrip("/"), command, db_name)
            print(uri)
            config = Config(uri, username="******", password="******")
            self.configs[command] = config
            self.registry = Registry(config)

            self.request[command] = self.request_class(
                config,
                self.type_system.content_type)

        self.config = self.configs['database']

        # OrientDB supports Gremlin so include the Gremlin-Groovy script library
        self.scripts = GroovyScripts(self.config)

        # Also include the OrientDB-specific Gremlin-Groovy scripts
        scripts_file = get_file_path(__file__, "gremlin.groovy")
        self.scripts.update(scripts_file)

        # Add it to the registry. This allows you to have more than one scripts
        # namespace.
        self.registry.add_scripts("gremlin", self.scripts)
Пример #2
0
    def __init__(self, config):
        """
        Initializes a resource object.

        :param root_uri: the base URL of Rexster.

        """
        self.config = config
        self.registry = Registry(config)
        self.scripts = Scripts()
        dir_name = os.path.dirname(__file__)
        self.scripts.override(get_file_path(dir_name, "gremlin.groovy"))
        self.registry.add_scripts("gremlin", self.scripts)
        self.type_system = self._get_type_system()
        self.request = Neo4jRequest(config, self.type_system.content_type)
Пример #3
0
    def __init__(self, config=None):
        self.config = config or Config(self.default_uri)
        self.registry = Registry(self.config)
        self.type_system = JSONTypeSystem()
        self.request = self.request_class(self.config,
                                          self.type_system.content_type)

        # Neo4j supports Gremlin so include the Gremlin-Groovy script library
        self.scripts = GroovyScripts(self.config)

        # Also include the Neo4j Server-specific Gremlin-Groovy scripts
        scripts_file = get_file_path(__file__, "gremlin.groovy")
        self.scripts.update(scripts_file)

        # Add it to the registry. This allows you to have more than one scripts namespace.
        self.registry.add_scripts("gremlin", self.scripts)
Пример #4
0
    def __init__(self, config=None, db_name=None):
        # This makes is easy to test different DBs
        uri = self._get_uri(db_name) or self.default_uri

        self.config = config or Config(uri)
        self.registry = Registry(self.config)
        self.type_system = JSONTypeSystem()
        self.request = self.request_class(self.config,
                                          self.type_system.content_type)

        # Rexster supports Gremlin so include the Gremlin-Groovy script library
        self.scripts = GroovyScripts(self.config)

        # Also include the Rexster-specific Gremlin-Groovy scripts
        scripts_file = get_file_path(__file__, "gremlin.groovy")
        self.scripts.update(scripts_file)

        # Add it to the registry. This allows you to have more than one scripts namespace.
        self.registry.add_scripts("gremlin", self.scripts)
Пример #5
0
 def __init__(self, config=None):
     self.config = config or Config(self.default_uri)
     self.registry = Registry(self.config)
     self.type_system = TypeSystem()
     self.request = self.request_class(self.config,
                                       self.type_system.content_type)
Пример #6
0
    def __init__(self, config):
        #: Config object containing instance-specific configuration.
        self.config = config

        #: Registry object to hold classes, proxies, indices, and scripts.
        self.registery = Registry()