示例#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=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()

        # 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)
示例#3
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, content_type = get_type_system(config)
        self.request = RexsterRequest(config, content_type=content_type)
示例#4
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, content_type = get_type_system(config)
        self.request = RexsterRequest(config,content_type=content_type)
示例#5
0
    def __init__(self, config=None):
        super(Graph, self).__init__(config)
        
        # Node Proxies
        self.people = self.build_proxy(Person)
        self.entries = self.build_proxy(Entry)
        self.topics = self.build_proxy(Topic)

        # Relationship Proxies
        self.tagged = self.build_proxy(Tagged)
        self.author = self.build_proxy(Author)
        
        # Add our custom Gremlin-Groovy scripts
        scripts_file = get_file_path(__file__, "gremlin.groovy")
        self.scripts.update(scripts_file)
示例#6
0
文件: client.py 项目: ct2034/bulbs
    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)
示例#7
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()

        # 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)
示例#8
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)
示例#9
0
 def _get_scripts_file(self,file_name):
     dir_name = os.path.dirname(__file__)
     file_path = get_file_path(dir_name,file_name)
     return file_path
示例#10
0
 def _get_scripts_file(self,file_name):
     """Returns the full file path for the scripts file."""
     dir_name = os.path.dirname(__file__)
     file_path = get_file_path(dir_name,file_name)
     return file_path