R3000
(R3000)
July 3, 2020, 4:59pm
1
I am looking at this blog post Property Graphs meet Stardog | Stardog
and would like to write these triples to a database:
:Alice :worksFor {:role :CEO ;
:since 2010 ;
:probability 0.8 ;
:source <http://example.com/news>} :ACME ;
:birthDate {:probability 0.2} "1972-01-01"^^xsd:date ;
:nationality {:source <http://example.org/Alice>} :USA .
However I am getting this error when executing:
QE0PE2: com.complexible.stardog.plan.eval.ExecutionException: Encountered " <PNAME_LN> ":Alice "" at line 1, column 1.
Was expecting one of:
<EOF>
";" ...
<HINT> ...
any idea?
R3000
(R3000)
July 3, 2020, 5:15pm
2
Never mind - I have created a new database with `edge.properties=true - and adding the above ttl worked.
Two more questions:
When I go to visualize Alice node I see worksFor edge but no edge properties can be displayed. Do you plan to add this?
When I "Run to File" the visualization and export it to JSON-LD I don't get any edge properties.
Do you plan to make edge properties exportable and importable to and from JSON-LD?
Here is the exported JSON-LD - and no edge properties:
[ {
"@id" : "http://api.stardog.com/Alice",
"http://api.stardog.com/birthDate" : [ {
"@type" : "http://www.w3.org/2001/XMLSchema#date",
"@value" : "1972-01-01"
} ],
"http://api.stardog.com/nationality" : [ {
"@id" : "http://api.stardog.com/USA"
} ],
"http://api.stardog.com/worksFor" : [ {
"@id" : "http://api.stardog.com/ACME"
} ]
} ]
pavel
(Pavel Klinov)
July 3, 2020, 5:40pm
3
Hi Radu,
Our JSON-LD parsers and serialisers already support edge properties. That's easy to verify by running something like
construct { << :Alice ?p ?o >> ?ep ?epv } {
<< :Alice ?p ?o >> ?ep ?epv
}
you'll see the returned edge properties (eg. in Studio, which uses JSON-LD exclusively at this time). And you'll even see the edge properties in the viz, if you visualise that. You'd need to additionally toggle "Literals as nodes" in the Options menu in the bottom right corner.
What you observe isn't a JSON-LD, viz, or even Studio limitation, it's simply that DESCRIBE
queries (used explicitly or implicitly) don't yet return edge properties. And yes, there's a ticket to resolve that (also, Stardog allows users add custom DESCRIBE strategies: stardog-examples/examples/describe at develop · stardog-union/stardog-examples · GitHub ).
Best,
Pavel
R3000
(R3000)
July 3, 2020, 7:42pm
4
Pavel - thank you for your response.
I can see edge properties visualization in Studio.
And I was able to export the following JSON-LD:
[ {
"@id" : {
"@id" : "http://api.stardog.com/Alice",
"http://api.stardog.com/birthDate" : {
"@value" : "1972-01-01",
"@type" : "http://www.w3.org/2001/XMLSchema#date"
}
},
"http://api.stardog.com/probability" : [ {
"@type" : "http://www.w3.org/2001/XMLSchema#decimal",
"@value" : "0.2"
} ]
}, {
"@id" : {
"@id" : "http://api.stardog.com/Alice",
"http://api.stardog.com/nationality" : {
"@id" : "http://api.stardog.com/USA"
}
},
"http://api.stardog.com/source" : [ {
"@id" : "http://example.org/Alice"
} ]
}, {
"@id" : {
"@id" : "http://api.stardog.com/Alice",
"http://api.stardog.com/worksFor" : {
"@id" : "http://api.stardog.com/ACME"
}
},
"http://api.stardog.com/probability" : [ {
"@type" : "http://www.w3.org/2001/XMLSchema#decimal",
"@value" : "0.8"
} ],
"http://api.stardog.com/role" : [ {
"@id" : "http://api.stardog.com/CEO"
} ],
"http://api.stardog.com/since" : [ {
"@type" : "http://www.w3.org/2001/XMLSchema#integer",
"@value" : "2010"
} ],
"http://api.stardog.com/source" : [ {
"@id" : "http://example.com/news"
} ]
} ]
However when I try to import the json LD via HTTP POST api call I get the following error:
400 {"message":"Could not parse JSONLD: invalid @id value: value of @id must be a string","code":"QEIVR2"} b'{"message":"Could not parse JSONLD: invalid @id value: value of @id must be a string","code":"QEIVR2"}'
400
R3000
(R3000)
July 7, 2020, 4:06pm
5
@pavel thanks for trying to help over this long weekend.
What I really need is an example of JSON-LD that can imported demonstrating how to add edge properties.
Can you please provide such an example?
Thanks,
Radu
pavel
(Pavel Klinov)
July 8, 2020, 12:04pm
6
Radu,
My apologies for the delay on this. Indeed I confirm that the JSON-LD parser has issues with edge properties at the moment. I created an issue # 9301 for this and we intend to look into it ASAP.
Thanks for bringing this up,
Pavel
R3000
(R3000)
July 8, 2020, 12:26pm
7
Thank you @pavel - looking forward to the fix
system
(system)
Closed
July 22, 2020, 12:26pm
8
This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.