Skip to content

Commit

Permalink
gh-934 rename $cref -> beacon
Browse files Browse the repository at this point in the history
  • Loading branch information
etiennedi committed Aug 1, 2019
1 parent 3b3bc6d commit 72c36e8
Show file tree
Hide file tree
Showing 27 changed files with 106 additions and 106 deletions.
2 changes: 1 addition & 1 deletion adapters/connectors/janusgraph/consts.go
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ const PROP_KEY_EXPIRES_UNIX = "keyExpiresUnix"
const PROP_KEY_TOKEN = "keyToken"

// Properties for SingleRef/MultipleRef's
const PROP_REF_EDGE_CREF = "$cref"
const PROP_REF_EDGE_CREF = "beacon"
const PROP_REF_EDGE_TYPE = "refType"
const PROP_REF_EDGE_LOCATION = "locationUrl"

Expand Down
4 changes: 2 additions & 2 deletions adapters/connectors/janusgraph/get/query_processor.go
Original file line number Diff line number Diff line change
Expand Up @@ -214,9 +214,9 @@ func (p *Processor) processEdgeAndVertexObjects(o []interface{}, className schem
}

func (p *Processor) refTypeFromEdge(edgeMap map[string]interface{}) (*crossref.Ref, error) {
uuid, ok := edgeMap["$cref"]
uuid, ok := edgeMap["beacon"]
if !ok {
return nil, fmt.Errorf("expected edge object to be have key '$cref', but got %#v", edgeMap)
return nil, fmt.Errorf("expected edge object to be have key 'beacon', but got %#v", edgeMap)
}

location, ok := edgeMap["locationUrl"]
Expand Down
26 changes: 13 additions & 13 deletions adapters/connectors/janusgraph/get/query_processor_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -139,7 +139,7 @@ func Test_QueryProcessor(t *testing.T) {
},
map[string]interface{}{
"refId": "prop_3",
"$cref": uuid2,
"beacon": uuid2,
"locationUrl": "localhost",
"refType": "thing",
},
Expand Down Expand Up @@ -210,7 +210,7 @@ func Test_QueryProcessor(t *testing.T) {
},
map[string]interface{}{
"refId": "prop_3",
"$cref": uuid2,
"beacon": uuid2,
"locationUrl": "localhost",
"refType": "thing",
},
Expand Down Expand Up @@ -250,7 +250,7 @@ func Test_QueryProcessor(t *testing.T) {
},
map[string]interface{}{
"refId": "prop_3",
"$cref": uuid3,
"beacon": uuid3,
"locationUrl": "localhost",
"refType": "thing",
},
Expand Down Expand Up @@ -325,7 +325,7 @@ func Test_QueryProcessor(t *testing.T) {
},
map[string]interface{}{
"refId": "prop_3",
"$cref": uuid3,
"beacon": uuid3,
"locationUrl": "other-peer",
"refType": "thing",
},
Expand Down Expand Up @@ -384,7 +384,7 @@ func Test_QueryProcessor(t *testing.T) {
},
map[string]interface{}{
"refId": "prop_3",
"$cref": uuid2,
"beacon": uuid2,
"refType": "thing",
"locationUrl": "localhost",
},
Expand All @@ -404,7 +404,7 @@ func Test_QueryProcessor(t *testing.T) {
},
map[string]interface{}{
"refId": "prop_13",
"$cref": uuid3,
"beacon": uuid3,
"refType": "thing",
"locationUrl": "localhost",
},
Expand All @@ -418,7 +418,7 @@ func Test_QueryProcessor(t *testing.T) {
},
map[string]interface{}{
"refId": "prop_23",
"$cref": uuid4,
"beacon": uuid4,
"refType": "thing",
"locationUrl": "localhost",
},
Expand Down Expand Up @@ -503,7 +503,7 @@ func Test_QueryProcessor(t *testing.T) {
},
map[string]interface{}{
"refId": "prop_3",
"$cref": uuid2,
"beacon": uuid2,
"refType": "thing",
"locationUrl": "localhost",
},
Expand All @@ -523,7 +523,7 @@ func Test_QueryProcessor(t *testing.T) {
},
map[string]interface{}{
"refId": "prop_13",
"$cref": uuid3,
"beacon": uuid3,
"refType": "thing",
"locationUrl": "localhost",
},
Expand All @@ -537,7 +537,7 @@ func Test_QueryProcessor(t *testing.T) {
},
map[string]interface{}{
"refId": "prop_23",
"$cref": uuid4,
"beacon": uuid4,
"refType": "thing",
"locationUrl": "localhost",
},
Expand Down Expand Up @@ -575,7 +575,7 @@ func Test_QueryProcessor(t *testing.T) {
},
map[string]interface{}{
"refId": "prop_3",
"$cref": uuid2,
"beacon": uuid2,
"refType": "thing",
"locationUrl": "localhost",
},
Expand All @@ -595,7 +595,7 @@ func Test_QueryProcessor(t *testing.T) {
},
map[string]interface{}{
"refId": "prop_13",
"$cref": uuid3,
"beacon": uuid3,
"refType": "thing",
"locationUrl": "localhost",
},
Expand All @@ -609,7 +609,7 @@ func Test_QueryProcessor(t *testing.T) {
},
map[string]interface{}{
"refId": "prop_23",
"$cref": uuid5,
"beacon": uuid5,
"refType": "thing",
"locationUrl": "localhost",
},
Expand Down
4 changes: 2 additions & 2 deletions adapters/connectors/janusgraph/helper.go
Original file line number Diff line number Diff line change
Expand Up @@ -184,7 +184,7 @@ func (j *Janusgraph) getClass(ctx context.Context, k kind.Kind, searchUUID strfm
return fmt.Errorf("could not parse kind for ref with id '%s': %v", uuid, err)
}
crefURI := crossref.New(locationUrl, strfmt.UUID(uuid), refKind).String()
ref.NrDollarCref = strfmt.URI(crefURI)
ref.Beacon = strfmt.URI(crefURI)
switch schema.CardinalityOfProperty(property) {
case schema.CardinalityAtMostOne:
classSchema[propertyName.String()] = ref
Expand Down Expand Up @@ -332,7 +332,7 @@ func (j *Janusgraph) getClasses(ctx context.Context, k kind.Kind, className *sch
return nil, fmt.Errorf("could not parse kind for ref with id '%s': %v", uuid, err)
}
crefURI := crossref.New(locationUrl, strfmt.UUID(uuid), refKind).String()
ref["$cref"] = crefURI
ref["beacon"] = crefURI
switch schema.CardinalityOfProperty(property) {
case schema.CardinalityAtMostOne:
classSchema[propertyName.String()] = ref
Expand Down
8 changes: 4 additions & 4 deletions adapters/handlers/rest/embedded_spec.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

28 changes: 14 additions & 14 deletions docs/en/use/RESTful.md
Original file line number Diff line number Diff line change
Expand Up @@ -332,15 +332,15 @@ $ curl http://localhost:8080/v1/things/{uuid} -H "Content-Type: application/json

> Weaviate supports [RFC 6902](https://tools.ietf.org/html/rfc6902) patching ([learn](http://jsonpatch.com/)).
Example where a `$cref` is added to the `inZoo` property:
Example where a `beacon` is added to the `inZoo` property:

```bash
$ curl PATCH http://localhost:8080/v1/actions/c354ba34-432e-4e51-97ef-f33e39f39e55 -H "Content-Type: application/json" -d '[
{
"op": "add",
"path": "/schema/inZoo",
"value": {
"$cref": "weaviate://localhost/things/52eeba34-f562-4211-96b2-ea24d112b3d1"
"beacon": "weaviate://localhost/things/52eeba34-f562-4211-96b2-ea24d112b3d1"
}
}
]'
Expand All @@ -360,24 +360,24 @@ $ curl -X DELETE http://localhost:8080/v1/things/{uuid}

(<a href="https://app.swaggerhub.com/apis/bobvanluijt/weaviate/0.12.70#/things/weaviate.things.properties.create" target="_blank">Definition on Swaggerhub</a>)

Add a single reference to a class-property when cardinality is set to 'hasMany'. You can learn more about Weaviate `$cref` definitions [here](ontology-schema.md#crossref-data-type).
Add a single reference to a class-property when cardinality is set to 'hasMany'. You can learn more about Weaviate `beacon` definitions [here](ontology-schema.md#crossref-data-type).

```bash
$ curl -X POST http://localhost:8080/v1/things/{uuid}/properties/{propertyName} -H "Content-Type: application/json" -d '{
"$cref": "weaviate://localhost/things/82f91e01-37b4-431c-98d1-43ebb48bca0f"
"beacon": "weaviate://localhost/things/82f91e01-37b4-431c-98d1-43ebb48bca0f"
}'
```

### Update a single _thing_ property

(<a href="https://app.swaggerhub.com/apis/bobvanluijt/weaviate/0.12.70#/things/weaviate.things.properties.update" target="_blank">Definition on Swaggerhub</a>)

Add an array of references to a class-property when cardinality is set to 'hasMany'. You can learn more about Weaviate `$cref` definitions [here](ontology-schema.md#crossref-data-type).
Add an array of references to a class-property when cardinality is set to 'hasMany'. You can learn more about Weaviate `beacon` definitions [here](ontology-schema.md#crossref-data-type).

```bash
$ curl -X PUT http://localhost:8080/v1/things/{uuid}/properties/{propertyName} -H "Content-Type: application/json" -d '[
{
"$cref": "weaviate://localhost/things/82f91e01-37b4-431c-98d1-43ebb48bca0f"
"beacon": "weaviate://localhost/things/82f91e01-37b4-431c-98d1-43ebb48bca0f"
}
]'
```
Expand All @@ -388,7 +388,7 @@ $ curl -X PUT http://localhost:8080/v1/things/{uuid}/properties/{propertyName} -

```bash
$ curl -X DELETE http://localhost:8080/v1/things/{uuid}/properties/{propertyName} -H "Content-Type: application/json" -d '{
"$cref": "weaviate://localhost/things/82f91e01-37b4-431c-98d1-43ebb48bca0f"
"beacon": "weaviate://localhost/things/82f91e01-37b4-431c-98d1-43ebb48bca0f"
}'
```

Expand Down Expand Up @@ -460,15 +460,15 @@ $ curl http://localhost:8080/v1/actions/{uuid} -H "Content-Type: application/jso

> Weaviate supports [RFC 6902](https://tools.ietf.org/html/rfc6902) patching ([learn](http://jsonpatch.com/)).
Example where a `$cref` is added to the `inZoo` property:
Example where a `beacon` is added to the `inZoo` property:

```bash
$ curl PATCH http://localhost:8080/v1/actions/c354ba34-432e-4e51-97ef-f33e39f39e55 -H "Content-Type: application/json" -d '[
{
"op": "add",
"path": "/schema/inZoo",
"value": {
"$cref": "weaviate://localhost/actions/52eeba34-f562-4211-96b2-ea24d112b3d1"
"beacon": "weaviate://localhost/actions/52eeba34-f562-4211-96b2-ea24d112b3d1"
}
}
]'
Expand All @@ -488,24 +488,24 @@ $ curl -X DELETE http://localhost:8080/v1/actions/{uuid}

(<a href="https://app.swaggerhub.com/apis/bobvanluijt/weaviate/0.12.70#/actions/weaviate.actions.properties.create" target="_blank">Definition on Swaggerhub</a>)

Add a single reference to a class-property when cardinality is set to 'hasMany'. You can learn more about Weaviate `$cref` definitions [here](ontology-schema.md#crossref-data-type).
Add a single reference to a class-property when cardinality is set to 'hasMany'. You can learn more about Weaviate `beacon` definitions [here](ontology-schema.md#crossref-data-type).

```bash
$ curl -X POST http://localhost:8080/v1/actions/{uuid}/properties/{propertyName} -H "Content-Type: application/json" -d '{
"$cref": "weaviate://localhost/actions/82f91e01-37b4-431c-98d1-43ebb48bca0f"
"beacon": "weaviate://localhost/actions/82f91e01-37b4-431c-98d1-43ebb48bca0f"
}'
```

### Update a single _action_ property

(<a href="https://app.swaggerhub.com/apis/bobvanluijt/weaviate/0.12.70#/actions/weaviate.actions.properties.update" target="_blank">Definition on Swaggerhub</a>)

Add an array of references to a class-property when cardinality is set to 'hasMany'. You can learn more about Weaviate `$cref` definitions [here](ontology-schema.md#crossref-data-type).
Add an array of references to a class-property when cardinality is set to 'hasMany'. You can learn more about Weaviate `beacon` definitions [here](ontology-schema.md#crossref-data-type).

```bash
$ curl -X PUT http://localhost:8080/v1/actions/{uuid}/properties/{propertyName} -H "Content-Type: application/json" -d '[
{
"$cref": "weaviate://localhost/actions/82f91e01-37b4-431c-98d1-43ebb48bca0f"
"beacon": "weaviate://localhost/actions/82f91e01-37b4-431c-98d1-43ebb48bca0f"
}
]'
```
Expand All @@ -516,7 +516,7 @@ $ curl -X PUT http://localhost:8080/v1/actions/{uuid}/properties/{propertyName}

```bash
$ curl -X DELETE http://localhost:8080/v1/actions/{uuid}/properties/{propertyName} -H "Content-Type: application/json" -d '{
"$cref": "weaviate://localhost/actions/82f91e01-37b4-431c-98d1-43ebb48bca0f"
"beacon": "weaviate://localhost/actions/82f91e01-37b4-431c-98d1-43ebb48bca0f"
}'
```

Expand Down
12 changes: 6 additions & 6 deletions docs/en/use/getting-started.md
Original file line number Diff line number Diff line change
Expand Up @@ -283,7 +283,7 @@ $ curl -X POST http://localhost:8080/v1/things -H "Content-Type: application/jso
"schema": {
"name": "Artis",
"inCity": {
"$cref": "weaviate://localhost/things/6406759e-f6fb-47ba-a537-1a62728d2f55"
"beacon": "weaviate://localhost/things/6406759e-f6fb-47ba-a537-1a62728d2f55"
}
}
}'
Expand All @@ -296,7 +296,7 @@ Which results in:
"class": "Zoo",
"schema": {
"inCity": {
"$cref": "weaviate://localhost/things/6406759e-f6fb-47ba-a537-1a62728d2f55"
"beacon": "weaviate://localhost/things/6406759e-f6fb-47ba-a537-1a62728d2f55"
},
"name": "Artis"
},
Expand All @@ -315,7 +315,7 @@ $ curl -X POST http://localhost:8080/v1/things -H "Content-Type: application/jso
"schema": {
"name": "The Berlin Zoological Garden",
"inCity": {
"$cref": "weaviate://localhost/things/f15ba7e7-0635-4009-828b-7a631cd6840e"
"beacon": "weaviate://localhost/things/f15ba7e7-0635-4009-828b-7a631cd6840e"
}
}
}'
Expand All @@ -328,7 +328,7 @@ Which results in:
"class": "Zoo",
"schema": {
"inCity": {
"$cref": "weaviate://localhost/things/f15ba7e7-0635-4009-828b-7a631cd6840e"
"beacon": "weaviate://localhost/things/f15ba7e7-0635-4009-828b-7a631cd6840e"
},
"name": "The Berlin Zoological Garden"
},
Expand Down Expand Up @@ -422,15 +422,15 @@ We can now add Alphonso and Bert to the Amsterdam `Zoo`.

```bash
$ curl -X POST http://localhost:8080/v1/things/3c6ac167-d7e5-4479-a726-8341b9113e40/properties/hasAnimals -H "Content-Type: application/json" -d '{
"$cref": "weaviate://localhost/things/ac19c17b-63df-4d6f-9015-9086bb3466c4", # UUID of Alphonso
"beacon": "weaviate://localhost/things/ac19c17b-63df-4d6f-9015-9086bb3466c4", # UUID of Alphonso
"locationUrl": "localhost",
"type": "Thing"
}'
```

```bash
$ curl -X POST http://localhost:8080/v1/things/3c6ac167-d7e5-4479-a726-8341b9113e40/properties/hasAnimals -H "Content-Type: application/json" -d '{
"$cref": "weaviate://localhost/things/82f91e01-37b4-431c-98d1-43ebb48bca0f", # UUID of Bert
"beacon": "weaviate://localhost/things/82f91e01-37b4-431c-98d1-43ebb48bca0f", # UUID of Bert
"locationUrl": "localhost",
"type": "Thing"
}'
Expand Down
2 changes: 1 addition & 1 deletion docs/en/use/ontology-schema.md
Original file line number Diff line number Diff line change
Expand Up @@ -272,7 +272,7 @@ In the [RESTful API](./RESTful.md) this will be shown as:
"schema": {
"name": "SomeOtherClass",
"someProperty": {
"$cref": "weaviate://localhost/things/6406759e-f6fb-47ba-a537-1a62728d2f55"
"beacon": "weaviate://localhost/things/6406759e-f6fb-47ba-a537-1a62728d2f55"
}
}
}
Expand Down
2 changes: 1 addition & 1 deletion entities/models/property.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Loading

0 comments on commit 72c36e8

Please sign in to comment.