How do i assign value to geo type field

I am trying like below mutation doesnt work:

_:address <location> "{
            "type": "Point",
            "coordinates": [
              -122.4705776,
              37.7701084
            ]
          }" .

Hi @dgandhi17
This example is using the JSON mutation format and not the RDF format. This link has details on how to construct JSON mutation and fire through Ratel.
The mutation has the following structure:

{
  "set": [
    {
      # One JSON obj in here
    },
    {
      # Another JSON obj in here for multiple operations
    }
  ]
}

Can you suggest RDF format? As i am using client and do want do use json

you can find examples of rdf mutations for geo here.

From the example if i define geo predicate like below
loc: geo @index(geo) .

do i still need to set ^^geo:geojson . during mutation below ? why its already known

 <_:0xeb1dde9c> <loc> "{'type':'Point','coordinates':[-122.4220186,37.772318]}"^^<geo:geojson> .

I cant think of a logical reason why the “^^” tag is required after the type is set in the schema. It does seem to work without the tag.

That’s a WC3 Standard. All RDF lines should explicitly be set with their type. This helps the parser to identify a badly formed RDF. Also, if the DB is new and there’s no Schema on it, the parser would infer that information and create the schema.

It is not mandatory, but it is a recommended practice.

1 Like