From d35152f657af23ece43ef45ab2b087d508ba5676 Mon Sep 17 00:00:00 2001 From: Pandelis Zembashis Date: Mon, 18 May 2020 16:54:24 +0200 Subject: [PATCH] Tiny readme adjustments --- README.md | 22 +++++++++++----------- 1 file changed, 11 insertions(+), 11 deletions(-) diff --git a/README.md b/README.md index e6415f1..53a12e2 100644 --- a/README.md +++ b/README.md @@ -1,12 +1,12 @@ # WoT Lib -This lib was created to simplify work with WoT Thing Descriptions. -It is coupled to W3C's recommendation from 9 April 2020 (https://www.w3.org/TR/2020/REC-wot-thing-description-20200409/) which means it assumes a certain structure. So far only a subset of fields are +This lib was created to simplify working with [WoT Thing Descriptions](https://www.w3.org/TR/wot-thing-description/). +It is coupled to W3C's recommendation from 9 April 2020 (https://www.w3.org/TR/2020/REC-wot-thing-description-20200409/) which means it assumes a certain structure. So far only a subset of the fields are implemented. ## Working principle -Read TD -> Expand -> Perform operations +Read Thing Description -> Expand -> Perform operations ## Capabilities @@ -19,14 +19,14 @@ Read TD -> Expand -> Perform operations The following example reads a td from bytes and retrieves all property affordances that match a given criteria -``` -// define additionally used schema +```go +// Define additionally used schema var iotSchema = wotlib.SchemaMapping{ Prefix: wotlib.SchemaPrefix("iot"), IRI: "http://iotschema.org/", } -// append it so its used during compaction +// Append it so its used during compaction wotlib.AppendSchema(iotSchema) expandedTD, err := wotlib.FromBytes(input) @@ -34,19 +34,19 @@ if err != nil { panic(err) } -// retrieve all property affordances that match given criteria +// Retrieve all property affordances that match given criteria props := expandedTD.GetPropertyAffordances(wotlib.PropertyConstraint{ Type: &[]string{iotSchema.IRIPrefix("SwitchStatus")}, }) -// prints the href of the first match +// Prints the href of the first match fmt.Printf("Result: %s", props[0].Form.Value().Href.Value()) ``` -In case multiple tds have to be processed append them to a set +In case multiple Thing Descriptions have to be processed append them to a set and apply the operation -``` +```go set := wotlib.NewExpandedThingDescriptionSet(expandedTD) set.GetActionAffordances(thingConstraint) -``` \ No newline at end of file +```