{"record":{"id":"c226aedcd0759c74","repo":"cayleygraph/cayley","slug":"no-matching-values-for-the-item-v-in-v","errorCode":null,"errorMessage":"No matching values for the item %#v in %#v","messagePattern":"No matching values for the item %#v in %#v","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"query/linkedql/steps/jsonld_util.go","lineNumber":61,"sourceCode":"\t\t\treturn fmt.Errorf(\"Expected \\\"%v\\\" but instead received \\\"%v\\\"\", s, t)\n\t\t}\n\t\treturn nil\n\tcase ldArray:\n\t\tt, ok := target.(ldArray)\n\t\tif !ok {\n\t\t\treturn fmt.Errorf(\"Expected multiple values but instead received the single value: %#v\", target)\n\t\t}\n\t\tif len(s) != len(t) {\n\t\t\treturn fmt.Errorf(\"Expected %#v and %#v to have the same length\", s, t)\n\t\t}\n\titems:\n\t\tfor _, i := range s {\n\t\t\tfor _, tI := range t {\n\t\t\t\tif isomorphic(i, tI) == nil {\n\t\t\t\t\tcontinue items\n\t\t\t\t}\n\t\t\t}\n\t\t\treturn fmt.Errorf(\"No matching values for the item %#v in %#v\", i, t)\n\t\t}\n\t\treturn nil\n\tcase ldMap:\n\t\tt, ok := target.(ldMap)\n\t\tif !ok {\n\t\t\treturn fmt.Errorf(\"Expected %#v to be a map or a slice with a single map but instead received %T\", target, target)\n\t\t}\n\t\tfor k, v := range s {\n\t\t\ttV, _ := t[k]\n\t\t\terr := isomorphic(v, tV)\n\t\t\tif err != nil {\n\t\t\t\treturn err\n\t\t\t}\n\t\t}\n\t}\n\treturn nil\n}\n","sourceCodeStart":43,"sourceCodeEnd":79,"githubUrl":"https://github.com/cayleygraph/cayley/blob/81dcd7d73e45136bc0d01802a8ba4685d8a533eb/query/linkedql/steps/jsonld_util.go#L43-L79","documentation":"In linkedql's JSON-LD pattern comparison (jsonld_util.go:61), the isomorphic function recursively compares a source JSON-LD value against a target value. When the source is a slice (ldSlice), every element of the target slice is checked for a structurally isomorphic match; if any source element has no match, this error is thrown. It means the pattern's array value does not correspond element-wise/structurally to the expected JSON-LD data.","triggerScenarios":"Calling isomorphic (directly or via pattern parsing) with a source ldSlice whose element has no isomorphic counterpart in the target ldSlice, e.g. a pattern like {\"@type\": [\"Person\"]} compared against data lacking a matching entry.","commonSituations":"Writing LinkedQL JSON-LD patterns where an array of values (types, IRIs, nested objects) does not match any element in the document being matched; typos in IRIs or type names inside arrays.","solutions":["Check each element of the source array against the target data for exact structural equality (properties, @id, @type).","Fix typos in IRIs, @type names, or keys inside the array value of the pattern.","If the element is legitimately optional, remove it from the pattern array or restructure the pattern.","Log both %#v values from the error message to identify which element failed to match."],"exampleFix":"// before\npattern := map[string]interface{}{\"@type\": []interface{}{\"Preson\"}} // typo\n// after\npattern := map[string]interface{}{\"@type\": []interface{}{\"Person\"}}","handlingStrategy":"validation","validationCode":"func arrayElementsPresentIn(pattern []interface{}, target []interface{}) bool {\n  for _, p := range pattern {\n    found := false\n    for _, t := range target {\n      if reflect.DeepEqual(p, t) { found = true; break }\n    }\n    if !found { return false }\n  }\n  return true\n}","typeGuard":"func asLDMapSlice(v interface{}) ([]map[string]interface{}, bool) {\n  s, ok := v.([]interface{})\n  if !ok { return nil, false }\n  out := make([]map[string]interface{}, 0, len(s))\n  for _, e := range s {\n    m, ok := e.(map[string]interface{})\n    if !ok { return nil, false }\n    out = append(out, m)\n  }\n  return out, true\n}","tryCatchPattern":"if err := isomorphic(src, target); err != nil {\n  // err names the non-matching item in %#v; log and fall back to looser matching\n  log.Printf(\"pattern mismatch: %v\", err)\n}","preventionTips":["Validate JSON-LD patterns against your data model before matching","Verify IRIs and @type names with a linter or constant definitions","Log both compared values when a match fails to spot the exact element"],"tags":["jsonld","pattern-matching","linkedql","go"],"backgroundTag":"schema-validation-failed","analyzedSha":"81dcd7d73e45136bc0d01802a8ba4685d8a533eb","analyzedAt":"2026-09-06T06:14:12.358Z","contentChangedAt":"2026-09-06T06:14:12.358Z","schemaVersion":2},"datasetVersion":"2026-09-14T05:17:10.506Z"}