Skip to content

Commit

Permalink
Merge pull request #1 from connctd/PandelisZ-patch-1
Browse files Browse the repository at this point in the history
Tiny readme adjustments
  • Loading branch information
sebastian-garn authored May 18, 2020
2 parents 7cbd508 + d35152f commit d58aa7a
Showing 1 changed file with 11 additions and 11 deletions.
22 changes: 11 additions & 11 deletions README.md
Original file line number Diff line number Diff line change
@@ -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

Expand All @@ -19,34 +19,34 @@ 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)
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)
```
```

0 comments on commit d58aa7a

Please # to comment.