CN107451164A - A kind of method and device of semantic query - Google Patents

A kind of method and device of semantic query Download PDF

Info

Publication number
CN107451164A
CN107451164A CN201610387225.6A CN201610387225A CN107451164A CN 107451164 A CN107451164 A CN 107451164A CN 201610387225 A CN201610387225 A CN 201610387225A CN 107451164 A CN107451164 A CN 107451164A
Authority
CN
China
Prior art keywords
query
triple
inquiry
semantic
resource
Prior art date
Legal status (The legal status 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 status listed.)
Granted
Application number
CN201610387225.6A
Other languages
Chinese (zh)
Other versions
CN107451164B (en
Inventor
高莹
张永靖
Current Assignee (The listed assignees may be inaccurate. Google has not performed a legal analysis and makes no representation or warranty as to the accuracy of the list.)
Huawei Cloud Computing Technologies Co Ltd
Original Assignee
Huawei Technologies Co Ltd
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 Huawei Technologies Co Ltd filed Critical Huawei Technologies Co Ltd
Priority to CN201610387225.6A priority Critical patent/CN107451164B/en
Priority to PCT/CN2017/082233 priority patent/WO2017206634A1/en
Publication of CN107451164A publication Critical patent/CN107451164A/en
Application granted granted Critical
Publication of CN107451164B publication Critical patent/CN107451164B/en
Active legal-status Critical Current
Anticipated expiration legal-status Critical

Links

Classifications

    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F16/00Information retrieval; Database structures therefor; File system structures therefor
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F16/00Information retrieval; Database structures therefor; File system structures therefor
    • G06F16/90Details of database functions independent of the retrieved data types
    • G06F16/903Querying
    • G06F16/9032Query formulation
    • G06F16/90332Natural language query formulation or dialogue systems

Abstract

The present invention provides a kind of method of semantic query, applied to M2M systems, during can solving semantic query, can obtain the long-range semantic description resource unrelated with this semantic query, so as to the problem of increasing unnecessary network overhead.The embodiment of the present invention is asked by receiving the first semantic query, at least two inquiry ternary group pollings meet the first query object of the first querying condition in being asked using the first semantic query, the second query object using the link attributes that partial query triple and resource link inquiry triple query portion inquiry triple indicate to long-range semantic description resource, and the attribute or resource of query portion inquiry triple instruction, equipment where the long-range semantic description resource of the link attributes indicated to partial query triple sends the request of the second semantic query to determine whether the attribute of partial query triple instruction meets the second querying condition.During the embodiment of the present invention is applied to semantic query.

Description

A kind of method and device of semantic query
Technical field
The present invention relates to machine communication (Machine-to-Machine Communications, M2M) technical field, especially It is related to a kind of method and device of semantic query.
Background technology
Machine communication (Machine-to-Machine Communications, M2M) be it is a kind of using machine intelligence interaction as Application and service of core, networking.M2M technologies in machine by being internally embedded wirelessly or non-wirelessly communication module and application Logic is handled, the data communication without manual intervention is realized, to meet user to monitoring, command scheduling, data acquisition and measurement Etc. information system requirement.M2M technologies are applied in increasing industry and field at present, such as intelligence is handed over The industries such as logical, agricultural irrigation, smart home, power network, meter reading.M2M system operators are in order to meet to different industries application service Needs, develop unified M2M platforms and realize the public ability in part, for example, data access and storage, the shared and transmission of data, Group communication, the subscribing notification to data, safety, charging, resource discovering etc..The M2M platforms can access different types of set Standby and sensor, and can provide using access interface, it is allowed to the application of different industries calls M2M platforms by access interface The public ability provided.
At present, the public service entity (such as CSE, Common service Entity) that M2M systems include is provided and uniformly connect Mouth carries out data transmission the difference between shielding device communication mode, realizes between the every profession and trade of access M2M systems and application altogether Enjoy data transmission capabilities.But be still mutually to close between every profession and trade and application in data using upper, such as:To belonging to For the equipment of different application, in the case of no priori, other application can not know function possessed by the equipment With executable operation, and other application is to allow to obtain data also know the implications of data, can not realize difference Reuse between to data and shared, is unfavorable for forming open Data Market.
In order to realize industry-by-industry and application between can in the case of no priori shared resource and data, M2M systems have increased semantic description resource newly, machine can be used it will be appreciated that mode describe data and operation cause other should With the function that parent resource provides and the operation that can perform can be determined by the semantic description information of semantic description resource, also may be used To determine the data implication of parent resource offer, such as data type, unit etc., the data sharing between different application is realized, and have Beneficial to the Data Market for forming opening, and also the semantic description information in semantic description resource is utilized to further provide for language The semantic functions such as adopted inquiry, semantic reasoning.
Wherein, existing semantic query method is:After equipment where semantic description resource receives semantic query request, Whether all semantic description resources for needing to judge to be locally stored are linked to long-range semantic description resource, if be linked to long-range Semantic description resource, it need to go to obtain all according to the URI of the long-range semantic description resource of the semantic description resource link of local The long-range semantic description resource of the semantic description resource link on ground, and then in all long-range semantic description resources of acquisition and local Semantic query is carried out in semantic description resource.However, because the long-range semantic resources of link are not that semanteme all with this is looked into Correlation is ask, thus the long-range semantic description resource unrelated with this semantic query can be obtained, so as to which the network for increasing unnecessary is opened Pin.
The content of the invention
The present invention provides a kind of method and device of semantic query, during solving prior art semantic query, meeting The long-range semantic description resource unrelated with this semantic query is obtained, so as to the problem of increasing unnecessary network overhead.
M2M gateways, M2M platforms and M2M equipment in specific implementation in M2M systems can be used as storage semanteme to retouch The device of resource is stated, the semantic query that application server transmission is received by the device of storage semantic description resource is asked, and uses language The category of partial query triple and resource link inquiry triple query portion inquiry triple instruction in adopted inquiry request Property be linked to the query object of long-range semantic description resource, and then the link attributes that need to be only indicated to partial query triple is remote Equipment where journey semantic description resource carries out the operation of long-range semantic query.By the present invention, semantic description resource is stored Device can avoid obtaining excessively long-range without carrying out semantic query process in all long-range semantic description resources of link Semantic information, reduce network overhead.
In a first aspect, the embodiment of the present invention provides a kind of method of semantic query, applied to machine communication M2M systems, its In, it is semantic that the first equipment (device of storage semantic description resource, such as M2M equipment, M2M platforms or M2M gateways) receives first Inquiry request, the first semantic query request include query object variable and the first querying condition, and the query object becomes The attribute or resource of the first semantic query request institute requesting query, first querying condition include at least two described in amount instruction Triple is inquired about, at least two inquiries triple indicates respectively the attribute and/or resource of the query object association.So Afterwards, the first equipment meets the first query object of first querying condition using described at least two inquiry ternary group pollings; Then the attribute indicated using partial query triple described in partial query triple and resource link inquiry ternary group polling It is linked to the second query object of long-range semantic description resource, and the attribute or money of the inquiry partial query triple instruction Source, the partial query triple inquire about in triple looking into after deleting at least one inquiry triple for described at least two Triple is ask, the inquiry triple for including the query object variable at least be present in the partial query triple.Then to Equipment where the long-range semantic description resource of the link attributes of the partial query triple instruction sends the second semantic query Ask to determine whether the attribute of the partial query triple instruction meets the second querying condition, the second querying condition bag Containing the inquiry triple in first querying condition in addition to the partial query triple.By embodiments of the invention, When needing the long-range semantic description resource of query link, partial query triple and resource link relational query ternary are used Second query object and the portion of the link attributes of group polling partial query triple instruction to long-range semantic description resource Divide the attribute of inquiry triple instruction, and then the long-range semantic description for the link attributes that need to be only indicated to partial query triple provides Equipment where source sends the request of the second semantic query, and whether the attribute or resource of query portion inquiry triple instruction meet the Two querying conditions, without carrying out semantic query process in all long-range semantic description resources of link, it is excessive to avoid acquisition Long-range semantic information, reduce network overhead.
In a possible design, in the link attributes that first equipment indicates to the partial query triple After equipment where long-range semantic description resource sends the request of the second semantic query, the first equipment can also receive the part The second semantic query that equipment where the long-range semantic description resource of the link attributes of inquiry triple instruction returns successfully rings Should;Then the response of the first semantic query is sent, first semantic query response includes first query object and described Second query object.First equipment only needs the long-range semantic description resource institute of the link attributes of receiving portion inquiry triple instruction Equipment send the second semantic query response, reduce network overhead.
In another possible design, in the link attributes that first equipment indicates to the partial query triple Long-range semantic description resource where equipment send the second semantic query request after, the first equipment can also receive the portion The second semantic query failure that equipment where dividing the long-range semantic description resource of the link attributes of inquiry triple instruction returns Response;Then the response of the first semantic query is sent, the first semantic query response includes first query object, do not wrapped Include second query object.First equipment only needs the long-range semantic description of the link attributes of receiving portion inquiry triple instruction The second semantic query response that equipment where resource is sent, reduces network overhead.
It is described when the query object variable is a subject for inquiring about triple in another possible design At least two inquiry triples indicate respectively the attribute that the query object includes and/or the category included by the query object The attribute that property is included;When the query object variable is an object for inquiring about triple, at least two inquiries three Tuple indicates respectively the attribute or resource belonging to the query object, and the attribute belonging to the attribute belonging to the query object Or resource.So as to so that the solution of the present invention can have both been realized to inquiry of the subject as query object, can also be realized to guest Inquiry of the language as query object.So as to expand the use range of distributed query, further meet to apply different inquiries Demand.
In another possible design, first equipment uses partial query triple and resource link inquiry three Described in first group polling partial query triple indicate link attributes to long-range semantic description resource the second query object, and Inquire about the attribute or resource of the partial query triple instruction;Then the link attributes indicated to the partial query triple Long-range semantic description resource where equipment send the second semantic query request, specifically can be implemented as:
S1, the first equipment delete at least one inquiry triple in first querying condition, wherein, it is remaining after deletion Inquiry triple be the partial query triple, at least exist in the partial query triple and include the query object The inquiry triple of variable;
S2, the first equipment construction resource link inquiry triple, the quantity of the resource link inquiry triple is with being deleted The quantity for the inquiry triple removed is identical, and the subject of the resource link inquiry triple is the deleted inquiry triple Object, predicate is designated as resource link relation, and object is either query variable, the either query variable and the first inquiry bar Query interface in part is different;
S3, the first equipment use portion described in the partial query triple and resource link inquiry ternary group polling Divide the link attributes of inquiry triple instruction to the second query object and the partial query three of long-range semantic description resource The attribute of tuple instruction;
S4, the first equipment are when second query object and the first query object difference, to the partial query Equipment where the long-range semantic description resource of the link attributes of triple instruction sends the request of the second semantic query;
Circulation performs above-mentioned steps S1 to S4, and the query object variable is included until being removed in first querying condition Inquiry triple outside inquiry triple was all deleted once.
By this design, the first equipment can be caused to accurately determine out the long-range language that needs carry out long-range semantic query Equipment where justice description resource, and then only to needing to carry out the equipment where the long-range semantic description resource of long-range semantic query The request of the second semantic query is sent, the first equipment can be avoided to obtain excessive unrelated long-range semantic information.
In another possible design, first equipment deletes at least one inquiry in first querying condition During triple, the first equipment judges whether the rank between the inquiry triple in first querying condition is identical;When described During rank difference between the inquiry triple in the first querying condition, according to rank from low to high suitable of inquiry triple Sequence, at least one low inquiry triple of inquiry rank in first querying condition is deleted every time;It is remaining after deletion to look into Ask the inquiry triple for including the query object variable described at least existing in triple;When in first querying condition When the rank inquired about between triple is identical, at least one in first querying condition is deleted every time by the way of traversal Triple is inquired about, wherein, the looking into comprising the query object variable at least be present in remaining inquiry triple after deletion Ask triple.When determining partial query triple, the rank between inquiry triple in the first querying condition is deleted Triple is inquired about, the long-range semanteme related to this semantic query then can be accurately determined out by partial query triple Resource is described, is entered without carrying out semantic query to incoherent long-range semantic description resource, can be reached and efficiently carry out far The effect of journey semantic query.
In another possible design, the first semantic query request includes long-range semantic query parameter, described Long-range semantic query parameter is used to indicate whether to need to carry out remote inquiry;Or the equipment for receiving the first semantic query request In be used to indicate whether to need to carry out remote inquiry comprising remote inquiry instruction strategy, remote inquiry instruction strategy.Pass through Long-range semantic query parameter or remote inquiry instruction strategy, it may be determined that the long-range semantic description money for whether needing inquiry to connect Source, add the flexibility of semantic query method.
Second aspect, it is semantic for saving as above-mentioned storage the embodiments of the invention provide a kind of computer-readable storage medium Computer software instructions used in the device of resource are described, it, which is included, is used to perform the program designed by above-mentioned aspect.
The third aspect, the embodiments of the invention provide the device of storage semantic description resource, the storage semantic description resource Device have realize that the above method stores the function of the device behavior of semantic description resource in practice.The function can pass through Hardware is realized, corresponding software can also be performed by hardware and is realized.The hardware or software include it is one or more with it is above-mentioned Unit corresponding to function phase.
Fourth aspect, storing the structure of the device of semantic description resource includes memory, transceiver and processor.Wherein Memory is used to store computer executable program code, and and transceiver couples.Described program code includes instruction, when described When being instructed described in computing device, the instruction makes described device perform information involved in the above method or instruction.
From such scheme, when needing the long-range semantic description resource of query link, partial query triple is used And the link attributes of resource link relational query triple query portion inquiry triple instruction are to long-range semantic description resource The second query object and the partial query triple instruction attribute, and then only need to partial query triple indicate Equipment where the long-range semantic description resource of link attributes sends the request of the second semantic query, and query portion inquiry triple refers to Whether the attribute or resource shown meets the second querying condition, semantic without being carried out in all long-range semantic description resources of link Query process, avoid and obtain excessive long-range semantic information, reduce network overhead.
Brief description of the drawings
In order to illustrate more clearly about the embodiment of the present invention or technical scheme of the prior art, below will be to embodiment or existing There is the required accompanying drawing used in technology description to be briefly described.It should be evident that what is reflected in accompanying drawings below is only this The part of the embodiment of invention, for those of ordinary skill in the art, without having to pay creative labor, also The other embodiment of the present invention can be obtained according to these accompanying drawings.And all these embodiments or embodiment are all in the present invention Protection domain within.
Fig. 1 is the network architecture diagram provided in an embodiment of the present invention based on M2M systems;
Fig. 2 is the logical construction schematic diagram of the device of storage semantic description resource provided in an embodiment of the present invention;
Fig. 3 is the structural representation of semantic description resource provided in an embodiment of the present invention;
Fig. 4 is the triple schematic diagram of the semantic information in semantic description resource provided in an embodiment of the present invention;
Fig. 5 is the flow chart of semantic query method provided in an embodiment of the present invention;
Fig. 6 is the logical construction schematic diagram of the device of storage semantic description resource provided in an embodiment of the present invention.
Embodiment
Below in conjunction with accompanying drawing, the technical scheme in the embodiment of the present invention is clearly and completely described.Obviously, institute The embodiment of description is only part of the embodiment of the present invention, rather than whole embodiments.Based on the embodiment in the present invention, The every other embodiment that those of ordinary skill in the art are obtained under the premise of creative work is not paid, belongs to this hair The scope of bright protection.
The network architecture and business scenario of description of the embodiment of the present invention are in order to which more clearly the explanation present invention is implemented The technical scheme of example, does not form the restriction for technical scheme provided in an embodiment of the present invention, those of ordinary skill in the art Understand, with the differentiation of the network architecture and the appearance of new business scene, technical scheme provided in an embodiment of the present invention is for similar Technical problem, it is equally applicable.
Fig. 1 provides a kind of configuration diagram of M2M systems 200 of the embodiment of the present invention, for being looked into M2M systems Ask semantic information.The embodiment of the present invention is based on existing M2M frameworks, and stores each semantic description resource in M2M platforms, is stored in Each semantic description resource of M2M platforms 102 is used to carry out semantic query to the semantic information of semantic description resource.Further, Semantic description resource can be stored on M2M platforms 102, can also be stored in each M2M gateways 103 or each M2M equipment 104 On.In order to better profit from existing semantic query instrument (e.g., SPARQL (Simple Protocol and RDF Query Language) inquire about) semantic information in description attribute to semantic description resource realizes semantic query function, semantic description provides In equipment where source the centrally stored all semantic description resources in local description attribute in semantic information and with long-range language The linking relationship of justice description resource.The semantic information of the embodiment of the present invention can exist in the form of triple, for describing quilt The information of resource described by semantic description resource.
In embodiments of the present invention, the device for storing semantic description resource can be each M2M gateways 103 in M2M systems Or M2M platforms 102 or M2M equipment 104, accordingly, the embodiment of the present invention can be applied in other systems.
In addition, first, second, and third no any technical meaning in the embodiment of the present invention, is used only to distinguish The difference of term.
Specifically, M2M systems provided in an embodiment of the present invention include M2M platforms 102, M2M gateways 103, M2M equipment 104 And application server 101.As shown in figure 1, M2M platforms 102 are can be IN (Infrastructure Node, infrastructure Node), M2M gateways 102 are MN (Middle Node, intermediate nodes), and M2M equipment 104 can be ASN (Application Service Node, application service node) or AND (in (Application Dedicated Node, application specific node) figure It is not shown).In addition, CSE (Common Service Entity, public service entity) is the public ability portion as M2M systems Part, it is possible to achieve the carrying to public ability.CSE may be embodied in M2M platforms 102, M2M gateways 103, or be used as M2M equipment In 104 ASN, to realize corresponding function.CSE allows AE (Application Entity, application entity) by Mca reference points The public ability that CSE is opened is accessed, communication between CSE is realized by Mcc reference points and realized by Mcn reference points the bottom of to The calling of layer network ability.
In the framework shown in Fig. 1, M2M platforms 102, M2M gateways 103 and M2M equipment 104 can store each resource Semantic description resource, receive the operation requests related to semantic description resource that each application server is sent.Wherein retouched with semanteme It can be the semantic query request that query semantics describe the semantic information in resource to state the related operation requests of resource.Specifically, The flow of semantic query refers to the embodiment of the present invention in detailed description introduction below.
The semantic description resource that M2M gateways 103, M2M equipment 104 and M2M platforms 102 store can be as existing resource The form of child resource, can also be as independent resource.Semantic description resource is used for the semantic information for describing related resource, uses machine Device it will be appreciated that mode the data of related resource are described and operation allows other application by semantic description resource come true The function and the data implication of executable operation and offer that the fixed resource by semantic description resource description provides, such as data class Type, unit etc., the data sharing between different application is realized, and advantageously form open Data Market.
Fig. 2 shows the structural representation of the device provided in an embodiment of the present invention as storage semantic description resource, uses In the operation requests related to semantic description resource of the receiving in the M2M systems shown in Fig. 1, and triggering is to semantic description resource Querying flow.The device 200 of storage semantic description resource can include one or more ports 208, with transceiver (transceiver) 206 it is coupled.Transceiver 206 can be transmitter, receiver or its combination, lead to from other network nodes Port 208 is crossed to send or received data packet.Processor 202 is coupled to transceiver 206, for processing data bag.Processor 202 can Include one or more polycaryon processors and/or memory 204.Processor 202 can be a general processor, special integrated Circuit (application specific integrated circuit, ASIC), or digital signal processor (DSP).
Memory 204 can be the storage medium of non-transient, be coupled with processor 202, different types of for preserving Data, such as semantic description resource, by resource of semantic description resource description etc..Memory 204 can include read-only storage (read Only memory, ROM), random access memory (random access memory, RAM) or can storage information and instruction Other kinds of dynamic memory or magnetic disk storage.Memory 204 realizes semantic query phase available for preservation The instruction of pass method.It is appreciated that by programming or loading executable instruction to the processor 202 of equipment 200, cache and long-term It is at least one in storage.
The device 200 of storage semantic description resource can realize perform according to an embodiment of the invention one or more instructions with Triggering carries out semantic query.These instructions are storable in memory 204, may alternatively be integrated within the device of storage semantic description resource The kernel of operating system or the plug-in unit of kernel in.
In another embodiment, device of the equipment 200 as storage semantic description resource, including memory 204, processor 202 and transceiver 206 and one or more ports 208 with transceiver couples.Memory 204, can for storing computer Configuration processor code;Processor 202 couples with the memory 204 and the transceiver 206;
Wherein described program code includes instruction, and when being instructed described in the computing device, the instruction makes described deposit The device of storage semantic description resource performs the correlation step that the first equipment performs in Fig. 5.
In addition, Fig. 2 is also used as CSE provided in an embodiment of the present invention structural representation, including memory 204, place Manage device 202 and transceiver 206 and one or more ports 208 with transceiver couples.Memory 204, calculated for storing Machine executable program code;Processor 202 couples with the memory 204 and the transceiver 206;
Wherein described program code includes instruction, and when being instructed described in the computing device, the instruction makes described deposit The device of storage semantic description resource performs the correlation step that the first equipment performs in Fig. 5.
As an example, the semantic description resource of the device storage of semantic description resource is stored in Fig. 1-5 SemanticDescriptor structures can be with as shown in figure 3, semantic description resource semanticDescriptor includes description category The parameter of property descriptor parameter and the body (ontologyRef) of semantic description quoting resource.Wherein, attribute is described (descriptor) parameter includes the semantic information and the other language semantic descriptions of semantic description resource associations of semantic description resource The incidence relation of resource;The parameter of the body (ontologyRef) of reference includes the unification of the body of semantic description quoting resource Resource identifier (Uniform Resource Identifier, URI).
The part language that the semantic description resource that Fig. 4 is stored in the equipment where CSE provided in an embodiment of the present invention includes The triple schematic diagram of adopted information, as shown in figure 4, RoomA (room A) includes two equipment, respectively sensor12 (sensors And sensor22 (sensor 22) 12).Sensor12 and sensor22 specifically includes following triplet information:
Sensor12 hasFunctionality measuringTemperature represent that sensor12 has measurement temperature The function of degree;
MeasuringTemperature hasQuantities TemperatureAspect are represented MeasuringTemperature has the numerical value in terms of temperature;
TemperatureAspect hasUnit " Celsius " represent that the unit of temperature is degree Celsius;
Sensor12 hasFunctionality measuringHumidity represent that sensor12 has measurement humidity Function;
MeasuringHumidity hasQuantities HumidityAspect represent measuringHumidity tools There is the numerical value in terms of humidity;
HumidityAspect hasResLink http://www.onem2m.example3.org/***/expression It is http that HumidityAspect, which is linked to a URI,://www.onem2m.example3.org/***/semantic description money Source;
Sensor22 hasFunctionality lightMeasuring represent that sensor12 provides the work(of light exposure measurement Energy;
lightMeasuring hasResLink http://www.onem2m.example2.org/***/expression It is http that lightMeasuring, which is linked to a URI,://www.onem2m.example2.org/***/semantic description money Source;
It should be noted that Fig. 4 is merely illustrative schematic diagram, other triplet informations stored in the equipment where CSE No longer show one by one herein.
In order to facilitate the description in following examples, first to the present embodiments relate to related content explain Explanation.
Semantic query request bag contains query statement, and further, query statement includes query object variable and semanteme is looked into Inquiry condition.It should be noted that the query statement included in semantic query request can be SPARQL query statements, but do not limit In SPARQL query statements, or other can arbitrarily be converted into the query statement of SPARQL semantic query sentences.
Wherein, query object variable indicates the attribute or resource of semantic query request institute requesting query, semantic query bar The condition that part should meet for the attribute or resource of institute's requesting query.Semantic query condition includes at least two inquiry triples. At least two inquiry triples indicate respectively the attribute and/or resource of query object association.
Further, when query object variable is a subject for inquiring about triple, at least two inquiry ternary components Not Zhi Shi query object association attribute.And the attribute of query object association is specially:At least two inquiry triples refer to respectively Show the attribute and/or be queried the attribute that the attribute that object includes is included that query object includes.
For example, the query statement included in semantic query request is following code one:
Wherein, query object variable asks the resource of institute's requesting query for the semantic queryDevice (to be inquired about Object isResource corresponding to device).The semantic query condition includes three inquiry triples, is respectivelydevice hasFunctionalityFunction、Function hasQuantitiesQuantities, andQuantities hasUnitUnit, then semantic query request need to inquire about the resource for meeting above-mentioned semantic query condition.Specifically need to inquire about Device, shouldDevice is associated by hasFunctionalityAttribute corresponding to Function;Further,Device bags ContainAttribute is also included by hasQuantities corresponding to FunctionAttribute corresponding to Quantities, and pass through Quantities attributes includeUnit attributes.That is, inquiry tripledevice hasFunctionality Function is indicatedResource includes corresponding to deviceAttribute corresponding to Function, inquire about tripleFunction hasQuantitiesQuantities indicates quiltResource includes corresponding to deviceAttribute includes corresponding to Function 'sAttribute corresponding to Quantities, inquire about tripleQuantities hasUnitUnit is indicatedQuantities is corresponding Attribute includedUnit attributes.
One inquiry triple includes subject, predicate, object.Wherein, predicate represents the relation between subject and object, guest Language is the attribute that subject points to, or the resource that object is subject ownership.Such as query statementdevice hasFunctionalityThe subject included in Function isDevice, predicate are hasFunctionality and object ForFunction.Wherein, due to subjectDevice is query object variable, objectFunction is subjectDevice is included Attribute.Incidence relation in inquiry triple represents that subject is associated with object.
As another optional mode, query object variable can also be the object of an inquiry triple, then at least two Bar inquiry triple indicates respectively the attribute or resource of query object association.And the attribute or resource of query object association are specific For:Attribute or resource belonging to query object, and attribute or resource belonging to attribute belonging to query object.Inquire about triple In incidence relation represent object be associated with subject.
As an example for another example in semantic query request the query statement that includes can also code two as follows, inquire about Object variable can also be the object of an inquiry triple.Code two is specially:
Now, query object variableQuantities is inquiry tripleFunction hasQuantities Quantities object.The querying condition then included in semantic query request has two inquiry triples, is respectively: device hasFunctionalityFunction andFunction hasQuantitiesQuantities.Wherein, Function hasQuantitiesQuantities shows the Quantities numerical value that Function has, anddevice hasFunctionalityFunction shows that Function is the function functions that equipment device has.That is, Inquire about tripleFunction hasQuantitiesQuantities is indicatedAttribute is corresponding to Quantities The attribute that attribute corresponding to Function is included, inquire about tripledevice hasFunctionalityFunction refers to ShowAttribute is corresponding to FunctionThe attribute that resource corresponding to device or attribute include.
It can be seen that query object variable can be the subject in an inquiry triple, query object variable can also be to look into Ask the object of triple.When query object variable is subject in an inquiry triple, inquiry triple indicates respectively inquiry The attribute that the attribute that the attribute and/or query object that query object corresponding to object variable includes include is included.When inquiry pair As be changed into for object in an inquiry triple when, corresponding to inquiry triple instruction query object variable belonging to query object Attribute and/or resource.Incidence relation can not only represent that subject is associated with object, can also represent that object is associated with subject.
It should be noted that can be that progressive relationship can also be between each inquiry triple that semantic query condition includes Coordination, two in above-mentioned two citing are inquired about in triples, and the object of first inquiry triple is second inquiry The subject of triple, then illustrate that this two inquiry triples are progressive relationship.Such as the inquiry three in above-mentioned code one and code two Tuple is then the inquiry triple of progressive relationship.Assuming that the two inquiry triples included in semantic query condition are respectively device hasFunctionalityFunction anddevice hasServiceService.Show two inquiry ternarys The subject of group is identical (to be allDevice) then this two inquiry triples are coordination.
Semantic description resource with reference to shown in Fig. 4, and semantic query request corresponding to above-mentioned code one and code two Description.The method flow diagram of semantic query provided in an embodiment of the present invention is as shown in Figure 5.In the flow, using code one as First semantic query is asked, the subject using query object variable as an inquiry triple, i.e., using query object variable as first Illustrated exemplified by the resource of semantic query request institute requesting query, the flow specifically comprises the following steps:
501st, the first equipment receives the first semantic query request that application server is sent.
Wherein, semantic query request includes query object variable and the first querying condition, and query object variable is the The attribute or resource of one semantic query request institute requesting query, the first querying condition include at least two inquiry triples.Wherein, At least two inquiry triples indicate respectively the attribute of query object association.Further, the attribute of query object association is specific For:At least two inquiry triples indicate respectively the attribute that query object includes and/or are queried the attribute that object includes and wrapped The attribute contained.
With reference to as above code one, then what the first semantic query was asked looks into the query statement included in the request of first semantic query Asking object variable isdevice.Assuming thatDevice is the resource of requesting query.Inquiry triple indicates respectivelyDevice resources ComprisingAttribute corresponding to Function,Attribute includes corresponding to FunctionAttribute corresponding to Quantities, with AndAttribute is included corresponding to QuantitiesUnit attributes.
Further, institute as described above, in three inquiry triples in above-mentioned code one, due to inquiry triple Subject is the object of another inquiry triple, therefore the first equipment determines that this three inquiry triples belong to looking into for progressive relationship Ask triple.
In addition, also include the operating method of semantic query in semantic query request, such as RETRIEVE (retrieval), Yi Jiyu The URI of the destination address of adopted inquiry request, such as the URI point to CSE1, then M2M platforms, M2M where the first equipment is CSE1 Gateway or M2M equipment.
The above included by the request of the first semantic query, the request of the first semantic query need inquiry first Meet that the first querying condition (is included by hasFunctionality relations in equipmentAttribute corresponding to Function, and Attribute corresponding to Function is included by hasQuantities relationsAttribute corresponding to Quantities, and Attribute corresponding to Quantities has by hasUnit relationsAttribute corresponding to unit) query object.
Further, long-range semantic query parameter, the long-range semantic query ginseng are also included in the request of the first semantic query Number is used to indicate whether to need to carry out remote inquiry, and when long-range semantic query parameter is true, representing needs remotely to be looked into Ask, when long-range semantic query parameter is flase, representative need not carry out remote inquiry.
In this example, it is assumed that long-range semantic query parameter is true.
502nd, the first equipment determines to need the long-range semantic description resource of query link.
Specifically, the long-range semantic query parameter when the first equipment in fixed first semantic query request determines that needs are looked into Ask the long-range semantic description resource of link.Alternatively, when the first semantic query asks to look into not comprising long-range semanteme When asking parameter, the first equipment can also determine needs according to the local policy for whether carrying out remote inquiry for being stored in the first equipment The long-range semantic description resource of query link.
As described above, assume in this example that long-range semantic query parameter is true, it is determined that need the long-range language of query link Justice description resource.
503rd, the first equipment meets the of the first querying condition using the query statement inquiry in the request of the first semantic query One query object.
Illustrated exemplified by the triple shown in Fig. 4 is stored in the first equipment, as described above, the first semantic query is asked In the query statement that includes refer to above-mentioned code one.
With reference to foregoing description, the query object variable of the first semantic query request isDevice, i.e. the first query object ForResource corresponding to device, in this step, the first equipment uses three inquiry triples in the first semantic query condition to look into Ask and meet that this three are inquired about triple in the triple shown in Fig. 4device.
As an example, the query process of this step can be:
Because the query object variable of the first semantic query request isDevice, so, it is first determined two are included in Fig. 4 Individual device, respectively sensor12 and sensor22.
Then it can be seen from the triplet information shown in Fig. 4, sensor12 hasFunctionality MeasuringTemperature, illustrate that sensor12 meets first inquiry tripledevice hasFunctionalityFunction.Wherein,Attribute corresponding to Function is measuringTemperature, so Whether measuringTemperature meets that Article 2 inquires about triple for further information.
And then due to measuringTemperature hasQuantities TemperatureAspect, explanation MeasuringTemperature meets that Article 2 inquires about tripleFunction hasQuantitiesQuantities.Its In,Attribute corresponding to Quantities is TemperatureAspect, so TemperatureAspect for further information Whether meet that Article 3 inquires about triple.
Further, TemperatureAspect hasUnit " Celsius " are also included in Fig. 4 triplet information, Illustrate that TemperatureAspect meets that Article 3 inquires about tripleQuantities hasUnitunit.Wherein,Unit Corresponding attribute is " Celsius ".
By above-mentioned query process, sensor12 is associated by hasFunctionalityCorresponding to Function Attribute measuringTemperature, further, what sensor12 was includedAttribute corresponding to Function MeasuringTemperature is also included by hasQuantitiesAttribute corresponding to Quantities TemperatureAspect, and pass throughAttribute TemperatureAspect is included corresponding to QuantitiesUnit attributes " Celsius ", so, sensor12 meets three a kind of inquiry triples of above-mentioned code, the satisfaction inquired in this step First query object of the first querying condition isSensor12 corresponding to device.
In addition, as shown in Figure 4, sensor22 hasFunctionality lightMeasuring, illustrate sensor22 Meet first inquiry tripledevice hasFunctionalityFunction.Wherein,Belong to corresponding to Function Property is lightMeasuring, but does not inquire lightMeasuring from Fig. 4 and also included by hasQuantities Attribute corresponding to Quantities, so,Sensor22 corresponding to device is unsatisfactory for a kind of Article 2 inquiry ternary of code Group and Article 3 inquiry triple, i.e. sensor22 is not the first query object.
It should be noted that above-mentioned query process is only an exemplary explanation, can during specific implementation To carry out semantic query, the unlimited specific inquiry mode of system of the embodiment of the present invention using SPARQL semantic queries instrument.First looks into It can be one either multiple to ask object, can store the first query object in table form, such as look into by above-mentioned Inquiry process determine the first query object list be:
device
sensor12
And then the mapping that the first query object list and the request of the first semantic query can also be stored in the first equipment is closed System.
504th, the first equipment uses partial query triple and resource link inquiry triple query portion inquiry ternary The link attributes of instruction are organized to the second query object of long-range semantic description resource, and the inquiry partial query triple to refer to The attribute or resource shown.
Further, before inquiry, the first equipment needs to delete first at least one inquiry three in the first querying condition Tuple, remaining inquiry triple is partial query triple after deletion, is at least included in partial query triple in the presence of one The inquiry triple of query object variable, the attribute of partial query triple instruction or the category that resource is the association of the second query object Property and/or resource.
In at least one inquiry triple in deleting the first querying condition, need to judge in the first querying condition first Whether the rank inquired about between triple is identical, if it is different, according to the order of the rank of triple from low to high is inquired about, every time Delete at least one low inquiry triple of inquiry rank in first querying condition;When except including query object variable When the rank inquired about between the inquiry triple outside triple is identical, the first querying condition is deleted every time by the way of traversal In at least one inquiry triple.Wherein, at least exist in remaining inquiry triple after deletion and include query object variable Inquiry triple.
Judging whether the rank between the inquiry triple in the first querying condition is identical is specially:Either query triple Object whether be it is other inquiry triples subject, if it is, in the first querying condition inquire about triple between rank not It is identical, it is otherwise identical.Further, when the object of either query triple is the subject of other inquiry triples, its object is The inquiry triple of the subject of other inquiry triples is superior to other inquiry triples.
Still by taking the first semantic query request in step 501 as an example, the inquiry of query object is included in the first querying condition Triple isdevice hasFunctionalityFunction, two other are inquired about in triple,Function hasQuantitiesQuantities object isQuantities hasUnitUnit subject, then, inquire about triple Function hasQuantitiesQuantities's is superior to Quantities hasUnitunit.Therefore, it should The inquiry triple of low level is first deleted, then should first be deletedQuantities hasUnitunit.It is understood that when upper State two other inquiry triple between rank it is identical when, then can use traversal by the way of delete respectively every time this two inquire about three At least one in tuple.
After at least one inquiry triple is deleted, the first equipment also needs to construct resource link relational query triple, The subject of resource link relational query triple is the subject for being deleted query statement, and predicate is designated as resource link relation, guest Language is either query variable, and further, the either query variable is different from the query interface in the first querying condition.
As an example, deleted inquiry triple isQuantities hasUnitUnit, then resource link Inquiry triple subject beQuantities, to represent resource link relation hasResLink, object could be arranged to predicate The query interface different from the query interface in the first querying condition.Such as can beURI, then resource link relational query three Tuple isQuantities hasResLinkURI, partial query triple aredevice hasFunctionality Function andFunction hasQuantitiesQuantities.Further, the inquiry three of the second query object In tuple in addition to comprising query object variable, nonproductive poll variable is still further comprised, nonproductive poll variable is resource chain Connect the subject and object of relational query triple.Wherein, the subject of resource link relational query triple is partial query ternary The attribute of group instruction, the object of resource link relation are used for the long-range semanteme of the link attributes of indicating section inquiry triple instruction Resource is described.
For inquire about the second query object query statement be:
It can be seen from Fig. 4, (sensor12 hasFunctionality measuringHumidity, and MeasuringHumidity hasQuantities HumidityAspect, and HumidityAspect hasResLink http://www.onem2m.example3.org/***/)。
Therefore, attribute (the i.e. resource link inquiry ternary indicated using above-mentioned query statement query portion inquiry triple The attribute HumidityAspect indicated by subject in group) the second query object for being linked to long-range semantic description resource is sensor12.And inquired about using above-mentioned query statementThe attribute of Quantities instructions is HumidityAspect;And The attribute of URI instructions is http://www.onem2m.example3.org/***/, it is used to inquire about the second query object with above-mentioned Query statement, which carries out inquiry, can obtain the second query object list, as shown in the table:
device Quantities URI
sensor12 HumidityAspect http://www.onem2m.example3.org/***/
Because the second query object sensor12 is identical with the first query object, so sensor12 has been determined as completely The query object of the first querying condition of foot, without carrying out the second semantic query to sensor12.Therefore by sensor12 from second Deleted in query object list, now the second query object list remains as sky.
Further, due to delete the first querying condition in one inquiry triple (Quantities hasUnit Unit after) still remaining two inquiries triples (device hasFunctionalityFunction andFunction hasQuantitiesQuantities), so also needing circulation to perform above-mentioned deletion and the process inquired about, until the first inquiry bar In part except comprising query object variable inquiry triple (device hasFunctionalityLooking into outside Function) Triple is ask all to be deleted once.
Now, in the first querying condition in remaining two inquiries tripleFunction hasQuantities Quantities does not include query object variableDevice, so this not included to the inquiry triple of query object variable Delete, then construct resource link relational query triple.Wherein, the resource link relational query triple of construction is: Function hasResLinkURI, partial query triple aredevice hasFunctionalityFunction.Together Sample, in the inquiry triple of the second query object in addition to comprising query object variable, still further comprise nonproductive poll Variable, nonproductive poll variable are the subject and object of resource link relational query triple.Then it is used to inquire about the second query object Query statement be:
Understood with reference to Fig. 4, (sensor22 hasFunctionality lightMeasuring, and
lightMeasuring hasResLink http://www.onem2m.example2.org/***/)。
Therefore, attribute (the i.e. resource link inquiry ternary indicated using above-mentioned query statement query portion inquiry triple The attribute lightMeasuring indicated by subject in group) the second query object for being linked to long-range semantic description resource is sensor22.And inquired about using above-mentioned query statementThe attribute of Function instructions is lightMeasuring, and is used Above-mentioned query statement inquiryThe attribute of URI instructions is http://www.onem2m.example2.org/***/.With second It is configured to inquire about after the second query object query statement inquired about, the second query object is listed as follows shown in table:
device Function URI
sensor22 lightMeasuring http://www.onem2m.example2.org/***/
Because the second query object sensor22 is not included in the first query object list, so need to enter to sensor12 The semantic query of row second.
It is understood that the inquiry triple for including query object variable is now only remained in the first querying condition device hasFunctionalityFunction was not deleted, so step 504 terminates, the second inquiry finally determined Object is sensor22.
What deserves to be explained is the example above by every time delete one inquiry triple exemplified by, but be not restricted to every time One is only deleted, and the second query object determined may also may be multiple for one or may be empty.
In addition, the method that the embodiment of the present invention does not limit the query statement for being configured to inquire about the second query object, any It can realize for inquiring about the partial query triple met in the first querying condition, and be linked to long-range semantic description resource Query statement building method is suitable for the present invention.
505th, the first equipment sends the request of the second semantic query to the second equipment, and the second semantic query request bag contains institute State the inquiry triple in addition to the partial query triple in the first querying condition.
Wherein, the second equipment is the M2M where the semantic description resource of the link attributes of partial query triple instruction Platform, M2M gateways or M2M equipment.
As an example, the citing in above-mentioned steps 504 is continued to, the second query object is sensor22, it is determined that looking into Used partial query triple is when asking the second query object sensor22device hasFunctionality Function.Therefore, the inquiry triple in addition to partial query triple is:Function hasQuantities Quantities andQuantities hasUnitunit.Therefore, the first equipment is looked into the second semanteme that the second equipment is sent Ask the querying condition in request and include above-mentioned two inquiry triples.The destination address of second semantic query request is looked into for the part Ask the URI of the semantic description resource of the link attributes of triple instruction.
As another optional mode, the first equipment can also be made when it is determined that inquiring about the second query object sensor22 Partial query triple isdevice hasFunctionalityAfter Function, referred to using partial query triple The attribute shown generates the request of the second semantic query as the inquiry triple in addition to partial query triple.
As an example, the query statement in the request of the second semantic query is:
Second semantic query is asked for inquiring about in the semantic description resource of the second equipment storage Whether lightMeasuring is included by hasQuantities relationsAttribute corresponding to Quantities, and What lightMeasuring was includedWhether attribute corresponding to Quantities is included by hasUnit relationsBelong to corresponding to unit Property.
The attribute that partial query triple instruction is determined in step 504 is lightMeasuring, The URI of the semantic description resource of lightMeasuring links is http://www.onem2m.example2.org/***/, it is false If URI corresponding to CSE2 is http://www.onem2m.example2.org/, then it can determine that the instruction of partial query triple The URI of the semantic description resource of link attributes indicates that the semantic description resource of the link is the resource on CSE2, so second Equipment is M2M platforms, M2M gateways or the M2M equipment where CSE2.
It should be noted that it is to determine partial query that the first equipment sends the request of the second semantic query to the second equipment Whether the attribute or resource of triple instruction meet the second querying condition, and the second querying condition includes in the first querying condition and removes institute State the inquiry triple outside partial query triple.Therefore, the embodiment of the present invention is not limited in the present embodiment second and looked into The make for the query statement that request bag contains is ask, any query statement that can realize the purpose is regarded as feasible.
506th, the second equipment asks to carry out the second semantic query according to the second semantic query.
By taking the query statement in the second semantic query request in step 505 as an example, it is to be understood that semantic first In query process, it has been determined that sensor22 meets partial query tripledevice hasFunctionality Function, the second semantic query are to further determine that partial query tripledevice hasFunctionality Whether the attribute lightMeasuring of Function instructions further meets to remove partial query triple in the first querying condition Outside inquiry triple.
Assuming that the semantic information stored in the second equipment includes following triplet information:
lightMeasuring hasQuantities lightAspect
lightAspect hasUnit“Lux”
Now, the two inquiry triple (lightMeasuring included in being asked using the second semantic query hasQuantitiesQuantities andQuantities hasUnitUnit) in the semantic description resource of the second equipment Inquired about, because the semantic information stored in the second equipment includes triple lightMeasuring hasQuantities LightAspect, then illustrate that lightMeasuring meets first inquiry triple lightMeasuring hasQuantitiesQuantities.Wherein,Attribute corresponding to Quantities is lightAspect, then further inquiry Whether lightAspect meets that Article 2 inquires about tripleQuantities hasUnitunit.
Because the semantic information stored in the second equipment includes triple lightAspect hasUnit " Lux ", then say Bright lightAspect meets that Article 2 inquires about tripleQuantities hasUnitUnit, wherein,Belong to corresponding to unit Property is " Lux ".
Pass through inquiry, it is determined that semantemes of the attribute lightMeasuring of partial query triple instruction in the second equipment Included in description resource by hasQuantities relationsAttribute lightAspect corresponding to Quantities, and What lightMeasuring was includedAttribute lightAspect corresponding to Quantities further passes through hasUnit relation bags ContainAttribute corresponding to unit " Lux ", it may thereby determine that the second query object meets the second querying condition.It should be noted that If not storing pertinent triplets information in the second equipment, illustrate that the second query object is unsatisfactory for the second querying condition.
In embodiments of the present invention, so that the second query object meets the second querying condition as an example, it assumes that the second semanteme is looked into The Query Result of inquiry is yes.
It should be noted that the second query object may be multiple, the first equipment is needed respectively to each second query object Corresponding second equipment sends the request of the second semantic query.
507th, the second equipment sends the response of the second semantic query to the first equipment.
Wherein, the URI of the second equipment is carried in the response of the second semantic query, the response of the second semantic query is looked into for the second semanteme Ask success response or the second semantic query failure response.
It should be noted that each second equipment is completed to need after the second semantic query process to send the to the first equipment Two semantic queries respond.
Because the Query Result in step 506 is yes, so what the second equipment sent to the first equipment in this example is second Semantic query success response, the second semantic query result yes can be specifically carried in the second semantic query success response, and The URI http of the semantic description resource of above-mentioned part triple link://www.onem2m.example2.org/***/.
508th, the first equipment receives the second semantic query response that the second equipment is sent, and sends first to application server Semantic query responds.
When the second semantic query response be the second semantic query success response when, the first equipment according to the second semantic query into URI (http in work(response://www.onem2m.example2.org/*** /), being searched from the second query object list should Second query object (sensor22) corresponding to URI, due to having determined the second query object by above-mentioned semantic query process (sensor22) the partial query triple in the first querying condition is met, and the attribute of partial query triple instruction meets the Two querying conditions, therefore can consider that the second query object (sensor22) meets the first inquiry by long-range semantic query process Second query object sensor22, can be defined as the first query object by condition, therefore by sensor22 from the second query object Delete, while be added in the first query object list in list, now, the second query object list is empty, the first inquiry pair As list is:
device
sensor12
sensor22
When the response of the second semantic query is the second semantic query failure response, the first equipment is lost according to the second semantic query The URI in response is lost, the second query object corresponding to the URI is searched from the second query object list, due to passing through upper predicate Adopted query process has determined that although second query object meets the partial query triple in the first querying condition, portion The attribute of point inquiry triple instruction is unsatisfactory for the second querying condition, thus by long-range semantic query process can consider this Two query objects are unsatisfactory for the first querying condition, therefore by the second query object corresponding to the URI from the second query object list Delete, the first query object list keeps constant.
It should be noted that the first equipment can receive the second semantic query response of all the second equipment transmissions Judge to need to return to first to application server afterwards or according to other conditions (such as the second query object list is space-time) When semantic query responds, the response of the first semantic query can be just sent to application server, the response of the first semantic query includes the Second query object (sensor22) corresponding to one query object (sensor12) and the second semantic query success response.
The method of semantic query provided in an embodiment of the present invention, remote inquiry parameter is carried in semantic query request, can be with Indicate whether to need the long-range semantic description resource of query link, when needing the long-range semantic description resource of query link, make The link attributes indicated with partial query triple and resource link relational query triple query portion inquiry triple arrive Second query object of long-range semantic description resource and the attribute of partial query triple instruction, and then only need to be to part Equipment where inquiring about the long-range semantic description resource of the link attributes of triple instruction sends the request of the second semantic query, inquiry Whether the attribute or resource of partial query triple instruction meet the second querying condition, are retouched without all long-range semantemes in link Progress semantic query process in resource is stated, avoids and obtains excessive long-range semantic information, reduce network overhead.
Above-described embodiment is so that query object variable asks the resource of institute's requesting query for the first semantic query as an example, in this hair In another implementation that bright embodiment provides, query object variable can also ask institute's requesting query for the first semantic query Attribute, still with the method flow shown in Fig. 5, illustrated exemplified by being asked using code two as the first semantic query.
In step 501, application server send the request of the first semantic query to the first equipment, the request of the first semantic query In the query statement that includes with reference to as above code two:
Then the query object variable of the first semantic query request isQuantities,Quantities is requesting query Attribute, inquiry triple indicate respectivelyAttribute is corresponding to FunctionThe category that resource corresponding to device or attribute include Property,Attribute is corresponding to QuantitiesThe attribute that attribute corresponding to Function is included.
It follows that the request of the first semantic query, which needs to inquire about in the first equipment, meets that the first querying condition (passes through HasQuantities relation quiltsAttribute is included corresponding to Function, andAttribute passes through corresponding to Function HasFunctionality relation quiltsResource corresponding to device or attribute are included) query object.
Further, in two inquiry triples in above-mentioned code two, because the subject of Article 2 inquiry triple is The object of first inquiry triple, therefore the first equipment determines that this three inquiry triples belong to the inquiry ternary of progressive relationship Group.
In this example, it will again be assumed that long-range semantic query parameter is true, and the first equipment needs the long-range semanteme of query link to retouch State resource.
Further, the is met using the query statement inquiry in the request of the first semantic query in step 503, the first equipment In first query object of one querying condition, using in the triplet information shown in two query statements from Fig. 4 in code two Inquire about the first query objectQuantities, pass through inquiry, sensor12hasFunctionality MeasuringTemperature meets first query statement in code two, measuringTemperature HasQuantities TemperatureAspect meet the Article 2 query statement in code two.
I.e.Attribute TemperatureAspect is corresponding to QuantitiesAttribute corresponding to Function MeasuringTemperature is included,Attribute measuringTemperature is corresponding to FunctionDevice pairs The attribute that the resource sensor12 answered is included, it is possible to it is determined that the first query object for meeting the first querying condition is Attribute TemperatureAspect corresponding to Quantities.
Further, since also include sensor12 hasFunctionality in triplet information shown in Fig. 4 MeasuringHumidity (meeting first query statement in code two) and measuringHumidity HasQuantities HumidityAspect (meet the Article 2 query statement in code two), it is possible to it is determined that meeting the The query object of one querying condition also includes:Attribute HumidityAspect corresponding to Quantities.
Determine that the first query object list is by inquiry:
Quantities
TemperatureAspect
measuringHumidity
Then, partial query triple and resource link inquiry ternary are used corresponding to above-mentioned steps 504, the first equipment Group polling partial query triple instruction link attributes arrive long-range semantic description resource the second query object, and inquire about institute State the attribute or resource of partial query triple instruction.
Because in code two, first is inquired about tripledevice hasFunctionalityFunction object Triple is inquired about for Article 2Function hasQuantitiesQuantities object, it is possible to determine first Inquiry triple is superior to Article 2 inquiry triple, so the order according to rank from low to high, it should delete second Bar inquires about triple, but because Article 2 inquiry triple is the inquiry triple comprising query object variable, so can not Article 2 inquiry triple is deleted, so there is no the inquiry triple that can be deleted in code two, i.e., it is remote without that can inquire about Journey semantic description resource, now, the second query object list are sky, without performing the process of the second semantic query.
So the first equipment directly can send the response of the first semantic query, the response of the first semantic query to application server In include the first query object TemperatureAspect and measuringHumidity.
The method of semantic query provided in an embodiment of the present invention, remote inquiry parameter is carried in semantic query request, can be with Indicate whether to need the long-range semantic description resource of query link, when needing the long-range semantic description resource of query link, make The link attributes indicated with partial query triple and resource link relational query triple query portion inquiry triple arrive Second query object of long-range semantic description resource and the attribute of partial query triple instruction, and then only need to be to part Equipment where inquiring about the CSE of the Attribute Association of triple instruction sends the request of the second semantic query, query portion inquiry ternary Whether the attribute or resource of group instruction meet the second querying condition, without being carried out in all long-range semantic description resources of link Semantic query process, avoid and obtain excessive long-range semantic information, reduce network overhead.
As shown in fig. 6, the embodiment of the present invention additionally provides a kind of device of semantic query, the device of the semantic query is specific To store the device of semantic description resource, the device is applied in M2M gateways, M2M platforms or M2M equipment, and the device includes:Connect Receive unit 601, query unit 603 and transmitting element 604.
Receiving unit 601, for receiving the request of the first semantic query, the first semantic query request includes query object Variable and the first querying condition, the query object become the attribute of the first semantic query request institute requesting query described in amount instruction Or resource, first querying condition include at least two inquiry triples, at least two inquiries triple indicates respectively The attribute and/or resource of the query object association;
Query unit 602, for using at least two inquiries ternary group polling to meet first querying condition First query object;Referred to using partial query triple described in partial query triple and resource link inquiry ternary group polling The link attributes shown are to the second query object of long-range semantic description resource, and inquiry partial query triple instruction Attribute or resource, the partial query triple are inquired about in triple for described at least two and delete at least one inquiry ternary Inquiry triple after group, the inquiry ternary for including the query object variable in the partial query triple at least be present Group;
Transmitting element 603, for the long-range semantic description resource of the link attributes indicated to the partial query triple The equipment at place sends the request of the second semantic query to determine whether the attribute of the partial query triple instruction meets second Querying condition, second querying condition include looking into addition to the partial query triple in first querying condition Ask triple.
Further, receiving unit 601 be additionally operable to perform Fig. 5 in the first equipment perform step 501,508.Query unit 602 can be also used for performing the step 502 that the first equipment performs in Fig. 5, the steps such as 503,504, and transmitting element 603 can also be used In the step 505 for performing the first equipment execution in Fig. 5.The present invention will not be described in detail herein.In addition, the device in Fig. 6 can be used for Perform and any flow that the equipment of semantic description resource performs is stored in above method flow, store Fig. 3 and Fig. 4 semantic description Resource.
Further, device in Fig. 6 is presented in the form of functional unit.Here " unit " can refer to specific answer With integrated circuit (application-specific integrated circuit, ASIC), circuit, one or more is performed The processor and memory of software or firmware program, integrated logic circuit, and/or other can provide the device of above-mentioned function. In a simple embodiment, the device that those skilled in the art is contemplated that in Fig. 6 can use the shape shown in Fig. 2 Formula.Each unit can be realized by Fig. 2 processor, transceiver and memory.
The embodiment of the present invention additionally provides a kind of computer-readable storage medium, for saving as the storage language shown in above-mentioned Fig. 6 Computer software instructions used in the device 6 of justice description resource, it, which is included, is used to perform the journey designed by above method embodiment Sequence.By the program for performing storage, it is possible to achieve carry out semantic query to semantic description resource.Those of ordinary skill in the art should All or part of subject matters of understanding the application can be implemented in the software of hardware and/or firmware is combined.For example, it is described herein Subject matter can one or more processors perform software in implement.In an illustrative embodiments, it is described herein Subject matter can be used be stored with computer executable instructions non-emporary computer-readable medium implement, work as computer processor When performing the computer executable instructions, the instruction control computer performs step.It is adapted for carrying out subject matter described herein Example computer readable mediums include non-emporary computer-readable medium, for example, disk memory devices, chip memory devices, Programmable logic device and application specific integrated circuit.In addition, implementing the computer-readable medium of subject matter described herein can be located at On individual equipment or calculating platform, or it can distribute in multiple equipment or calculating platform.
Finally it should be noted that:The above embodiments are merely illustrative of the technical solutions of the present invention, rather than its limitations;Although The present invention is described in detail with reference to the foregoing embodiments, it will be understood by those within the art that:It still may be used To be modified to the technical scheme described in foregoing embodiments, or equivalent substitution is carried out to which part technical characteristic; And these modifications or replacement, the essence of appropriate technical solution is departed from the scope of various embodiments of the present invention technical scheme.

Claims (15)

  1. A kind of 1. method of semantic query, applied to machine communication M2M systems, it is characterised in that methods described includes:
    The request of the first semantic query is received, the first semantic query request includes query object variable and the first inquiry bar Part, the query object become the attribute or resource of the first semantic query request institute requesting query described in amount instruction, and described first looks into Inquiry condition includes at least two inquiry triples, and at least two inquiries triple indicates respectively the query object association Attribute and/or resource;
    Meet the first query object of first querying condition using described at least two inquiry ternary group pollings;
    The attribute indicated using partial query triple described in partial query triple and resource link inquiry ternary group polling It is linked to the second query object of long-range semantic description resource, and the attribute or money of the inquiry partial query triple instruction Source, the partial query triple inquire about in triple looking into after deleting at least one inquiry triple for described at least two Triple is ask, the inquiry triple for including the query object variable at least be present in the partial query triple;
    Equipment where the long-range semantic description resource of the link attributes indicated to the partial query triple sends the second language To determine whether the attribute of the partial query triple instruction meets the second querying condition, described second inquires about adopted inquiry request Condition includes the inquiry triple in addition to the partial query triple in first querying condition.
  2. 2. the method for semantic query according to claim 1, it is characterised in that described to the partial query triple After equipment where the long-range semantic description resource of the link attributes of instruction sends the request of the second semantic query, methods described is also Including:
    Equipment where receiving the long-range semantic description resource of the link attributes of partial query triple instruction return the Two semantic query success responses;
    The response of the first semantic query is sent, the first semantic query response includes first query object and described second Query object.
  3. 3. the method for semantic query according to claim 1, it is characterised in that described to the partial query triple After equipment where the long-range semantic description resource of the link attributes of instruction sends the request of the second semantic query, methods described is also Including:
    Equipment where receiving the long-range semantic description resource of the link attributes of partial query triple instruction return the Two semantic query failure responses;
    The response of the first semantic query is sent, the first semantic query response includes first query object, not including institute State the second query object.
  4. 4. the method for the semantic query according to Claims 2 or 3, it is characterised in that when the query object variable is one When bar inquires about the subject of triple, at least two inquiries triple indicate respectively the attribute that the query object includes and/ Or the attribute included by the attribute that the query object includes;
    When the query object variable is an object for inquiring about triple, at least two inquiries triple indicates respectively Attribute or resource belonging to the query object, and attribute or resource belonging to attribute belonging to the query object.
  5. 5. the method for semantic query according to claim 4, it is characterised in that it is described using partial query triple and The link attributes of partial query triple instruction described in resource link inquiry ternary group polling are to the of long-range semantic description resource Two query objects, and the attribute or resource of the inquiry partial query triple instruction;Refer to the partial query triple Equipment where the long-range semantic description resource of the link attributes shown sends the request of the second semantic query, including:
    S1, at least one deleted in first querying condition inquire about triple, wherein, remaining inquiry triple after deletion The inquiry three for including the query object variable for the partial query triple, in the partial query triple at least be present Tuple;
    S2, construction resource link inquiry triple, the quantity and deleted inquiry ternary of the resource link inquiry triple The quantity of group is identical, and the subject of resource link inquiry triple is the object of the deleted inquiry triple, predicate It is designated as resource link relation, object is either query variable, the inquiry in the either query variable and the first querying condition Variable is different;
    S3, use partial query triple described in the partial query triple and resource link inquiry ternary group polling The category that the link attributes of instruction indicate to the second query object of long-range semantic description resource and the partial query triple Property;
    S4, when second query object and during the first query object difference, indicated to the partial query triple Equipment where the long-range semantic description resource of link attributes sends the request of the second semantic query;
    Circulation performs above-mentioned steps S1 to S4, until except the inquiry for including the query object variable in first querying condition Inquiry triple outside triple was all deleted once.
  6. 6. the method for semantic query according to claim 5, it is characterised in that described to delete in first querying condition At least one inquiry triple, including:
    Judge whether the rank between the inquiry triple in first querying condition is identical;
    When the rank difference between the inquiry triple in first querying condition, according to the rank of inquiry triple from low To high order, at least one low inquiry triple of inquiry rank in first querying condition is deleted every time;After deletion The inquiry triple for including the query object variable described at least existing in remaining inquiry triple;
    When the rank between the inquiry triple in first querying condition is identical, institute is deleted every time by the way of traversal At least one inquiry triple in the first querying condition is stated, wherein, institute at least be present in remaining inquiry triple after deletion State the inquiry triple for including the query object variable.
  7. 7. the method for the semantic query according to claim 5 or 6, it is characterised in that in the first semantic query request Including long-range semantic query parameter, the long-range semantic query parameter is used to indicate whether to need to carry out remote inquiry;Or
    Receive in the equipment of the first semantic query request comprising remote inquiry instruction strategy, the remote inquiry instruction strategy It is used to indicate whether to need to carry out remote inquiry.
  8. A kind of 8. device of semantic query, applied to machine communication M2M systems, it is characterised in that described device includes:
    Receiving unit, for receiving the request of the first semantic query, first semantic query request include query object variable with And first querying condition, the query object become the attribute or money of the first semantic query request institute requesting query described in amount instruction Source, first querying condition include at least two inquiry triples, and at least two inquiries triple indicates respectively described The attribute and/or resource of query object association;
    Query unit, for using at least two inquiries ternary group polling to meet the first inquiry of first querying condition Object;The attribute indicated using partial query triple described in partial query triple and resource link inquiry ternary group polling It is linked to the second query object of long-range semantic description resource, and the attribute or money of the inquiry partial query triple instruction Source, the partial query triple inquire about in triple looking into after deleting at least one inquiry triple for described at least two Triple is ask, the inquiry triple for including the query object variable at least be present in the partial query triple;
    Transmitting element, for setting where the long-range semantic description resource of the link attributes indicated to the partial query triple Preparation send the request of the second semantic query to determine whether the attribute of the partial query triple instruction meets the second querying condition, Second querying condition includes the inquiry triple in addition to the partial query triple in first querying condition.
  9. 9. the device of semantic query according to claim 8, it is characterised in that
    The receiving unit, it is additionally operable to receive the long-range semantic description resource of the link attributes of the partial query triple instruction The second semantic query success response that the equipment at place returns;
    The transmitting element, is additionally operable to send the response of the first semantic query, and first semantic query response includes described the One query object and second query object.
  10. 10. the device of semantic query according to claim 8, it is characterised in that
    The receiving unit, it is additionally operable to receive the long-range semantic description resource of the link attributes of the partial query triple instruction The second semantic query failure response that the equipment at place returns;
    The transmitting element, is additionally operable to send the response of the first semantic query, and first semantic query response includes described the One query object, not including second query object.
  11. 11. the device of the semantic query according to claim 9 or 10, it is characterised in that when the query object variable is One inquiry triple subject when, it is described at least two inquiry triple indicate respectively the attribute that the query object includes And/or the attribute included by the attribute that the query object includes;
    When the query object variable is an object for inquiring about triple, at least two inquiries triple indicates respectively Attribute or resource belonging to the query object, and attribute or resource belonging to attribute belonging to the query object.
  12. 12. the device of semantic query according to claim 11, it is characterised in that
    The query unit, it is additionally operable to delete at least one inquiry triple in first querying condition, wherein, after deletion Remaining inquiry triple is the partial query triple, at least exists in the partial query triple and includes the inquiry The inquiry triple of object variable;Construct resource link inquiry triple, the quantity and quilt of the resource link inquiry triple The quantity of the inquiry triple of deletion is identical, and the subject of the resource link inquiry triple is the deleted inquiry ternary The object of group, predicate are designated as resource link relation, and object is either query variable, the either query variable and the first inquiry Query interface in condition is different;Using described in the partial query triple and resource link inquiry ternary group polling Second query object and the partial query of the link attributes of partial query triple instruction to long-range semantic description resource The attribute of triple instruction;
    The transmitting element, it is additionally operable to when second query object and the first query object difference, to the part Equipment where inquiring about the long-range semantic description resource of the link attributes of triple instruction sends the request of the second semantic query;
    The query unit, it is additionally operable to that the inquiry triple for including the query object variable will be removed in first querying condition Outside inquiry triple all delete once.
  13. 13. the device of semantic query according to claim 12, it is characterised in that
    The query unit, it is additionally operable to judge whether the rank between the inquiry triple in first querying condition is identical; When the rank difference between the inquiry triple in first querying condition, according to inquiry triple rank from low to high Order, delete at least one low inquiry triple of inquiry rank in first querying condition every time;It is remaining after deletion Inquiry triple at least exist described in include the inquiry triple of the query object variable;When first querying condition In inquiry triple between rank it is identical when, deleted every time in first querying condition at least by the way of traversal One inquiry triple, wherein, after deletion it is remaining inquiry triple at least exist described in include the query object variable Inquiry triple.
  14. 14. the device of the semantic query according to claim 12 or 13, it is characterised in that the first semantic query request Include long-range semantic query parameter, the long-range semantic query parameter is used to indicate whether to need to carry out remote inquiry;Or
    Receive in the equipment of the first semantic query request comprising remote inquiry instruction strategy, the remote inquiry instruction strategy It is used to indicate whether to need to carry out remote inquiry.
  15. A kind of 15. device of semantic query, applied to machine communication M2M systems, it is characterised in that including:
    Memory, for storing computer executable program code;
    Transceiver, and
    Processor, with the memory and the transceiver couples;
    Wherein described program code includes instruction, and when being instructed described in the computing device, the instruction holds described device Row is following to be operated:
    The request of the first semantic query is received, the first semantic query request includes query object variable and the first inquiry bar Part, the query object become the attribute or resource of the first semantic query request institute requesting query described in amount instruction, and described first looks into Inquiry condition includes at least two inquiry triples, and at least two inquiries triple indicates respectively the query object association Attribute and/or resource;
    Meet the first query object of first querying condition using described at least two inquiry ternary group pollings;
    The attribute indicated using partial query triple described in partial query triple and resource link inquiry ternary group polling It is linked to the second query object of long-range semantic description resource, and the attribute or money of the inquiry partial query triple instruction Source, the partial query triple inquire about in triple looking into after deleting at least one inquiry triple for described at least two Triple is ask, the inquiry triple for including the query object variable at least be present in the partial query triple;
    Equipment where the long-range semantic description resource of the link attributes indicated to the partial query triple sends the second language To determine whether the attribute of the partial query triple instruction meets the second querying condition, described second inquires about adopted inquiry request Condition includes the inquiry triple in addition to the partial query triple in first querying condition.
CN201610387225.6A 2016-06-01 2016-06-01 Semantic query method and device Active CN107451164B (en)

Priority Applications (2)

Application Number Priority Date Filing Date Title
CN201610387225.6A CN107451164B (en) 2016-06-01 2016-06-01 Semantic query method and device
PCT/CN2017/082233 WO2017206634A1 (en) 2016-06-01 2017-04-27 Method and device for querying semantics

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN201610387225.6A CN107451164B (en) 2016-06-01 2016-06-01 Semantic query method and device

Publications (2)

Publication Number Publication Date
CN107451164A true CN107451164A (en) 2017-12-08
CN107451164B CN107451164B (en) 2020-05-19

Family

ID=60479730

Family Applications (1)

Application Number Title Priority Date Filing Date
CN201610387225.6A Active CN107451164B (en) 2016-06-01 2016-06-01 Semantic query method and device

Country Status (2)

Country Link
CN (1) CN107451164B (en)
WO (1) WO2017206634A1 (en)

Cited By (2)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN110569335A (en) * 2018-03-23 2019-12-13 百度在线网络技术(北京)有限公司 triple verification method and device based on artificial intelligence and storage medium
CN110807311A (en) * 2018-07-18 2020-02-18 百度在线网络技术(北京)有限公司 Method and apparatus for generating information

Citations (5)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN101655862A (en) * 2009-08-11 2010-02-24 华天清 Method and device for searching information object
CN103049506A (en) * 2012-12-12 2013-04-17 华南理工大学 Data caching method and system of mobile device
CN104424310A (en) * 2013-09-06 2015-03-18 中国海洋大学 Ontology-based smart home semantic query method and ontology-based smart home semantic query device
CN104750709A (en) * 2013-12-26 2015-07-01 中国移动通信集团公司 Semantic retrieval method and semantic retrieval system
US20150227618A1 (en) * 2014-02-07 2015-08-13 Convida Wireless, Llc Enabling Resource Semantics

Family Cites Families (3)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US20100228794A1 (en) * 2009-02-25 2010-09-09 International Business Machines Corporation Semantic document analysis
JP5225350B2 (en) * 2010-09-28 2013-07-03 株式会社東芝 Information retrieval device
CN105045790A (en) * 2015-03-13 2015-11-11 北京航空航天大学 Graph data search system, method and device

Patent Citations (5)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN101655862A (en) * 2009-08-11 2010-02-24 华天清 Method and device for searching information object
CN103049506A (en) * 2012-12-12 2013-04-17 华南理工大学 Data caching method and system of mobile device
CN104424310A (en) * 2013-09-06 2015-03-18 中国海洋大学 Ontology-based smart home semantic query method and ontology-based smart home semantic query device
CN104750709A (en) * 2013-12-26 2015-07-01 中国移动通信集团公司 Semantic retrieval method and semantic retrieval system
US20150227618A1 (en) * 2014-02-07 2015-08-13 Convida Wireless, Llc Enabling Resource Semantics

Cited By (3)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN110569335A (en) * 2018-03-23 2019-12-13 百度在线网络技术(北京)有限公司 triple verification method and device based on artificial intelligence and storage medium
US11275810B2 (en) 2018-03-23 2022-03-15 Baidu Online Network Technology (Beijing) Co., Ltd. Artificial intelligence-based triple checking method and apparatus, device and storage medium
CN110807311A (en) * 2018-07-18 2020-02-18 百度在线网络技术(北京)有限公司 Method and apparatus for generating information

Also Published As

Publication number Publication date
WO2017206634A1 (en) 2017-12-07
CN107451164B (en) 2020-05-19

Similar Documents

Publication Publication Date Title
US11368522B2 (en) Lightweight IoT information model
US11563819B2 (en) Operation triggering method and apparatus for machine-to-machine communications
Krause et al. Challenges in modelling and using quality of context (qoc)
JP7065082B2 (en) Semantic queries against distributed semantic descriptors
CN109672558B (en) Aggregation and optimal matching method, equipment and storage medium for third-party service resources
Leppänen et al. Mobile agents for integration of internet of things and wireless sensor networks
WO2016141783A1 (en) Method for access control, policy acquisition, attribute acquisition and related apparatus
Atkins et al. A cloud service for end-user participation concerning the internet of things
CN107451164A (en) A kind of method and device of semantic query
WO2018227695A1 (en) Subscription data sending and receiving method, device and system
US11088989B2 (en) Semantic validation method and apparatus
WO2021017907A1 (en) Method and device for optimized inter-microservice communication
CN113660127A (en) Networking control method, device and equipment in networking based on easy mesh
CN109246660A (en) A kind of method and M2M platform managing ontology
Li et al. Multiple protocols interworking with open connectivity foundation in fog networks
WO2019052075A1 (en) Query enhancement system and method for constructing elastic field based on time delay
CN103731510B (en) Data interaction method for application layer of wireless sensor network based on IPv6 (internal protocol version 6)
CN114936097A (en) Processing node determination method, processing node determination device, computer equipment and storage medium
CN104346340B (en) A kind of method and apparatus of storage resource describing framework data
CN106790323A (en) A kind of method and device of resource discovering
CN106656935A (en) Character issuing method, access control method and correlation equipment thereof
CN107306398A (en) Distributed authorization management method and device
Yao et al. Minerva: Decentralized Collaborative Query Processing over InterPlanetary File System
CN113726563A (en) Block chain service access method and device, computer equipment and storage medium
CN113987279A (en) Modeling method and device for entity node and computer readable storage medium

Legal Events

Date Code Title Description
PB01 Publication
PB01 Publication
SE01 Entry into force of request for substantive examination
SE01 Entry into force of request for substantive examination
GR01 Patent grant
GR01 Patent grant
TR01 Transfer of patent right
TR01 Transfer of patent right

Effective date of registration: 20220215

Address after: 550025 Huawei cloud data center, jiaoxinggong Road, Qianzhong Avenue, Gui'an New District, Guiyang City, Guizhou Province

Patentee after: Huawei Cloud Computing Technology Co.,Ltd.

Address before: 518129 Bantian HUAWEI headquarters office building, Longgang District, Guangdong, Shenzhen

Patentee before: HUAWEI TECHNOLOGIES Co.,Ltd.