datacequia / go-dogg3rz

Decentralized Knowledge Orchestration Tool
Apache License 2.0
8 stars 1 forks source link

insert node into named-graph fails on existing graph name #23

Closed adpadilla closed 3 years ago

adpadilla commented 3 years ago

I successfully used dogg3rz create named graph --dataset ds1 mygraph .

From here I attempted to insert a node into "mygraph" however I get the following error.

Andrews-MacBook-Pro:go-dogg3rz andrew$ dogg3rz insert node into named-graph mygraph dataset ds1  property-values -p prop1 -v val1
NotFound: Graph node found in Graph: mygraph  

Also the error indicates the graph is found (Graph node found) yet returns a NotFound error. I checked the json-ld doc for this dataset and it looks like the following:

{
   "@context" : {
      "adp" : "http://www.adp.com/"
   },
   "@graph" : [
      {
         "@type" : "rdfs:Class",
         "@id" : "class1"
      },
      {
         "@id" : "_:67f75094-aa9c-4782-adbf-92af6cef97e7",
         "prop2" : "value2",
         "prop1" : "value1"
      },
      {
         "@id" : "mygraph",
         "@graph" : []
      }
   ],
   "__dgrz_mtimes__" : {
      "f94256b03d73a0daec9154870c341fbaa7a6fb23d78ed53db8e78464db2997e2" : 1615169446136109000,
      "9dcf97a184f32623d11a73124ceb99a5709b083721e878a16d78f596718ba7b2" : 1615168824200321000,
      "ae1522dd824ace9b4c1ebbf691e5f34a7d140b950826e1b5962dfe576831b22b" : 1615168851976866000,
      "25dfd29c09617dcc9852281c030e5b3037a338a4712a42a21c907f259c6412a0" : 1615169626216442000
   }
}
adpadilla commented 3 years ago
Andrews-MacBook-Pro:go-dogg3rz andrew$ dogg3rz insert node into
Please specify one command of: default-graph or named-graph
Andrews-MacBook-Pro:go-dogg3rz andrew$ dogg3rz insert node into named-graph
the required argument `GRAPH_NAME` was not provided
Andrews-MacBook-Pro:go-dogg3rz andrew$ dogg3rz insert node into named-graph ng1 
Please specify the dataset command
Andrews-MacBook-Pro:go-dogg3rz andrew$ dogg3rz insert node into named-graph ng1 dataset ds1
Please specify the property-values command
Andrews-MacBook-Pro:go-dogg3rz andrew$ dogg3rz insert node into named-graph ng1 dataset ds1 --property-values -p attr1 -v val1
unknown flag `property-values'
Andrews-MacBook-Pro:go-dogg3rz andrew$ dogg3rz insert node into named-graph ng1 dataset ds1 property-values -p attr1 -v val1
NotFound: Parent Graph node found in Graph: ng1
Andrews-MacBook-Pro:go-dogg3rz andrew$ echo $?
0
Andrews-MacBook-Pro:go-dogg3rz andrew$ cat ~/.dogg3rz/data/repositories/test1/ds1/.document.jsonld |json_pp
{
   "@graph" : [
      {
         "attr" : "value2",
         "attr1" : "value1",
         "@id" : "_:7b4eed18-c715-45f3-8be9-8bce74202332"
      },
      {
         "@type" : "rdfs:Class",
         "@id" : "mytype1"
      },
      {
         "@graph" : [],
         "@id" : "ng1"
      }
   ],
   "__dgrz_mtimes__" : {
      "c73a232121e32688a394d2c8afbc98aadddaf9e0ee07cf58e7453fed720ef303" : 1616983398332464000,
      "9dcf97a184f32623d11a73124ceb99a5709b083721e878a16d78f596718ba7b2" : 1615747586999132000,
      "25dfd29c09617dcc9852281c030e5b3037a338a4712a42a21c907f259c6412a0" : 1615747586999132000
   },
   "@context" : {}
}
adpadilla commented 3 years ago

I tried this again with existing dataset 'ds1' and named graph 'mygraph' with following command. No error but I see it created a __dgrz_mtimes__ property under the named graph 'mygraph'. There should only be one such property which is an outermost property of the json-ld document.

Andrews-MacBook-Pro:go-dogg3rz andrew$ dogg3rz insert node into named-graph mygraph dataset ds1 property-values  -p prop1 -v val1
Andrews-MacBook-Pro:go-dogg3rz andrew$ cat ~/.dogg3rz/data/repositories/myrepo1/ds1/.document.jsonld |jq
{
  "@context": {},
  "@graph": [
    {
      "@graph": [
        {
          "@graph": [],
          "@id": "mygraph2"
        },
        {
          "@id": "_:078e728d-a2a6-462f-946f-fd90ddaba989"
        }
      ],
      "@id": "mygraph",
      "__dgrz_mtimes__": {
        "289789c476c8c8a9ed7afd79723701e53b3fded217de34e6ee51811fcd386c41": 1626833959294767000,
        "8228afd058c15240506b1355762e0a452083c28250ac9e2445fef7bc9476ca11": 1626834597459831000
      }
    },
    {
      "@id": "myclass1",
      "@type": "rdfs:Class",
      "rdfs:comment": "my comment",
      "rdfs:label": "my label"
    }
  ],
  "__dgrz_mtimes__": {
    "1c4fc44e6fdc1c20b0ba808c73696ee4bf270911309b3e4f94d784ac030af92e": 1626834098490001000,
    "25dfd29c09617dcc9852281c030e5b3037a338a4712a42a21c907f259c6412a0": 1626833845891452000,
    "9dcf97a184f32623d11a73124ceb99a5709b083721e878a16d78f596718ba7b2": 1626833845891452000,
    "9e25d6f9a056fe59ab9abb4265350e8f9b903cac597bd960955bb2395b07bab9": 1626833913133898000
  }
}
bhallamp commented 3 years ago

Ok, got it. I will fix it.

adpadilla commented 3 years ago

checked. loooks fixed. thanks!