Consuming the Thing Model
Relationships within the Thing Model
Thing Shapes and Thing Templates share common interaction patterns to classify, search, and find Things. The interaction model allows you to get a list of assets by type or classification. For example, you can ask a Thing Shape or Thing Template to get of list of all assets that are of the same type, such as a dishwasher model, by using the QueryImplementingThings service of that entity. If you use QueryImplementingThingsWithData, you get the properties of the assets with the asset list. You can also ask more interesting questions by adding query parameters. For example, you may want to know where your Acme Economy Lawn Tractors (defined by a Thing Template) are within 50 miles of Boston. You may want to know which tractors have an engine run time of greater than 400 hours, since that group is likely to need servicing. The Thing Model enables these types of queries through built-in search capabilities.
Searching the Model
Search is an inherent capability within ThingWorx and can do the following:
Full-text search on model names, model descriptions, and any data fields that are of type TEXT
Search relationships within the model (as described above)
Search model and run time data using semantic tags
The vocabulary entity type allows you to define semantic tags. A vocabulary can have one or more tags. Vocabularies are defined with model tags or data tags, as those items may be stored separately. Tags are like additional indexes that can be used to examine the model and data using search.
Vocabularies can be dynamic (for example, tagging machine data with work in process codes that are constantly expanding) or static (for example, a list of statuses for a work order, which is a set that describes a predefined work order workflow). You may want all downtime events in your facility to have a specific set of reason codes. You can use a static vocabulary as a predefined set of reasons. You can query and count downtime events by reason code.
Model tags can be used to group entity definitions. Entities can have more than one tag associated with them. For example, you can search for all entities that are part of a specified application.
Data tags are used to search run time data and operations. For example, you may be producing mobile phones. Each phone has a serial number with which you can track that phone. As you run the phone through the production and assembly environment, you collect data from the machines and processes in the plant. As a phone moves to a new machine or work center, the data collected at the work center can be tagged with the serial number. Therefore, you can trace the process data and conditions for that phone throughout the process. If you receive defect reports later, you may be able to determine that each phone that was processed on a machine with a new operator has the same defect pattern. Tagging makes it easier to search through data in that way.
You can also use tags to logically group assets, for example, to filter the list of assets for which a regional service center is responsible.
Search is surfaced in multiple ways in ThingWorx. You can create indexes of third-party repositories and include those searches in the native ThingWorx search. You can allow service technicians to search reason codes, product manuals, and so on through run time search.
Consuming the Model
Because of the object-oriented nature of the model, you can create user interfaces based on Thing Shapes or Thing Templates, and then pass in an asset at run time based on user interaction. That abstraction is possible because the metadata of a Thing Shape or Thing Template matches the Thing instance. Using the different ways to query the model, you can pass a set of assets to a Web page for a user selection or to a third-party application to consume. All APIs in ThingWorx, which are available to the ThingWorx Mashup Builder, are also available to other applications and will return JSON, XML, CSV, or HTML depending on the request.
Since the APIs of ThingWorx are strongly typed, you can develop rich user interfaces using drag and drop in the ThingWorx Mashup Builder. For more information, see the section on Visualization and the ThingWorx API.