Change Password

Please enter the password.
Please enter the password. Between 8-64 characters. Not identical to your email address. Contain at least 3 of: uppercase, lowercase, numbers, and special characters.
Please enter the password.
Submit

Change Nickname

Current Nickname:
Submit

Apply New License

License Detail

Please complete this required field.

  • Ultipa Graph V4

Standalone

Please complete this required field.

Please complete this required field.

The MAC address of the server you want to deploy.

Please complete this required field.

Please complete this required field.

Cancel
Apply
ID
Product
Status
Cores
Applied Validity Period(days)
Effective Date
Excpired Date
Mac Address
Apply Comment
Review Comment
Close
Profile
  • Full Name:
  • Phone:
  • Company:
  • Company Email:
  • Country:
  • Language:
Change Password
Apply

You have no license application record.

Apply
Certificate Issued at Valid until Serial No. File
Serial No. Valid until File

Not having one? Apply now! >>>

Product Created On ID Amount (USD) Invoice
Product Created On ID Amount (USD) Invoice

No Invoice

v5.0
Search
    English
    v5.0

      Schema and Property

      This section introduces methods for managing schemas and properties in a graph.

      Schema

      showSchema()

      Retrieves all schemas from the graph.

      Parameters

      • config: RequestConfig (Optional): Request configuration.

      Returns

      • list[Schema]: The list of retrieved schemas.

      requestConfig = RequestConfig(graph="miniCircle")
      schemas = Conn.showSchema(requestConfig)
      
      data = [[schema.name, schema.dbType.name, schema.stats] for schema in schemas]
      headers = ["Name", "Type", "Stats"]
      print(tabulate.tabulate(data, headers=headers, tablefmt="grid"))
      

      +-----------+--------+------------------------------------------------------------------------------------------------------+
      | Name      | Type   | Stats                                                                                                |
      +===========+========+======================================================================================================+
      | default   | DBNODE | [{'from': '', 'to': '', 'count': 0}]                                                                 |
      +-----------+--------+------------------------------------------------------------------------------------------------------+
      | account   | DBNODE | [{'from': '', 'to': '', 'count': 111}]                                                               |
      +-----------+--------+------------------------------------------------------------------------------------------------------+
      | celebrity | DBNODE | [{'from': '', 'to': '', 'count': 78}]                                                                |
      +-----------+--------+------------------------------------------------------------------------------------------------------+
      | country   | DBNODE | [{'from': '', 'to': '', 'count': 23}]                                                                |
      +-----------+--------+------------------------------------------------------------------------------------------------------+
      | movie     | DBNODE | [{'from': '', 'to': '', 'count': 92}]                                                                |
      +-----------+--------+------------------------------------------------------------------------------------------------------+
      | default   | DBEDGE | [{'from': '', 'to': '', 'count': 0}]                                                                 |
      +-----------+--------+------------------------------------------------------------------------------------------------------+
      | direct    | DBEDGE | [{'from': 'celebrity', 'to': 'movie', 'count': 98}]                                                  |
      +-----------+--------+------------------------------------------------------------------------------------------------------+
      | disagree  | DBEDGE | [{'from': 'account', 'to': 'account', 'count': 86}]                                                  |
      +-----------+--------+------------------------------------------------------------------------------------------------------+
      | filmedIn  | DBEDGE | [{'from': 'movie', 'to': 'country', 'count': 192}]                                                   |
      +-----------+--------+------------------------------------------------------------------------------------------------------+
      | follow    | DBEDGE | [{'from': 'account', 'to': 'account', 'count': 152}]                                                 |
      +-----------+--------+------------------------------------------------------------------------------------------------------+
      | wishlist  | DBEDGE | [{'from': 'account', 'to': 'movie', 'count': 175}]                                                   |
      +-----------+--------+------------------------------------------------------------------------------------------------------+
      | response  | DBEDGE | [{'from': 'account', 'to': 'account', 'count': 884}]                                                 |
      +-----------+--------+------------------------------------------------------------------------------------------------------+
      | review    | DBEDGE | [{'from': 'movie', 'to': 'country', 'count': 100}, {'from': 'account', 'to': 'account', 'count': 1}] |
      +-----------+--------+------------------------------------------------------------------------------------------------------+
      

      showNodeSchema()

      Retrieves all node schemas from the graph.

      Parameters

      • config: RequestConfig (Optional): Request configuration.

      Returns

      • List[Schema]: The list of retrieved schemas.

      # Retrieves all node schemas in the graph 'miniCircle'
      
      requestConfig = RequestConfig(graph="miniCircle")
      
      schemas = Conn.showNodeSchema(requestConfig)
      for schema in schemas:
          print(f"{schema.name}, {schema.dbType.name}")
      

      default, DBNODE
      account, DBNODE
      celebrity, DBNODE
      country, DBNODE
      movie, DBNODE
      

      showEdgeSchema()

      Retrieves all edge schemas from the graph.

      Parameters

      • config: RequestConfig (Optional): Request configuration.

      Returns

      • List[Schema]: The list of retrieved schemas.

      # Retrieves all edge schemas in the graph 'miniCircle'
      
      requestConfig = RequestConfig(graph="miniCircle")
      
      schemas = Conn.showEdgeSchema(requestConfig)
      for schema in schemas:
          print(f"{schema.name}, {schema.dbType.name}")
      

      default, DBEDGE
      direct, DBEDGE
      disagree, DBEDGE
      filmedIn, DBEDGE
      follow, DBEDGE
      wishlist, DBEDGE
      response, DBEDGE
      review, DBEDGE
      

      getSchema()

      Retrieves a specified schema from the graph.

      Parameters

      • schemaName: str: Name of the schema.
      • dbType: DBtype: Type of the schema (node or edge).
      • config: RequestConfig (Optional): Request configuration.

      Returns

      • Schema: The retrieved schema.

      # Retrieves the node schema named 'account'
      
      requestConfig = RequestConfig(graph="miniCircle")
      
      schema = Conn.getSchema("account", DBType.DBNODE, requestConfig)
      print(schema.total)
      

      111
      

      getNodeSchema()

      Retrieves a specified node schema from the graph.

      Parameters

      • schemaName: str: Name of the schema.
      • config: RequestConfig (Optional): Request configuration.

      Returns

      • Schema: The retrieved schema.

      # Retrieves the node schema named 'account'
      
      requestConfig = RequestConfig(graph="miniCircle")
      
      schema = Conn.getNodeSchema("account", requestConfig)
      if schema:
          for property in schema.properties:
              print(property.name)
      else:
          print("Not found")
      

      gender
      year
      industry
      name
      

      getEdgeSchema()

      Retrieves a specified edge schema from the graph.

      Parameters

      • schemaName: str: Name of the schema.
      • config: RequestConfig (Optional): Request configuration.

      Returns

      • Schema: The retrieved schema.

      # Retrieves the edge schema named 'disagree'
      
      requestConfig = RequestConfig(graph="miniCircle")
      
      schema = Conn.getEdgeSchema("disagree", requestConfig)
      if schema:
          for property in schema.properties:
              print(property.name)
      else:
          print("Not found")
      

      datetime
      timestamp
      targetPost
      

      createSchema()

      Creates a schema in the graph.

      Parameters

      • schema: Schema: The schema to be created; the attributes name and dbType are mandatory, properties and description are optional.
      • isCreateProperties: bool (Optional): Whether to create properties associated with the schema, the default is False.
      • config: RequestConfig (Optional): Request configuration.

      Returns

      • Response: Response of the request.

      requestConfig = RequestConfig(graph="miniCircle")
      
      # Creates node schema 'utility' (with properties)
      
      utility = Schema(
          name="utility",
          dbType=DBType.DBNODE,
          properties=[
              Property(name="name", type=UltipaPropertyType.STRING),
              Property(name="type", type=UltipaPropertyType.UINT32)
          ]
      )
      
      response1 = Conn.createSchema(utility, True, requestConfig)
      print(response1.status.code.name)
      
      time.sleep(3)
      
      # Creates edge schema 'vote' (without properties)
      
      managedBy = Schema(
          name="vote",
          dbType=DBType.DBEDGE
      )
      
      response2 = Conn.createSchema(managedBy, False, requestConfig)
      print(response2.status.code.name)
      

      SUCCESS
      SUCCESS
      

      createSchemaIfNotExist()

      Creates a schema in the graph and returns whether a node or edge schema with the same name already exists.

      Parameters

      • schema: Schema: The schema to be created; the attributes name and dbType are mandatory, properties and description are optional.
      • isCreateProperties: bool (Optional): Whether to create properties associated with the schema, the default is False.
      • config: RequestConfig (Optional): Request configuration.

      Returns

      • ResponseWithExistCheck: Result of the request.

      requestConfig = RequestConfig(graph="miniCircle")
      
      schema = Schema(
          name="utility",
          dbType=DBType.DBNODE,
          properties=[
              Property(name="name", type=UltipaPropertyType.STRING),
              Property(name="type", type=UltipaPropertyType.UINT32)
          ]
      )
      
      result = Conn.createSchemaIfNotExist(schema, True, requestConfig)
      
      print("Does the schema already exist?", result.exist)
      if result.response.status is None:
          print("Schema creation status: No response")
      else:
          print("Schema creation status:", result.response.status.code.name)
      
      print("----- Creates the schema again -----")
      
      result_1 = Conn.createSchemaIfNotExist(schema, True, requestConfig)
      
      print("Does the schema already exist?", result_1.exist)
      if result_1.response.status is None:
          print("Schema creation status: No response")
      else:
          print("Schema creation status:", result_1.response.status.code.name)
      

      Does the schema already exist? False
      ----- Creates the schema again -----
      Does the schema already exist? True
      Schema creation status: No response
      

      alterSchema()

      Alters the name and description a schema in the graph.

      Parameters

      • originalSchema: Schema: The schema to be altered; the attributes name and dbType are mandatory.
      • newSchema: Schema: A Schema object used to set the new name and/or description for the schema.
      • config: RequestConfig (Optional): Request configuration.

      Returns

      • Response: Response of the request.

      # Renames the node schema 'utility' to 'securityUtility' in the graph 'miniCircle'
      
      requestConfig = RequestConfig(graph="miniCircle")
      
      schema = Conn.getNodeSchema("utility", requestConfig)
      newSchema = Schema(name="securityUtility")
      response = Conn.alterSchema(schema, newSchema, requestConfig)
      print(response.status.code.name)
      

      SUCCESS
      

      dropSchema()

      Deletes a specified schema from the graph.

      Parameters

      • schema: Schema: The schema to be dropped; the attributes name and dbType are mandatory.
      • config: RequestConfig (Optional): Request configuration.

      Returns

      • Response: Response of the request.

      # Drops the edge schema 'vote' from the graph 'miniCircle'
      
      requestConfig = RequestConfig(graph="miniCircle")
      
      schema = Conn.getEdgeSchema("vote", requestConfig)
      response = Conn.dropSchema(schema, requestConfig)
      print(response.status.code.name)
      

      SUCCESS
      

      Property

      showProperty()

      Retrieves properties from the graph.

      Parameters

      • dbType: DBType (Optional): Type of the property (node or edge).
      • schemaName: str (Optional): Name of the schema.
      • config: RequestConfig (Optional): Request configuration.

      Returns

      • Dict[str, List[Property]: A dictionary where the key is nodeProperties or edgeProperties, and the value is the list of properties.

      # Retrieves all properties in the graph 'citation'
      
      requestConfig = RequestConfig(graph="citation")
      
      properties = Conn.showProperty(config=requestConfig)
      nodeProperties = properties["nodeProperties"]
      print("Node Properties:")
      for nodeProperty in nodeProperties:
          print(f"{nodeProperty.name} is associated with schema {nodeProperty.schema}")
      
      edgeProperties = properties["edgeProperties"]
      print("Edge Properties:")
      for edgeProperty in edgeProperties:
          print(f"{edgeProperty.name} is associated with schema {edgeProperty.schema}")
      

      Node Properties:
      _id is associated with schema default
      _id is associated with schema Paper
      title is associated with schema Paper
      score is associated with schema Paper
      author is associated with schema Paper
      Edge Properties:
      weight is associated with schema Cites
      

      showNodeProperty()

      Retrieves node properties from the graph.

      Parameters

      • schemaName: str (Optional): Name of the schema.
      • config: RequestConfig (Optional): Request configuration.

      Returns

      • List[Property]: The list of retrieved properties.

      # Retrieves properties associated with the node schema 'Paper' in the graph 'citation'
      
      requestConfig = RequestConfig(graph="citation")
      
      properties = Conn.showNodeProperty("Paper", requestConfig)
      for property in properties:
          print(property.name, "-", property.type.name)
      

      _id - STRING
      title - STRING
      score - INT32
      author - STRING
      

      showEdgeProperty()

      Retrieves edge properties from the graph.

      Parameters

      • schemaName: str (Optional): Name of the schema.
      • config: RequestConfig (Optional): Request configuration.

      Returns

      • List[Property]: The list of retrieved properties.

      # Retrieves properties associated with the edge schema 'Cites' in the graph 'citation'
      
      requestConfig = RequestConfig(graph="citation")
      
      properties = Conn.showEdgeProperty("Cites", requestConfig)
      for property in properties:
          print(property.name, "-", property.type.name)
      

      weight - INT32
      

      getProperty()

      Retrieves a specified property from the graph.

      Parameters

      • dbType: DBType: Type of the property (node or edge).
      • propertyName: str: Name of the property.
      • schemaName: str: Name of the schema.
      • config: RequestConfig (Optional): Request configuration.

      Returns

      • Property: The retrieved property.

      # Retrieves node property 'title' associated with the node schema 'Paper' in the graph 'citation'
      
      requestConfig = RequestConfig(graph="citation")
      
      property = Conn.getProperty(DBType.DBNODE, "title", "Paper", requestConfig)
      print(property.toJSON())
      

      {'type': <UltipaPropertyType.STRING: 7>, 'subType': None, 'description': '', 'name': 'title', 'lte': False, 'schema': 'Paper', 'encrypt': '', 'extra': None, 'read': None, 'write': None}
      

      getNodeProperty()

      Retrieves a specified node property from the graph.

      Parameters

      • propertyName: str: Name of the property.
      • schemaName: str: Name of the schema.
      • config: RequestConfig (Optional): Request configuration.

      Returns

      • Property: The retrieved property.

      # Retrieves node property 'title' associated with the node schema 'Paper' in the graph 'citation'
      
      requestConfig = RequestConfig(graph="citation")
      
      property = Conn.getNodeProperty("title", "Paper", requestConfig)
      print(property.toJSON())
      

      {'type': <UltipaPropertyType.STRING: 7>, 'subType': None, 'description': '', 'name': 'title', 'lte': False, 'schema': 'Paper', 'encrypt': '', 'extra': None, 'read': None, 'write': None}
      

      getEdgeProperty()

      Retrieves a specified edge property from the graph.

      Parameters

      • propertyName: str: Name of the property.
      • schemaName: str: Name of the schema.
      • config: RequestConfig (Optional): Request configuration.

      Returns

      • Property: The retrieved property.

      # Retrieves edge property 'weight' associated with the edge schema 'Cites' in the graph 'citation'
      
      requestConfig = RequestConfig(graph="citation")
      
      property = Conn.getEdgeProperty("weight", "Cites", requestConfig)
      print(property.toJSON())
      

      {'type': <UltipaPropertyType.INT32: 1>, 'subType': None, 'description': '', 'name': 'weight', 'lte': False, 'schema': 'Cites', 'encrypt': '', 'extra': None, 'read': None, 'write': None}
      

      createProperty()

      Creates a property in the graph.

      Parameters

      • dbType: DBType: Type of the property (node or edge).
      • schemaName: str: Name of the schema; writes * to specify all schemas.
      • property: Property: The property to be created; the attributes name and type (and subType if the type is SET or LIST) are mandatory, encrypt and description are optional.
      • config: RequestConfig (Optional): Request configuration.

      Returns

      • Response: Response of the request.

      # Creates a property 'year' for all node schemas, creates a property 'tags' for the node schema 'Paper'
      
      requestConfig = RequestConfig(graph="citation")
      
      property1 = Property(
          name="year",
          type=UltipaPropertyType.UINT32,
          encrypt="AES128"
      )
      
      property2 = Property(
          name="tags",
          type=UltipaPropertyType.SET,
          subType=[UltipaPropertyType.STRING]
      )
      
      response1 = Conn.createProperty(DBType.DBNODE, "*", property1, requestConfig)
      print(response1.status.code.name)
      
      response2 = Conn.createProperty(DBType.DBNODE, "Paper", property2, requestConfig)
      print(response2.status.code.name)
      

      SUCCESS
      SUCCESS
      

      createPropertyIfNotExist()

      Creates a property in the graph and returns whether a node or edge property with the same name already exists for the specified schema.

      Parameters

      • dbType: DBType: Type of the property (node or edge).
      • schemaName: str: Name of the schema; writes * to specify all schemas.
      • property: Property: The property to be created; the attributes name and type (and subType if the type is SET or LIST) are mandatory, encrypt and description are optional.
      • config: RequestConfig (Optional): Request configuration.

      Returns

      • ResponseWithExistCheck: Result of the request.

      requestConfig = RequestConfig(graph="citation")
      
      property = Property(
          name="tags",
          type=UltipaPropertyType.SET,
          subType=[UltipaPropertyType.STRING],
          encrypt="AES128"
      )
      
      result = Conn.createPropertyIfNotExist(DBType.DBNODE, "Paper", property, requestConfig)
      
      print("Does the property already exist?", result.exist)
      if result.response.status is None:
          print("Property creation status: No response")
      else:
          print("Property creation status:", result.response.status.code.name)
      
      print("----- Creates the property again -----")
      
      result_1 = Conn.createPropertyIfNotExist(DBType.DBNODE, "Paper", property, requestConfig)
      
      print("Does the property already exist?", result_1.exist)
      if result_1.response.status is None:
          print("Property creation status: No response")
      else:
          print("Property creation status:", result_1.response.status.code.name)
      

      Does the property already exist? False
      Property creation status: SUCCESS
      ----- Creates the property again -----
      Does the property already exist? True
      Property creation status: No response
      

      alterProperty()

      Alters the name and description a property in the graph.

      Parameters

      • dbType: DBType: Type of the property (node or edge).
      • originProp: Property: The property to be altered; the attributes name and schema (writes * to specify all schemas) are mandatory.
      • newProp: Property: A Property object used to set the new name and/or description for the property.
      • config: RequestConfig (Optional): Request configuration.

      Returns

      • Response: Response of the request.

      # Renames the property 'tags' of the node schema 'Paper' to 'keywords' in the graph 'citation'
      
      requestConfig = RequestConfig(graph="citation")
      
      property = Property(name="tags", schema="Paper")
      newProperty = Property(name="keywords")
      response = Conn.alterProperty(DBType.DBNODE, property, newProperty, requestConfig)
      print(response.status.code.name)
      

      SUCCESS
      

      dropProperty()

      Deletes specified properties from the graph.

      Parameters

      • dbType: DBType: Type of the property (node or edge).
      • property: Property: The property to be droppped; the attributes name and schema (writes * to specify all schemas) are mandatory.
      • config: RequestConfig (Optional): Request configuration.

      Returns

      • Response: Response of the request.

      # Drops the property 'tags' of the node schema in the graph 'citation'
      
      requestConfig = RequestConfig(graph="citation")
      
      property = Property(name="tags", schema="Paper")
      response = Conn.dropProperty(DBType.DBNODE, property, requestConfig)
      print(response.status.code.name)
      

      SUCCESS
      

      Full Example

      from ultipa import UltipaConfig, Connection, Schema, Property, DBType, RequestConfig, UltipaPropertyType
      
      ultipaConfig = UltipaConfig()
      # URI example: ultipaConfig.hosts = ["https://mqj4zouys.us-east-1.cloud.ultipa.com:60010"]
      ultipaConfig.hosts = ["192.168.1.85:60061", "192.168.1.87:60061", "192.168.1.88:60061"]
      ultipaConfig.username = "<username>"
      ultipaConfig.password = "<password>"
      
      Conn = Connection.NewConnection(defaultConfig=ultipaConfig)
                
      # Creates schemas and properties in the graph 'social'
      
      requestConfig = RequestConfig(graph="social")
      
      movie = Schema(
          name="movie",
          dbType=DBType.DBNODE,
          properties=[
              Property(name="name", type=UltipaPropertyType.STRING),
              Property(name="type", type=UltipaPropertyType.UINT32)
          ]
      )
      
      likes = Schema(
          name="utility",
          dbType=DBType.DBEDGE,
          properties=[
              Property(name="time", type=UltipaPropertyType.DATETIME)
          ]
      )
      
      schemas = [movie, likes]
      for schema in schemas:
          response = Conn.createSchema(schema, True, requestConfig)
          print(response.status.code.name)
      
      Please complete the following information to download this book
      *
      公司名称不能为空
      *
      公司邮箱必须填写
      *
      你的名字必须填写
      *
      你的电话必须填写