WO2024001163A1 - 属性数据的转换方法和装置、存储介质及电子装置 - Google Patents

属性数据的转换方法和装置、存储介质及电子装置 Download PDF

Info

Publication number
WO2024001163A1
WO2024001163A1 PCT/CN2023/072138 CN2023072138W WO2024001163A1 WO 2024001163 A1 WO2024001163 A1 WO 2024001163A1 CN 2023072138 W CN2023072138 W CN 2023072138W WO 2024001163 A1 WO2024001163 A1 WO 2024001163A1
Authority
WO
WIPO (PCT)
Prior art keywords
attribute
target
value
attributes
data
Prior art date
Application number
PCT/CN2023/072138
Other languages
English (en)
French (fr)
Inventor
邓邱伟
严峰
张旭
翟建光
Original Assignee
青岛海尔科技有限公司
青岛海尔智能家电科技有限公司
海尔智家股份有限公司
Priority date (The priority date is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the date listed.)
Filing date
Publication date
Application filed by 青岛海尔科技有限公司, 青岛海尔智能家电科技有限公司, 海尔智家股份有限公司 filed Critical 青岛海尔科技有限公司
Publication of WO2024001163A1 publication Critical patent/WO2024001163A1/zh

Links

Classifications

    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F3/00Input arrangements for transferring data to be processed into a form capable of being handled by the computer; Output arrangements for transferring data from processing unit to output unit, e.g. interface arrangements
    • G06F3/06Digital input from, or digital output to, record carriers, e.g. RAID, emulated record carriers or networked record carriers
    • G06F3/0601Interfaces specially adapted for storage systems
    • G06F3/0602Interfaces specially adapted for storage systems specifically adapted to achieve a particular effect
    • G06F3/0608Saving storage space on storage systems
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F16/00Information retrieval; Database structures therefor; File system structures therefor
    • G06F16/20Information retrieval; Database structures therefor; File system structures therefor of structured data, e.g. relational data
    • G06F16/25Integrating or interfacing systems involving database management systems
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F16/00Information retrieval; Database structures therefor; File system structures therefor
    • G06F16/20Information retrieval; Database structures therefor; File system structures therefor of structured data, e.g. relational data
    • G06F16/28Databases characterised by their database models, e.g. relational or object models
    • G06F16/284Relational databases
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F3/00Input arrangements for transferring data to be processed into a form capable of being handled by the computer; Output arrangements for transferring data from processing unit to output unit, e.g. interface arrangements
    • G06F3/06Digital input from, or digital output to, record carriers, e.g. RAID, emulated record carriers or networked record carriers
    • G06F3/0601Interfaces specially adapted for storage systems
    • G06F3/0628Interfaces specially adapted for storage systems making use of a particular technique
    • G06F3/0638Organizing or formatting or addressing of data
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F40/00Handling natural language data
    • G06F40/10Text processing
    • G06F40/12Use of codes for handling textual entities
    • G06F40/126Character encoding

Definitions

  • the present disclosure relates to the field of communications, and specifically, to a method and device for converting attribute data, a storage medium, and an electronic device.
  • the attribute data reported by these different types of devices includes the device's Type identifier and several corresponding sensor attribute value pairs.
  • Embodiments of the present disclosure provide a method and device for converting attribute data, a storage medium, and an electronic device to at least solve the problem in related technologies that when a device reports attribute data, it is not conducive to network transmission and storage and wastes a large amount of bandwidth and storage resources. .
  • a method for converting attribute data including: obtaining first attribute data indicating a plurality of first attributes of a smart device, wherein the attribute data includes: A plurality of first attribute names respectively corresponding to a plurality of first attributes and a plurality of first attribute values respectively corresponding to the plurality of first attributes; obtaining the attribute metadata of the smart device, wherein the attribute metadata
  • the data includes: a plurality of second attribute names respectively corresponding to a plurality of second attributes of the smart device set in advance, a plurality of attribute sequence numbers respectively corresponding to the plurality of second attributes and the plurality of second attributes respectively.
  • Corresponding multiple attribute value types convert the first attribute data into target attribute data according to the attribute metadata, wherein the target attribute data includes: multiple target attributes respectively corresponding to the multiple first attributes. value.
  • a device for converting attribute data including: a first acquisition module configured to acquire first attribute data indicating a plurality of first attributes of a smart device, wherein , the attribute data includes: a plurality of first attribute names respectively corresponding to the plurality of first attributes and a plurality of first attribute values corresponding to the plurality of first attributes; the second acquisition module is configured to obtain all The attribute metadata of the smart device, wherein the attribute metadata includes: a plurality of second attribute names respectively corresponding to a plurality of second attributes of the smart device set in advance, and a plurality of second attribute names respectively corresponding to the plurality of second attributes.
  • the target attribute data includes: a plurality of target attribute values respectively corresponding to the plurality of first attributes.
  • a computer-readable storage medium stores a computer program, wherein the computer program is configured to execute the above attribute data when running. Conversion method.
  • an electronic device including a memory, a processor, and a computer program stored in the memory and executable on the processor, wherein the processor executes the above-mentioned steps through the computer program. Conversion method for attribute data.
  • Figure 1 is a schematic diagram of the hardware environment of an attribute data conversion method according to an embodiment of the present disclosure
  • Figure 2 is a flow chart of a method for converting attribute data according to an embodiment of the present disclosure
  • Figure 3 is a schematic diagram (1) of a method for converting attribute data according to an embodiment of the present disclosure
  • Figure 4 is a schematic diagram (2) of a method for converting attribute data according to an embodiment of the present disclosure
  • Figure 5 is a structural block diagram of an attribute data conversion device according to an embodiment of the present disclosure.
  • Figure 6 is a structural block diagram of an optional electronic device according to an embodiment of the present disclosure.
  • a method for converting attribute data is provided.
  • This attribute data conversion method is widely used in whole-house intelligent digital control application scenarios such as smart home, smart home, smart home device ecology, and smart residence (Intelligence House) ecology.
  • the above attribute data conversion method can be applied to the hardware environment composed of the terminal device 102 and the server 104 as shown in FIG. 1 .
  • the server 104 is connected to the terminal device 102 through the network and can be set to provide services for the terminal or the client installed on the terminal (such as service, etc.), a database may be configured on the server or independently from the server to provide data storage services for the server 104, and cloud computing and/or edge computing services may be configured on the server or independently from the server to provide the server 104 with Data computing services.
  • the above-mentioned network may include but is not limited to at least one of the following: wired network, wireless network.
  • the above-mentioned wired network may include but is not limited to at least one of the following: wide area network, metropolitan area network, and local area network.
  • the above-mentioned wireless network may include at least one of the following: WIFI (Wireless Fidelity, Wireless Fidelity), Bluetooth.
  • the terminal device 102 may be, but is not limited to, a PC, a mobile phone, a tablet, a smart air conditioner, a smart hood, a smart refrigerator, a smart oven, a smart stove, a smart washing machine, a smart water heater, a smart washing equipment, a smart dishwasher, or a smart projection device.
  • smart TV smart clothes drying rack, smart curtains, smart audio and video, smart sockets, smart audio, smart speakers, smart fresh air equipment, smart kitchen and bathroom equipment, smart bathroom equipment, smart sweeping robot, smart window cleaning robot, smart mopping robot, Smart air purification equipment, smart steamers, smart microwave ovens, smart kitchen appliances, smart purifiers, smart water dispensers, smart door locks, etc.
  • FIG. 1 is a flow chart of a method for converting attribute data according to an embodiment of the present disclosure. The process includes the following steps:
  • Step S202 Obtain first attribute data indicating multiple first attributes of the smart device, where the attribute data includes: multiple first attribute names and sums corresponding to the multiple first attributes respectively. A plurality of first attribute values respectively corresponding to the first attribute;
  • the first attribute data is:
  • Step S204 Obtain attribute metadata of the smart device, where the attribute metadata includes: a plurality of second attribute names respectively corresponding to a plurality of second attributes of the smart device set in advance, the plurality of first attributes of the smart device. A plurality of attribute sequence numbers respectively corresponding to the two attributes and a plurality of attribute value types respectively corresponding to the plurality of second attributes;
  • Step S206 Convert the first attribute data into target attribute data according to the attribute metadata, where the target attribute data includes: a plurality of target attribute values respectively corresponding to the plurality of first attributes.
  • first attribute data indicating a plurality of first attributes of the smart device is obtained, wherein the attribute data includes: a plurality of first attribute names corresponding to the plurality of first attributes and a plurality of first attribute names corresponding to the plurality of first attributes.
  • the first attribute is The data is converted into target attribute data, wherein the target attribute data includes: multiple target attribute values respectively corresponding to the plurality of first attributes, which solves the problem in related technologies that is not conducive to network transmission when the device reports attribute data. and storage, wasting a lot of bandwidth and storage resources, and then the target attribute data in the embodiment of the present disclosure includes multiple target attribute values.
  • the complex json map format is converted into a simple The string concatenation format reduces the amount of data, thereby greatly reducing network and storage requirements, and saving bandwidth and storage resources.
  • the process of converting the first attribute data into target attribute data according to the attribute metadata includes: a first conversion step: determining any first attribute corresponding to the attribute metadata. attribute value type, and convert the first attribute value corresponding to any first attribute into a target attribute value according to the attribute value type corresponding to any first attribute; execute the first conversion step cyclically, convert all The first attribute value corresponding to each first attribute in the plurality of first attributes is converted into a target attribute value, so as to obtain a plurality of target attribute values respectively corresponding to the plurality of first attributes.
  • a second attribute name consistent with the first attribute name is determined in the attribute metadata according to the first attribute name, and according to the attribute value type corresponding to the second attribute name, the first attribute is changed according to the attribute value type.
  • the value is converted into the target attribute value until all the first attribute values of the first attribute are converted into the target attribute value.
  • attribute value types include but are not limited to: string type, Boolean type, and numeric type.
  • attribute value types include but are not limited to: string type, Boolean type, and numeric type.
  • the first attribute data is:
  • converting the first attribute data into target attribute data according to the attribute metadata includes: determining an attribute sequence number of each first attribute according to the attribute metadata, and determining The attribute template corresponding to the smart device; writing the target attribute value of each first attribute into the corresponding field of the attribute template according to the attribute sequence number of each first attribute to obtain the target attribute data, where , the two adjacent target attribute values include: a separator, and the field number of the field is the same as the attribute sequence number.
  • the target attribute value of each first attribute is then separated by a separator according to its attribute sequence number. (such as:) are spliced together to obtain the target attribute data.
  • the first attribute data is:
  • the target attribute value of each first attribute is written into the corresponding field of the attribute template according to the attribute sequence number of each first attribute to obtain the target attribute data, including: Determine whether the target attribute value exists in all fields in the attribute template; if it is determined that the target attribute value does not exist in any of the fields, write a null value in any field. .
  • the sensor attribute value actually reported by the smart device is less than the defined value, you only need to fill in the blank where the attribute is located, which does not affect the encoding and decoding of the entire attribute data. That is to say, if three sensor attributes are defined in the attribute metadata, but the device only reports two sensor attributes, you only need to fill in the blanks corresponding to the missing sensor attributes, for example, fill in null.
  • the first attribute data is converted into target data according to the attribute metadata.
  • the method further includes: determining whether any first attribute name among the plurality of first attribute names is consistent with any second attribute name among the plurality of second attribute names; If the first attribute name is inconsistent with any second target attribute name, conversion of the attribute value corresponding to any first attribute name is prohibited.
  • the smart device actually reports more sensor attribute values than the defined ones, it only needs to report the extra sensor attribute values according to the original format, and there is no need to modify the attribute value corresponding to any of the first attribute names. Conversion, which does not affect the encoding and decoding of the entire attribute data.
  • the method further includes: when it is determined to decode the target attribute data, converting the first attribute data into target attribute data according to the attribute metadata.
  • the data and the target attribute data determine a first attribute name corresponding to each first attribute in the plurality of first attributes and a first attribute value type corresponding to each first attribute; according to each first attribute
  • the first attribute name corresponding to an attribute and the first attribute value type corresponding to each first attribute convert the target attribute data into the first attribute data.
  • the target attribute data when the target attribute data needs to be decoded, the first attribute name corresponding to each first attribute in the plurality of first attributes and the first attribute name corresponding to each first attribute are determined according to the sequence number of the target attribute data.
  • the target attribute value is converted into the first attribute value according to the attribute value type, until all the target attribute values of the first attribute are converted into the first attribute value.
  • the target attribute data is converted into the first attribute according to the first attribute name corresponding to each first attribute and the first attribute value type corresponding to each first attribute.
  • Data including: a second conversion step: converting the target attribute value corresponding to any first attribute into the first attribute value according to the first attribute value type corresponding to any first attribute among the plurality of first attributes. , write the first attribute name corresponding to any first attribute before the first attribute value; execute the second conversion step in a loop until the target attribute value corresponding to each first attribute is converted into the first attribute value. attribute value, and write the first attribute name corresponding to each first attribute before the first attribute value to obtain the first attribute data.
  • the 0th position is refrigeratorDoorStatus
  • the 1st position is freezerTemperatureC
  • the 2nd position is envTemperature.
  • Get boolean values right should be converted so that it can be restored back to the attribute value pair json map information:
  • FIG. 3 is a schematic diagram (1) of a method for converting attribute data according to an embodiment of the present disclosure.
  • Figure 3 based on sensor attributes under the type of Internet of Things device Under the premise of certainty, all sensor attribute names, attribute value types, and location information under the relevant device type are saved in the database as metadata, which serves as the basis for encoding and decoding the attribute data reported by the device. This further reduces the length of IoT attribute data and reduces network transmission and storage space usage.
  • Step S1 Define an attribute metadata for each type of smart device, and store the attribute metadata persistently in the mysql database.
  • the attribute metadata specifically includes the following information:
  • attribute value types include but are not limited to: string, Boolean, and number.
  • Table 1 The table structure of attribute metadata is shown in Table 1:
  • Step S2 Coding process
  • the attribute data includes: attribute key and value pairs (equivalent to the plurality of first attribute names and the plurality of first attribute names corresponding to the plurality of first attributes in the above embodiment). Multiple first attribute values corresponding to the attributes respectively), such as:
  • typeId obtains the key (attrb_key), attribute value type (attrb_type) and sequence number (seqNo) of all its attributes from the attribute metadata database. As shown in table 2:
  • c) Load the metadata information (attribute key, attribute value type and sequence number) into the memory and store it in a hashmap structure.
  • Step S3 Decoding process.
  • the 0th position is refrigeratorDoorStatus
  • the 1st position is freezerTemperatureC
  • the 2nd position is envTemperature
  • the attribute The key and value are corresponding, and the Boolean type value is converted accordingly, and then the json map information corresponding to the attribute value is restored:
  • the method according to the above embodiments can be implemented by means of software plus the necessary general hardware platform. Of course, it can also be implemented by hardware, but in many cases the former is Better implementation.
  • the technical solution of the present disclosure can be embodied in the form of a software product in essence or that contributes to the existing technology.
  • the computer software product is stored in a storage medium (such as ROM/RAM, disk, CD), including several instructions to cause a terminal device (which can be a mobile phone, computer, server, or network device, etc.) to execute the methods of various embodiments of the present disclosure.
  • Figure 5 is a structural block diagram of an attribute data conversion device according to an embodiment of the present disclosure; as shown in Figure 5, it includes:
  • the first acquisition module 52 is configured to acquire first attribute data indicating a plurality of first attributes of the smart device, wherein the attribute data includes: a plurality of first attribute names corresponding to the plurality of first attributes and and a plurality of first attribute values respectively corresponding to the plurality of first attributes;
  • the second acquisition module 54 is configured to acquire attribute metadata of the smart device, where the attribute metadata includes: a plurality of second attribute names corresponding to a plurality of preset second attributes of the smart device, A plurality of attribute sequence numbers respectively corresponding to the plurality of second attributes and a plurality of attribute value types respectively corresponding to the plurality of second attributes;
  • the conversion module 56 is configured to convert the first attribute data into target attribute data according to the attribute metadata, where the target attribute data includes: a plurality of target attribute values respectively corresponding to the plurality of first attributes.
  • first attribute data indicating a plurality of first attributes of the smart device is obtained, wherein the attribute data includes: a plurality of first attribute names corresponding to the plurality of first attributes and the plurality of first attribute names. A plurality of first attribute values respectively corresponding to a plurality of first attributes; obtaining attribute metadata of the smart device, wherein the attribute metadata includes: a plurality of preset second attributes corresponding to a plurality of second attributes of the smart device.
  • the first attribute is data transfer Change to target attribute data
  • the target attribute data includes: multiple target attribute values respectively corresponding to the multiple first attributes, which solves the problem in related technologies that when the device reports attribute data, it is not conducive to network transmission and Storage, which wastes a lot of bandwidth and storage resources, and then the target attribute data in the embodiment of the present disclosure includes multiple target attribute values.
  • the conversion module 56 is configured to perform a first conversion step: determine the attribute value type corresponding to any first attribute according to the attribute metadata, and determine the attribute value type corresponding to any first attribute according to the attribute metadata.
  • the value type converts the first attribute value corresponding to any first attribute into a target attribute value; the first conversion step is executed cyclically to convert the first attribute value corresponding to each first attribute in the plurality of first attributes.
  • the attribute value is converted into a target attribute value to obtain a plurality of target attribute values respectively corresponding to the plurality of first attributes.
  • the conversion module 56 is configured to determine the attribute sequence number of each first attribute according to the attribute metadata; determine the attribute template corresponding to the smart device; The attribute sequence number of the attribute writes the target attribute value of each first attribute into the corresponding field of the attribute template to obtain the target attribute data, where the two adjacent target attribute values include: a separator, The field number of the field is the same as the attribute sequence number.
  • the conversion module 56 is configured to determine whether the target attribute value exists in all fields in the attribute template; when determining that the target attribute value does not exist in any of the fields, In the event that a null value is written in any of the fields.
  • the conversion module 56 is configured to determine whether any first attribute name among the plurality of first attribute names is consistent with any second attribute name among the plurality of second attribute names. ; When any first attribute name is inconsistent with any second target attribute name, conversion of the attribute value corresponding to any first attribute name is prohibited.
  • the conversion module 56 is configured to determine, according to the attribute metadata and the target attribute data, one of the plurality of first attributes when it is determined to decode the target attribute data.
  • the first attribute value type converts the target attribute data into the first attribute data.
  • the conversion module 56 is further configured to perform a second conversion step: convert any first attribute corresponding to a first attribute value type corresponding to any one of a plurality of first attributes. Convert the target attribute value to the first attribute value, write the first attribute name corresponding to any first attribute before the first attribute value; perform the second conversion step in a loop until each The target attribute value corresponding to the first attribute is converted into a first attribute value, and the first attribute name corresponding to each first attribute is written before the first attribute value to obtain the first attribute data.
  • An embodiment of the present disclosure also provides a storage medium that includes a stored program, wherein the method of any of the above items is executed when the program is run.
  • the above-mentioned storage medium may be configured to store program codes for performing the following steps:
  • first attribute data indicating multiple first attributes of the smart device, where the attribute data includes: multiple first attribute names corresponding to the multiple first attributes and the multiple first attribute names and the multiple first attribute names. Multiple first attribute values respectively corresponding to one attribute;
  • S2 Obtain attribute metadata of the smart device, where the attribute metadata includes: a plurality of second attribute names respectively corresponding to a plurality of second attributes of the smart device set in advance, the plurality of second attribute metadata. Multiple attribute sequence numbers respectively corresponding to the attributes and multiple attribute value types respectively corresponding to the plurality of second attributes;
  • S3 Convert the first attribute data into target attribute data according to the attribute metadata, where the target attribute data includes: a plurality of target attribute values respectively corresponding to the plurality of first attributes.
  • an electronic device for implementing the above attribute data conversion method is also provided.
  • the electronic device includes a memory 602 and a processor 604.
  • the memory 602 stores There is a computer program, and the processor 604 is configured to execute the steps in any of the above method embodiments through the computer program.
  • the above-mentioned electronic device may be located in at least one network device among multiple network devices of the computer network.
  • the above-mentioned processor may be configured to perform the following steps through a computer program:
  • first attribute data indicating multiple first attributes of the smart device, where the attribute data includes: multiple first attribute names corresponding to the multiple first attributes and the multiple first attribute names and the multiple first attribute names. Multiple first attribute values respectively corresponding to one attribute;
  • S2 Obtain attribute metadata of the smart device, where the attribute metadata includes: a plurality of second attribute names respectively corresponding to a plurality of second attributes of the smart device set in advance, the plurality of second attribute metadata. Multiple attribute sequence numbers respectively corresponding to the attributes and multiple attribute value types respectively corresponding to the plurality of second attributes;
  • S3 Convert the first attribute data into target attribute data according to the attribute metadata, where the target attribute data includes: a plurality of target attribute values respectively corresponding to the plurality of first attributes.
  • the structure shown in Figure 6 is only illustrative, and the electronic device can also be a smart phone (such as an Android phone, an iOS phone, etc.), a tablet computer, a handheld computer, and a mobile Internet device (Mobile Internet Devices, MID), PAD and other terminal equipment.
  • FIG. 6 does not limit the structure of the above-mentioned electronic device.
  • the electronic device may also include more or fewer components (such as network interfaces, etc.) than shown in FIG. 6 , or have a different configuration than that shown in FIG. 6 .
  • the memory 602 can be used to store software programs and modules, such as the program instructions/modules corresponding to the attribute data conversion method and device in the embodiment of the present disclosure.
  • the processor 604 runs the software programs and modules stored in the memory 602, thereby Execute various functional applications and data processing, that is, implement the above attribute data conversion method.
  • Memory 602 may include high-speed random access memory, and may also include non-volatile memory, such as one or more magnetic storage devices, flash memory, or other non-volatile solid-state memory.
  • the memory 602 may further include memory located remotely relative to the processor 604, and these remote memories may be connected to the terminal through a network.
  • the above-mentioned networks include but are not limited to the Internet, intranets, local area networks, mobile communication networks and combinations thereof.
  • the memory 602 may include, but is not limited to, the first acquisition module 52 , the second acquisition module 54 , and the conversion module 56 in the attribute data conversion device. In addition, it may also include but is not limited to other module units in the above attribute data conversion device, which will not be described again in this example.
  • the above-mentioned transmission device 606 is used to receive or send data via a network.
  • Specific examples of the above-mentioned network may include wired networks and wireless networks.
  • the transmission device 606 includes a network adapter (Network Interface Controller, NIC), which can communicate with other network devices through network cables. The device is connected to the router so it can communicate with the Internet or LAN.
  • the transmission device 606 is a radio frequency (Radio Frequency, RF) module, which is used to communicate with the Internet wirelessly.
  • RF Radio Frequency
  • the above-mentioned electronic device also includes: a display 608 for displaying the above-mentioned attribute data; and a connection bus 610 for connecting various module components in the above-mentioned electronic device.
  • the above storage medium may include but is not limited to: U disk, read-only memory (Read-Only Memory, referred to as ROM), random access memory (Random Access Memory, referred to as RAM), Various media that can store program code, such as mobile hard drives, magnetic disks, or optical disks.
  • ROM read-only memory
  • RAM random access memory
  • program code such as mobile hard drives, magnetic disks, or optical disks.
  • modules or steps of the present disclosure can be implemented using general-purpose computing devices, and they can be concentrated on a single computing device, or distributed across a network composed of multiple computing devices. , optionally, they may be implemented in program code executable by a computing device, such that they may be stored in a storage device for execution by the computing device, and in some cases, may be in a sequence different from that herein.
  • the steps shown or described are performed either individually as individual integrated circuit modules, or as multiple modules or steps among them as a single integrated circuit module. As such, the present disclosure is not limited to any specific combination of hardware and software.

Landscapes

  • Engineering & Computer Science (AREA)
  • Theoretical Computer Science (AREA)
  • Databases & Information Systems (AREA)
  • Physics & Mathematics (AREA)
  • General Engineering & Computer Science (AREA)
  • General Physics & Mathematics (AREA)
  • Human Computer Interaction (AREA)
  • Data Mining & Analysis (AREA)
  • Health & Medical Sciences (AREA)
  • Computational Linguistics (AREA)
  • General Health & Medical Sciences (AREA)
  • Audiology, Speech & Language Pathology (AREA)
  • Artificial Intelligence (AREA)
  • Information Retrieval, Db Structures And Fs Structures Therefor (AREA)
  • Signal Processing For Digital Recording And Reproducing (AREA)

Abstract

本公开提供了一种属性数据的转换方法和装置、存储介质及电子装置,涉及智慧家庭技术领域,该属性数据的转换方法包括:获取用于指示智能设备的多个第一属性的第一属性数据,其中,属性数据包括:多个第一属性分别对应的多个第一属性名和以及多个第一属性分别对应的多个第一属性值;获取智能设备的属性元数据,其中,属性元数据包括:预先设置的智能设备的多个第二属性分别对应的多个第二属性名、多个第二属性分别对应的多个属性顺序号和多个第二属性分别对应的多个属性值类型;根据属性元数据将第一属性数据转换为目标属性数据,其中,目标属性数据包括:多个第一属性分别对应的多个目标属性值。

Description

属性数据的转换方法和装置、存储介质及电子装置
本公开要求于2022年6月29日提交中国专利局、申请号为202210753862.6、发明名称“属性数据的转换方法和装置、存储介质及电子装置”的中国专利申请的优先权,其全部内容通过引用结合在本公开中。
技术领域
本公开涉及通信领域,具体而言,涉及一种属性数据的转换方法和装置、存储介质及电子装置。
背景技术
在物联网领域,联网的设备类型很多,如电视,冰箱,空调等,而且每类设备还有若干细分类型,这些不同类型的设备因为内置传感器的差异,上报的属性数据中包含该设备的类型标识和若干对应的传感器属性值对。
对于一个具体细分类型的设备来说,其内部的传感器是确定不变的,所以这些属性数据中的属性名都是固定不变的,变化的只是属性值。如果每一条上报属性数据都包含属性的属性名的话,这就会带来大量额外的带宽和存储负担。
针对相关技术中,设备在进行属性数据上报时,不利于网络传输和存储,浪费大量带宽和存储资源,尚未提出有效的解决方案。
发明内容
本公开实施例提供了一种属性数据的转换方法和装置、存储介质及电子装置,以至少解决相关技术中,设备在进行属性数据上报时,不利于网络传输和存储,浪费大量带宽和存储资源。
根据本公开实施例的一个实施例,提供了一种属性数据的转换方法,包括:获取用于指示智能设备的多个第一属性的第一属性数据,其中,所述属性数据包括:所述多个第一属性分别对应的多个第一属性名和以及所述多个第一属性分别对应的多个第一属性值;获取所述智能设备的属性元数据,其中,所述属性元数 据包括:预先设置的所述智能设备的多个第二属性分别对应的多个第二属性名、所述多个第二属性分别对应的多个属性顺序号和所述多个第二属性分别对应的多个属性值类型;根据所述属性元数据将所述第一属性数据转换为目标属性数据,其中,所述目标属性数据包括:所述多个第一属性分别对应的多个目标属性值。
根据本公开实施例的另一个实施例,还提供了一种属性数据的转换装置,包括:第一获取模块,设置为获取用于指示智能设备的多个第一属性的第一属性数据,其中,所述属性数据包括:所述多个第一属性分别对应的多个第一属性名和以及所述多个第一属性分别对应的多个第一属性值;第二获取模块,设置为获取所述智能设备的属性元数据,其中,所述属性元数据包括:预先设置的所述智能设备的多个第二属性分别对应的多个第二属性名、所述多个第二属性分别对应的多个属性顺序号和所述多个第二属性分别对应的多个属性值类型;转换模块,设置为根据所述属性元数据将所述第一属性数据转换为目标属性数据,其中,所述目标属性数据包括:所述多个第一属性分别对应的多个目标属性值。
根据本公开实施例的又一方面,还提供了一种计算机可读的存储介质,该计算机可读的存储介质中存储有计算机程序,其中,该计算机程序被设置为运行时执行上述属性数据的转换方法。
根据本公开实施例的又一方面,还提供了一种电子装置,包括存储器、处理器及存储在存储器上并可在处理器上运行的计算机程序,其中,上述处理器通过计算机程序执行上述的属性数据的转换方法。
附图说明
此处的附图被并入说明书中并构成本说明书的一部分,示出了符合本公开的实施例,并与说明书一起用于解释本公开的原理。
为了更清楚地说明本公开实施例或现有技术中的技术方案,下面将对实施例或现有技术描述中所需要使用的附图作简单地介绍,显而易见地,对于本领域普通技术人员而言,在不付出创造性劳动性的前提下,还可以根据这些附图获得其他的附图。
图1是本公开实施例的一种属性数据的转换方法的硬件环境示意图;
图2是根据本公开实施例的属性数据的转换方法的流程图;
图3是根据本公开实施例的属性数据的转换方法的示意图(一);
图4是根据本公开实施例的属性数据的转换方法的示意图(二);
图5是根据本公开实施例的一种属性数据的转换装置的结构框图;
图6是根据本公开实施例的一种可选的电子装置的结构框图。
具体实施方式
为了使本技术领域的人员更好地理解本公开方案,下面将结合本公开实施例中的附图,对本公开实施例中的技术方案进行清楚、完整地描述,显然,所描述的实施例仅仅是本公开一部分的实施例,而不是全部的实施例。基于本公开中的实施例,本领域普通技术人员在没有做出创造性劳动前提下所获得的所有其他实施例,都应当属于本公开保护的范围。
需要说明的是,本公开的说明书和权利要求书及上述附图中的术语“第一”、“第二”等是设置为区别类似的对象,而不必用于描述特定的顺序或先后次序。应该理解这样使用的数据在适当情况下可以互换,以便这里描述的本公开的实施例能够以除了在这里图示或描述的那些以外的顺序实施。此外,术语“包括”和“具有”以及他们的任何变形,意图在于覆盖不排他的包含,例如,包含了一系列步骤或单元的过程、方法、系统、产品或设备不必限于清楚地列出的那些步骤或单元,而是可包括没有清楚地列出的或对于这些过程、方法、产品或设备固有的其它步骤或单元。
根据本公开实施例的一个方面,提供了一种属性数据的转换方法。该属性数据的转换方法广泛应用于智慧家庭(Smart Home)、智能家居、智能家用设备生态、智慧住宅(Intelligence House)生态等全屋智能数字化控制应用场景。可选地,在本实施例中,上述属性数据的转换方法可以应用于如图1所示的由终端设备102和服务器104所构成的硬件环境中。如图1所示,服务器104通过网络与终端设备102进行连接,可设置为为终端或终端上安装的客户端提供服务(如应 用服务等),可在服务器上或独立于服务器设置数据库,用于为服务器104提供数据存储服务,可在服务器上或独立于服务器配置云计算和/或边缘计算服务,用于为服务器104提供数据运算服务。
上述网络可以包括但不限于以下至少之一:有线网络,无线网络。上述有线网络可以包括但不限于以下至少之一:广域网,城域网,局域网,上述无线网络可以包括但不限于以下至少之一:WIFI(Wireless Fidelity,无线保真),蓝牙。终端设备102可以并不限定于为PC、手机、平板电脑、智能空调、智能烟机、智能冰箱、智能烤箱、智能炉灶、智能洗衣机、智能热水器、智能洗涤设备、智能洗碗机、智能投影设备、智能电视、智能晾衣架、智能窗帘、智能影音、智能插座、智能音响、智能音箱、智能新风设备、智能厨卫设备、智能卫浴设备、智能扫地机器人、智能擦窗机器人、智能拖地机器人、智能空气净化设备、智能蒸箱、智能微波炉、智能厨宝、智能净化器、智能饮水机、智能门锁等。
在本实施例中提供了一种属性数据的转换方法,应用于计算机终端,图2是根据本公开实施例的属性数据的转换方法的流程图,该流程包括如下步骤:
步骤S202,获取用于指示智能设备的多个第一属性的第一属性数据,其中,所述属性数据包括:所述多个第一属性分别对应的多个第一属性名和以及所述多个第一属性分别对应的多个第一属性值;
举例来讲,在第一属性数据为:
{"refrigeratorDoorStatus":"false","envTemperature":"29","freezerTemperatureC":"-18"}的情况下,"refrigeratorDoorStatus"、"envTemperature"、"freezerTemperatureC"为多个第一属性分别对应的多个第一属性名;"false"、"29"、"-18"为所述多个第一属性分别对应的多个第一属性值,需要说明的是,本公开实施例对第一属性数据的具体含义不作限定。
步骤S204,获取所述智能设备的属性元数据,其中,所述属性元数据包括:预先设置的所述智能设备的多个第二属性分别对应的多个第二属性名、所述多个第二属性分别对应的多个属性顺序号和所述多个第二属性分别对应的多个属性值类型;
步骤S206,根据所述属性元数据将所述第一属性数据转换为目标属性数据,其中,所述目标属性数据包括:所述多个第一属性分别对应的多个目标属性值。
通过上述步骤,获取用于指示智能设备的多个第一属性的第一属性数据,其中,所述属性数据包括:所述多个第一属性分别对应的多个第一属性名和以及所述多个第一属性分别对应的多个第一属性值;获取所述智能设备的属性元数据,其中,所述属性元数据包括:预先设置的所述智能设备的多个第二属性分别对应的多个第二属性名、所述多个第二属性分别对应的多个属性顺序号和所述多个第二属性分别对应的多个属性值类型;根据所述属性元数据将所述第一属性数据转换为目标属性数据,其中,所述目标属性数据包括:所述多个第一属性分别对应的多个目标属性值,解决了相关技术中,设备在进行属性数据上报时,不利于网络传输和存储,浪费大量带宽和存储资源,进而在本公开实施例中的目标属性数据中包括多个目标属性值,去掉了每个属性中的属性名后,从复杂的json map格式转换为简单的字符串拼接格式,减少了数据量,进而大大降低对网络和存储的要求,以及更加节约带宽和存储资源。
在一个示例性实施例中,根据所述属性元数据将所述第一属性数据转换为目标属性数据的过程中,包括:第一转换步骤:根据所述属性元数据确定任一第一属性对应的属性值类型,并根据所述任一第一属性对应的属性值类型将所述任一第一属性对应的第一属性值转换为目标属性值;循环执行所述第一转换步骤,将所述多个第一属性中的每一个第一属性对应的第一属性值转换为目标属性值,以获取所述多个第一属性分别对应的多个目标属性值。
具体的,根据第一属性名在属性元数据中确定与第一属性名一致的第二属性名,以及根据所述第二属性名对应的属性值类型,根据所述属性值类型将第一属性值转化为目标属性值,直至将所有的第一属性的第一属性值转换为目标属性值。
具体的,属性值类型包括但不限于:字符串型、布尔型、数字型,举例来讲,在第一属性数据为:
{"refrigeratorDoorStatus":"false","envTemperature":"29","freezerTemperatureC":"-18"}的情况下,且"refrigeratorDoorStatus"对应的属性值类型为布尔型、"envTemperature"对应的属性值类型为数字型、"freezerTemperatureC"对应的属性 值类型为数字型的情况下,将"false"转换为"0"或"1",将"29"转换为"29",将"-18"转换为"-18"。
在一个示例性实施例中,根据所述属性元数据将所述第一属性数据转换为目标属性数据,包括:根据所述属性元数据确定所述每一个第一属性的属性顺序号,以及确定所述智能设备对应的属性模板;根据所述每一个第一属性的属性顺序号将所述每一个第一属性的目标属性值写入所述属性模板对应的字段,以得到目标属性数据,其中,相邻的两个目标属性值之间包括:分隔符,所述字段的字段号与所述属性顺序号相同。
由于根据属性元数据可以确定每一个第一属性的属性顺序号,因此按照所述每一个第一属性的属性顺序号,然后把每一个第一属性的目标属性值依照其属性顺序号用分隔符(如:)拼接起来,以得到目标属性数据。
举例来讲,在第一属性数据为:
{"refrigeratorDoorStatus":"false","envTemperature":"29","freezerTemperatureC":"-18"}的情况下,且"refrigeratorDoorStatus"对应的属性值类型为布尔型、属性顺序号为0;"envTemperature"对应的属性值类型为数字型、属性顺序号为2;"freezerTemperatureC"对应的属性值类型为数字型、属性顺序号为1的情况下,将"false"转换为"0"或"1",将"29"转换为"29",将"-18"转换为"-18",目标属性数据为:{"0":"-18":"29"}。
在一个示例性实施例中,根据所述每一个第一属性的属性顺序号将所述每一个第一属性的目标属性值写入所述属性模板对应的字段,以得到目标属性数据,包括:确定所述属性模板中的所有字段是否均存在所述目标属性值;在确定所述所有字段中任一字段中不存在所述目标属性值的情况下,在所述任一字段写入空值。
可以理解为,如果智能设备实际上报的传感器属性值比定义的要少,只需要将该属性所在位置填空,进而可以不影响整条属性数据的编解码。也就是说,在属性元数据中定义了三个传感器属性,而只能设备仅上报了两个传感器属性的情况下,仅需将缺少的传感器属性对应的位置填空,例如,填入null。
在一个示例性实施例中,根据所述属性元数据将所述第一属性数据转换为目 标属性数据之前,还包括:确定所述多个第一属性名中的任一第一属性名与所述多个第二属性名中的任一第二属性名是否一致;在所述任一第一属性名与所述任一第二目标属性名不一致的情况下,禁止对所述任一第一属性名对应的属性值进行转换。
可以理解为,如果智能设备实际上报的传感器属性值比定义的要多,只需将多出的传感器属性值按照原来的格式进行上报,不必对所述任一第一属性名对应的属性值进行转换,进而可以不影响整条属性数据的编解码。
在一个示例性实施例中,根据所述属性元数据将所述第一属性数据转换为目标属性数据之后,还包括:在确定对所述目标属性数据进行解码的情况下,根据所述属性元数据和所述目标属性数据确定所述多个第一属性中的每一个第一属性对应的第一属性名、所述每一个第一属性对应的第一属性值类型;根据所述每一个第一属性对应的第一属性名、所述每一个第一属性对应的第一属性值类型将所述目标属性数据转换为所述第一属性数据。
也就是说,在需要对目标属性数据进行解码的情况下,根据目标属性数据的顺序序号确定多个第一属性中的每一个第一属性对应的第一属性名、所述每一个第一属性对应的第一属性值类型,根据所述属性值类型将目标属性值转化为第一属性值,直至将所有的第一属性的目标属性值转化为第一属性值。
在一个示例性实施例中,根据所述每一个第一属性对应的第一属性名、所述每一个第一属性对应的第一属性值类型将所述目标属性数据转换为所述第一属性数据,包括:第二转换步骤:根据多个第一属性中的任一第一属性对应的第一属性值类型将所述任一第一属性对应的目标属性值转换为所述第一属性值,将所述任一第一属性对应的第一属性名写入所述第一属性值之前;循环执行所述第二转换步骤,直至将每一个第一属性对应的目标属性值转换为第一属性值,并将所述每一个第一属性对应的第一属性名写入所述第一属性值之前,以获取所述第一属性数据。
举例来讲,根据属性值的位置顺序找到对应的属性名和属性值类型,如第0位为refrigeratorDoorStatus,第1位为freezerTemperatureC,第2位为envTemperature,这样就能把属性名和属性值对应起来,同时把布尔类型值做对 应转换,这样就可以还原回属性值对json map信息:
{"refrigeratorDoorStatus":"false","freezerTemperatureC":"-18","envTemperature":"29"}。
为了更好的理解上述属性数据的转换方法的过程,以下再结合可选实施例对上述属性数据的转换的实现方法流程进行说明,但不用于限定本公开实施例的技术方案。
在本实施例中提供了一种属性数据的转换方法,图3是根据本公开实施例的属性数据的转换方法的示意图(一),如图3所示,基于物联网设备类型下的传感器属性确定性的前提下,把相关设备类型下的所有传感器属性名,属性值类型,位置信息作为元数据保存到数据库中,作为对设备上报属性数据编码和解码的依据。进而减少了物联网属性数据的长度,减少网络传输和存储空间占用。
具体的属性数据编码和解码步骤如下:
步骤S1:为每类智能设备定义一份属性元数据,并将属性元数据持久化存储在mysql数据库中,其中,属性元数据具体包含以下信息:
a)设备类型标识:typeId,需要说明的是,typeId下的所有设备都有相同的传感器属性。
b)整理每类智能设备的所有传感器属性名的有序列表以及其属性值类型,属性值类型包括但不限于:字符串,布尔,数字。属性元数据的表结构如表1所示:
表1

步骤S2:编码过程;
a)接收设备上报的属性数据,属性数据包括:属性key和value值对(相当于上述实施例中的所述多个第一属性分别对应的多个第一属性名和以及所述多个第一属性分别对应的多个第一属性值),如:
{"refrigeratorDoorStatus":"false","envTemperature":"29","freezerTemperatureC":"high"}这3个属性的key和value。
b)根据设备上报的属性数据中的其类型标识:typeId从属性元数据库中得到其所有的属性的key(attrb_key)、属性值类型(attrb_type)和顺序号(seqNo)。如表2所示:
表2
c)将元数据信息(属性的key、属性值类型和顺序号)加载至内存,采用hashmap结构存储,根据属性名就可以快速查询到其位置序号信息,如refrigeratorDoorStatus为第0位,freezerTemperatureC为第1位,envTemperature为第2位,然后把各自的属性值依照其位置用分隔符(如:)拼接起来。
如图4所示,即把
{"refrigeratorDoorStatus":"false","envTemperature":"29","freezerTemperatureC":"high"}转换为:"false:high:29",长度从85减少到了13,大小减少了75%,更进一步,由于确定了属性的属性值类型,可以把布尔类型的值进一步简化:用0来表示false,1来表示true,这样就进一步减少记录长度为9,比原始长度减少了 90%。
步骤S3:解码过程。
a)接收到编码后的属性数据,如:"0:high:29"以及类型typeId值,根据其typeId从属性元数据库中得到其所有的属性的key(attrb_key)、属性值类型(attrb_type)和顺序号(seqNo)。如:
解码前把这些信息按顺序加载到一个List中,根据属性值的位置顺序找到对应的属性key和属性值类型,如第0位为refrigeratorDoorStatus,第1位为freezerTemperatureC,第2位为envTemperature,把属性key和value对应起来,同时把布尔类型值做对应转换,进而还原回属性值对应的json map信息:
{"refrigeratorDoorStatus":"false","freezerTemperatureC":"high","envTemperatur e":"29"}。
根据本公开的实施例,可以达到以下技术效果:
1)消息长度大幅减少:去掉了每条记录中的属性名后,从复杂的json map格式转换为简单的字符串拼接格式,大小减少为原始大小的10%左右,大大降低对网络和存储的要求。
2)编码/解码性能高:编码/解码前先把对应设备类型的属性元数据加载到内存中,查找性能高。
3)通用性好:可以同时支持多种设备类型的属性数据编解码。
4)兼容性好:如果某类设备实际上报的传感器属性值比定义的要少,也不影响整条数据编解码,只是该属性所在位置填空。如果某类设备实际上报的传感 器属性值比定义的要多,也不影响整条数据编解码,只是丢弃此属性值。
通过以上的实施方式的描述,本领域的技术人员可以清楚地了解到根据上述实施例的方法可借助软件加必需的通用硬件平台的方式来实现,当然也可以通过硬件,但很多情况下前者是更佳的实施方式。基于这样的理解,本公开的技术方案本质上或者说对现有技术做出贡献的部分可以以软件产品的形式体现出来,该计算机软件产品存储在一个存储介质(如ROM/RAM、磁碟、光盘)中,包括若干指令用以使得一台终端设备(可以是手机,计算机,服务器,或者网络设备等)执行本公开各个实施例的方法。
图5是根据本公开实施例的一种属性数据的转换装置的结构框图;如图5所示,包括:
第一获取模块52,设置为获取用于指示智能设备的多个第一属性的第一属性数据,其中,所述属性数据包括:所述多个第一属性分别对应的多个第一属性名和以及所述多个第一属性分别对应的多个第一属性值;
第二获取模块54,设置为获取所述智能设备的属性元数据,其中,所述属性元数据包括:预先设置的所述智能设备的多个第二属性分别对应的多个第二属性名、所述多个第二属性分别对应的多个属性顺序号和所述多个第二属性分别对应的多个属性值类型;
转换模块56,设置为根据所述属性元数据将所述第一属性数据转换为目标属性数据,其中,所述目标属性数据包括:所述多个第一属性分别对应的多个目标属性值。
通过上述装置,获取用于指示智能设备的多个第一属性的第一属性数据,其中,所述属性数据包括:所述多个第一属性分别对应的多个第一属性名和以及所述多个第一属性分别对应的多个第一属性值;获取所述智能设备的属性元数据,其中,所述属性元数据包括:预先设置的所述智能设备的多个第二属性分别对应的多个第二属性名、所述多个第二属性分别对应的多个属性顺序号和所述多个第二属性分别对应的多个属性值类型;根据所述属性元数据将所述第一属性数据转 换为目标属性数据,其中,所述目标属性数据包括:所述多个第一属性分别对应的多个目标属性值,解决了相关技术中,设备在进行属性数据上报时,不利于网络传输和存储,浪费大量带宽和存储资源,进而在本公开实施例中的目标属性数据中包括多个目标属性值,去掉了每个属性中的属性名后,从复杂的json map格式转换为简单的字符串拼接格式,减少了数据量,进而大大降低对网络和存储的要求,以及更加节约带宽和存储资源。
在一个示例性实施例中,转换模块56,设置为执行第一转换步骤:根据所述属性元数据确定任一第一属性对应的属性值类型,并根据所述任一第一属性对应的属性值类型将所述任一第一属性对应的第一属性值转换为目标属性值;循环执行所述第一转换步骤,将所述多个第一属性中的每一个第一属性对应的第一属性值转换为目标属性值,以获取所述多个第一属性分别对应的多个目标属性值。
在一个示例性实施例中,转换模块56,设置为根据所述属性元数据确定所述每一个第一属性的属性顺序号;确定所述智能设备对应的属性模板;根据所述每一个第一属性的属性顺序号将所述每一个第一属性的目标属性值写入所述属性模板对应的字段,以得到目标属性数据,其中,相邻的两个目标属性值之间包括:分隔符,所述字段的字段号与所述属性顺序号相同。
在一个示例性实施例中,转换模块56,设置为确定所述属性模板中的所有字段是否均存在所述目标属性值;在确定所述所有字段中任一字段中不存在所述目标属性值的情况下,在所述任一字段写入空值。
在一个示例性实施例中,转换模块56,设置为确定所述多个第一属性名中的任一第一属性名与所述多个第二属性名中的任一第二属性名是否一致;在所述任一第一属性名与所述任一第二目标属性名不一致的情况下,禁止对所述任一第一属性名对应的属性值进行转换。
在一个示例性实施例中,转换模块56,设置为在确定对所述目标属性数据进行解码的情况下,根据所述属性元数据和所述目标属性数据确定所述多个第一属性中的每一个第一属性对应的第一属性名、所述每一个第一属性对应的第一属性值类型;根据所述每一个第一属性对应的第一属性名、所述每一个第一属性对应的第一属性值类型将所述目标属性数据转换为所述第一属性数据。
在一个示例性实施例中,转换模块56,还设置为执行第二转换步骤:根据多个第一属性中的任一第一属性对应的第一属性值类型将所述任一第一属性对应的目标属性值转换为所述第一属性值,将所述任一第一属性对应的第一属性名写入所述第一属性值之前;循环执行所述第二转换步骤,直至将每一个第一属性对应的目标属性值转换为第一属性值,并将所述每一个第一属性对应的第一属性名写入所述第一属性值之前,以获取所述第一属性数据。
本公开的实施例还提供了一种存储介质,该存储介质包括存储的程序,其中,上述程序运行时执行上述任一项的方法。
可选地,在本实施例中,上述存储介质可以被设置为存储用于执行以下步骤的程序代码:
S1,获取用于指示智能设备的多个第一属性的第一属性数据,其中,所述属性数据包括:所述多个第一属性分别对应的多个第一属性名和以及所述多个第一属性分别对应的多个第一属性值;
S2,获取所述智能设备的属性元数据,其中,所述属性元数据包括:预先设置的所述智能设备的多个第二属性分别对应的多个第二属性名、所述多个第二属性分别对应的多个属性顺序号和所述多个第二属性分别对应的多个属性值类型;
S3,根据所述属性元数据将所述第一属性数据转换为目标属性数据,其中,所述目标属性数据包括:所述多个第一属性分别对应的多个目标属性值。
根据本公开实施例的又一个方面,还提供了一种用于实施上述属性数据的转换方法的电子装置,如图6所示,该电子装置包括存储器602和处理器604,该存储器602中存储有计算机程序,该处理器604被设置为通过计算机程序执行上述任一项方法实施例中的步骤。
可选地,在本实施例中,上述电子装置可以位于计算机网络的多个网络设备中的至少一个网络设备。
可选地,在本实施例中,上述处理器可以被设置为通过计算机程序执行以下步骤:
S1,获取用于指示智能设备的多个第一属性的第一属性数据,其中,所述属性数据包括:所述多个第一属性分别对应的多个第一属性名和以及所述多个第一属性分别对应的多个第一属性值;
S2,获取所述智能设备的属性元数据,其中,所述属性元数据包括:预先设置的所述智能设备的多个第二属性分别对应的多个第二属性名、所述多个第二属性分别对应的多个属性顺序号和所述多个第二属性分别对应的多个属性值类型;
S3,根据所述属性元数据将所述第一属性数据转换为目标属性数据,其中,所述目标属性数据包括:所述多个第一属性分别对应的多个目标属性值。
可选地,本领域普通技术人员可以理解,图6所示的结构仅为示意,电子装置也可以是智能手机(如Android手机、iOS手机等)、平板电脑、掌上电脑以及移动互联网设备(Mobile Internet Devices,MID)、PAD等终端设备。图6其并不对上述电子装置的结构造成限定。例如,电子装置还可包括比图6中所示更多或者更少的组件(如网络接口等),或者具有与图6所示不同的配置。
其中,存储器602可用于存储软件程序以及模块,如本公开实施例中的属性数据的转换方法和装置对应的程序指令/模块,处理器604通过运行存储在存储器602内的软件程序以及模块,从而执行各种功能应用以及数据处理,即实现上述的属性数据的转换方法。存储器602可包括高速随机存储器,还可以包括非易失性存储器,如一个或者多个磁性存储装置、闪存、或者其他非易失性固态存储器。在一些实例中,存储器602可进一步包括相对于处理器604远程设置的存储器,这些远程存储器可以通过网络连接至终端。上述网络的实例包括但不限于互联网、企业内部网、局域网、移动通信网及其组合。作为一种示例,如图6所示,上述存储器602中可以但不限于包括上述属性数据的转换装置中的第一获取模块52、第二获取模块54、转换模块56。此外,还可以包括但不限于上述属性数据的转换装置中的其他模块单元,本示例中不再赘述。
可选地,上述的传输装置606用于经由一个网络接收或者发送数据。上述的网络具体实例可包括有线网络及无线网络。在一个实例中,传输装置606包括一个网络适配器(Network Interface Controller,NIC),其可通过网线与其他网络设 备与路由器相连从而可与互联网或局域网进行通讯。在一个实例中,传输装置606为射频(Radio Frequency,RF)模块,其用于通过无线方式与互联网进行通讯。
此外,上述电子装置还包括:显示器608,用于显示上述属性数据;和连接总线610,用于连接上述电子装置中的各个模块部件。
可选地,在本实施例中,上述存储介质可以包括但不限于:U盘、只读存储器(Read-Only Memory,简称为ROM)、随机存取存储器(Random Access Memory,简称为RAM)、移动硬盘、磁碟或者光盘等各种可以存储程序代码的介质。
可选地,本实施例中的具体示例可以参考上述实施例及可选实施方式中所描述的示例,本实施例在此不再赘述。
显然,本领域的技术人员应该明白,上述的本公开的各模块或各步骤可以用通用的计算装置来实现,它们可以集中在单个的计算装置上,或者分布在多个计算装置所组成的网络上,可选地,它们可以用计算装置可执行的程序代码来实现,从而,可以将它们存储在存储装置中由计算装置来执行,并且在某些情况下,可以以不同于此处的顺序执行所示出或描述的步骤,或者将它们分别制作成各个集成电路模块,或者将它们中的多个模块或步骤制作成单个集成电路模块来实现。这样,本公开不限制于任何特定的硬件和软件结合。
以上所述仅是本公开的优选实施方式,应当指出,对于本技术领域的普通技术人员来说,在不脱离本公开原理的前提下,还可以做出若干改进和润饰,这些改进和润饰也应视为本公开的保护范围。

Claims (16)

  1. 一种属性数据的转换方法,包括:
    获取设置为指示智能设备的多个第一属性的第一属性数据,其中,所述属性数据包括:所述多个第一属性分别对应的多个第一属性名和以及所述多个第一属性分别对应的多个第一属性值;
    获取所述智能设备的属性元数据,其中,所述属性元数据包括:预先设置的所述智能设备的多个第二属性分别对应的多个第二属性名、所述多个第二属性分别对应的多个属性顺序号和所述多个第二属性分别对应的多个属性值类型;
    根据所述属性元数据将所述第一属性数据转换为目标属性数据,其中,所述目标属性数据包括:所述多个第一属性分别对应的多个目标属性值。
  2. 根据权利要求1所述的属性数据的转换方法,其中,根据所述属性元数据将所述第一属性数据转换为目标属性数据的过程中,包括:
    第一转换步骤:根据所述属性元数据确定任一第一属性对应的属性值类型,并根据所述任一第一属性对应的属性值类型将所述任一第一属性对应的第一属性值转换为目标属性值;
    循环执行所述第一转换步骤,将所述多个第一属性中的每一个第一属性对应的第一属性值转换为目标属性值,以获取所述多个第一属性分别对应的多个目标属性值。
  3. 根据权利要求2所述的属性数据的转换方法,其中,根据所述属性元数据将所述第一属性数据转换为目标属性数据,包括:
    根据所述属性元数据确定所述每一个第一属性的属性顺序号;
    确定所述智能设备对应的属性模板;
    根据所述每一个第一属性的属性顺序号将所述每一个第一属性的目标属 性值写入所述属性模板对应的字段,以得到目标属性数据,其中,相邻的两个目标属性值之间包括:分隔符,所述字段的字段号与所述属性顺序号相同。
  4. 根据权利要求3所述的属性数据的转换方法,其中,根据所述每一个第一属性的属性顺序号将所述每一个第一属性的目标属性值写入所述属性模板对应的字段,以得到目标属性数据,包括:
    确定所述属性模板中的所有字段是否均存在所述目标属性值;
    在确定所述所有字段中任一字段中不存在所述目标属性值的情况下,在所述任一字段写入空值。
  5. 根据权利要求1所述的属性数据的转换方法,其中,根据所述属性元数据将所述第一属性数据转换为目标属性数据之前,所述方法还包括:
    确定所述多个第一属性名中的任一第一属性名与所述多个第二属性名中的任一第二属性名是否一致;
    在所述任一第一属性名与所述任一第二目标属性名不一致的情况下,禁止对所述任一第一属性名对应的属性值进行转换。
  6. 根据权利要求1所述的属性数据的转换方法,其中,根据所述属性元数据将所述第一属性数据转换为目标属性数据之后,所述方法还包括:
    在确定对所述目标属性数据进行解码的情况下,根据所述属性元数据和所述目标属性数据确定所述多个第一属性中的每一个第一属性对应的第一属性名、所述每一个第一属性对应的第一属性值类型;
    根据所述每一个第一属性对应的第一属性名、所述每一个第一属性对应的第一属性值类型将所述目标属性数据转换为所述第一属性数据。
  7. 根据权利要求1所述的属性数据的转换方法,其中,根据所述每一个第一属性对应的第一属性名、所述每一个第一属性对应的第一属性值类型将所述目标属性数据转换为所述第一属性数据,包括:
    第二转换步骤:根据多个第一属性中的任一第一属性对应的第一属性值类 型将所述任一第一属性对应的目标属性值转换为所述第一属性值,将所述任一第一属性对应的第一属性名写入所述第一属性值之前;
    循环执行所述第二转换步骤,直至将每一个第一属性对应的目标属性值转换为第一属性值,并将所述每一个第一属性对应的第一属性名写入所述第一属性值之前,以获取所述第一属性数据。
  8. 一种属性数据的转换装置,包括:
    第一获取模块,设置为获取用于指示智能设备的多个第一属性的第一属性数据,其中,所述属性数据包括:所述多个第一属性分别对应的多个第一属性名和以及所述多个第一属性分别对应的多个第一属性值;
    第二获取模块,设置为获取所述智能设备的属性元数据,其中,所述属性元数据包括:预先设置的所述智能设备的多个第二属性分别对应的多个第二属性名、所述多个第二属性分别对应的多个属性顺序号和所述多个第二属性分别对应的多个属性值类型;
    转换模块,设置为根据所述属性元数据将所述第一属性数据转换为目标属性数据,其中,所述目标属性数据包括:所述多个第一属性分别对应的多个目标属性值。
  9. 根据权利要求8所述的属性数据的转换装置,其中,
    所述转换模块,还设置为执行第一转换步骤:根据所述属性元数据确定任一第一属性对应的属性值类型,并根据所述任一第一属性对应的属性值类型将所述任一第一属性对应的第一属性值转换为目标属性值;循环执行所述第一转换步骤,将所述多个第一属性中的每一个第一属性对应的第一属性值转换为目标属性值,以获取所述多个第一属性分别对应的多个目标属性值。
  10. 根据权利要求9所述的属性数据的转换装置,其中,
    所述转换模块,还设置为根据所述属性元数据确定所述每一个第一属性的属性顺序号;确定所述智能设备对应的属性模板;根据所述每一个第一属性的 属性顺序号将所述每一个第一属性的目标属性值写入所述属性模板对应的字段,以得到目标属性数据,其中,相邻的两个目标属性值之间包括:分隔符,所述字段的字段号与所述属性顺序号相同。
  11. 根据权利要求10所述的属性数据的转换装置,其中,
    所述转换模块,还设置为确定所述属性模板中的所有字段是否均存在所述目标属性值;在确定所述所有字段中任一字段中不存在所述目标属性值的情况下,在所述任一字段写入空值。
  12. 根据权利要求8所述的属性数据的转换装置,其中,
    所述转换模块,还设置为确定所述多个第一属性名中的任一第一属性名与所述多个第二属性名中的任一第二属性名是否一致;在所述任一第一属性名与所述任一第二目标属性名不一致的情况下,禁止对所述任一第一属性名对应的属性值进行转换。
  13. 根据权利要求8所述的属性数据的转换装置,其中,
    所述转换模块,还设置为在确定对所述目标属性数据进行解码的情况下,根据所述属性元数据和所述目标属性数据确定所述多个第一属性中的每一个第一属性对应的第一属性名、所述每一个第一属性对应的第一属性值类型;根据所述每一个第一属性对应的第一属性名、所述每一个第一属性对应的第一属性值类型将所述目标属性数据转换为所述第一属性数据。
  14. 根据权利要求8所述的属性数据的转换装置,其中,
    所述转换模块,还设置为执行第二转换步骤:根据多个第一属性中的任一第一属性对应的第一属性值类型将所述任一第一属性对应的目标属性值转换为所述第一属性值,将所述任一第一属性对应的第一属性名写入所述第一属性值之前;循环执行所述第二转换步骤,直至将每一个第一属性对应的目标属性值转换为第一属性值,并将所述每一个第一属性对应的第一属性名写入所述第一属性值之前,以获取所述第一属性数据。
  15. 一种计算机可读的存储介质,所述计算机可读的存储介质包括存储的程序,其中,所述程序运行时执行上述权利要求1至7任一项中所述的方法。
  16. 一种电子装置,包括存储器和处理器,所述存储器中存储有计算机程序,所述处理器被设置为通过所述计算机程序执行所述权利要求1至7任一项中所述的方法。
PCT/CN2023/072138 2022-06-29 2023-01-13 属性数据的转换方法和装置、存储介质及电子装置 WO2024001163A1 (zh)

Applications Claiming Priority (2)

Application Number Priority Date Filing Date Title
CN202210753862.6A CN115291793A (zh) 2022-06-29 2022-06-29 属性数据的转换方法和装置、存储介质及电子装置
CN202210753862.6 2022-06-29

Publications (1)

Publication Number Publication Date
WO2024001163A1 true WO2024001163A1 (zh) 2024-01-04

Family

ID=83821128

Family Applications (1)

Application Number Title Priority Date Filing Date
PCT/CN2023/072138 WO2024001163A1 (zh) 2022-06-29 2023-01-13 属性数据的转换方法和装置、存储介质及电子装置

Country Status (2)

Country Link
CN (1) CN115291793A (zh)
WO (1) WO2024001163A1 (zh)

Families Citing this family (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN115291793A (zh) * 2022-06-29 2022-11-04 青岛海尔科技有限公司 属性数据的转换方法和装置、存储介质及电子装置

Citations (8)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US20160034499A1 (en) * 2014-07-29 2016-02-04 Facebook, Inc. Compressing and transmitting structured information
CN106557531A (zh) * 2015-09-30 2017-04-05 伊姆西公司 将复杂结构对象转换成平面化数据
CN109413077A (zh) * 2018-11-07 2019-03-01 北京奇艺世纪科技有限公司 一种json报文数据的收发方法、装置及电子设备
CN111078652A (zh) * 2019-11-28 2020-04-28 江苏苏宁物流有限公司 物流箱码的归档压缩方法及装置
CN111404883A (zh) * 2020-03-02 2020-07-10 青岛聚好联科技有限公司 一种物联网设备通用协议的解析方法及装置
CN111581267A (zh) * 2020-04-14 2020-08-25 北京明略软件系统有限公司 一种对象数据的存储方法和装置
CN113918566A (zh) * 2021-10-11 2022-01-11 中盈优创资讯科技有限公司 一种基于列存储的NetFlow数据保存方法与装置
CN115291793A (zh) * 2022-06-29 2022-11-04 青岛海尔科技有限公司 属性数据的转换方法和装置、存储介质及电子装置

Patent Citations (8)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US20160034499A1 (en) * 2014-07-29 2016-02-04 Facebook, Inc. Compressing and transmitting structured information
CN106557531A (zh) * 2015-09-30 2017-04-05 伊姆西公司 将复杂结构对象转换成平面化数据
CN109413077A (zh) * 2018-11-07 2019-03-01 北京奇艺世纪科技有限公司 一种json报文数据的收发方法、装置及电子设备
CN111078652A (zh) * 2019-11-28 2020-04-28 江苏苏宁物流有限公司 物流箱码的归档压缩方法及装置
CN111404883A (zh) * 2020-03-02 2020-07-10 青岛聚好联科技有限公司 一种物联网设备通用协议的解析方法及装置
CN111581267A (zh) * 2020-04-14 2020-08-25 北京明略软件系统有限公司 一种对象数据的存储方法和装置
CN113918566A (zh) * 2021-10-11 2022-01-11 中盈优创资讯科技有限公司 一种基于列存储的NetFlow数据保存方法与装置
CN115291793A (zh) * 2022-06-29 2022-11-04 青岛海尔科技有限公司 属性数据的转换方法和装置、存储介质及电子装置

Non-Patent Citations (2)

* Cited by examiner, † Cited by third party
Title
ITEYE_1317: "JSON Compression algorithms: HPack VS CJSON", CSDN, 28 June 2021 (2021-06-28), XP093122097, Retrieved from the Internet <URL:https://blog.csdn.net/iteye_1317/article/details/82088388> [retrieved on 20240122] *
ZHENCHANGCEERYUYUNEI: "JSON compression algorithms: CJSON and HPack", CSDN, 30 August 2016 (2016-08-30), XP093122093, Retrieved from the Internet <URL:https://blog.csdn.net/zhenyu5211314/article/details/52367185> [retrieved on 20240122] *

Also Published As

Publication number Publication date
CN115291793A (zh) 2022-11-04

Similar Documents

Publication Publication Date Title
US11563819B2 (en) Operation triggering method and apparatus for machine-to-machine communications
US20160174268A1 (en) Smart home controller and communication method thereof
US20150312296A1 (en) Method and device for pushing multimedia resource and display terminal
CN108173727B (zh) 一种智能家电入网方法及设备
CN105404258A (zh) 智能家居管理方法及平台
CN114244644B (zh) 智能家居的控制方法和装置、存储介质、电子装置
WO2024001163A1 (zh) 属性数据的转换方法和装置、存储介质及电子装置
EP3993338A1 (en) Device binding method and apparatus, and electronic device
CN109166299A (zh) 一种家电的遥控方法、移动终端和存储介质
CN106790347B (zh) 一种基于netty的大规模并发数据转发方法
CN111131380A (zh) 一种家电设备的配网方法、系统及存储介质
WO2023168856A1 (zh) 一种关联场景推荐方法、装置、存储介质及电子装置
CN114153153A (zh) 设备控制方法、系统、装置、电子设备和存储介质
CN114391234A (zh) 数据采集方法、装置、Modbus系统及存储介质
US9684938B2 (en) Methods for generating electronic appliance identifier and managing information by using electronic appliance identifier
CN114697150A (zh) 命令的下发方法和装置、存储介质及电子装置
WO2015021753A1 (zh) 一种数据压缩的方法、计算机系统和装置
WO2024001113A1 (zh) 图谱的确定方法和装置、存储介质及电子装置
CN113037820A (zh) 一种物联网设备通讯模块
WO2024001189A1 (zh) 食物存储信息的确定方法及装置、存储介质及电子装置
CN107708142A (zh) 一种接入设备ap的分组方法、设备及系统
CN103269360A (zh) 一种对电器设备进行控制的方法及装置
CN112738775B (zh) 集控设备及其拓扑方法、系统和设备
CN107104865B (zh) 一种基于rs485总线的后台扩展方法及其系统
CN117596157B (zh) 物模型的动态构成方法、设备和存储介质

Legal Events

Date Code Title Description
121 Ep: the epo has been informed by wipo that ep was designated in this application

Ref document number: 23829356

Country of ref document: EP

Kind code of ref document: A1