/* IsNtype is true if the input is a node and it is of type t. */ func IsNtype(input interface{}, t TypeID) bool { var ( n map[string]interface{} tv interface{} ok bool ) if !ld.IsNode(input) { return false } n = input.(map[string]interface{}) tv, ok = n["@type"] if !ok { return false } switch tv.(type) { case string: return t.URI() == tv.(string) case []string: for _, typeval := range tv.([]string) { if t.URI() == typeval { return true } } } return false }
/* GetN gets the property of a node if it is a node */ func GetN(input interface{}, propID PropID) (map[string]interface{}, bool) { var ( node map[string]interface{} propI interface{} ok bool ) node, ok = input.(map[string]interface{}) if !ok { return nil, false } propI, ok = node[propID.URI()] if !ok { return nil, false } if !ld.IsNode(propI) { return nil, false } return propI.(map[string]interface{}), true }