Querying this graph results in graph #1. Can we plot Graph #2? I don't think getting Graph #2 is a possibility but if anyone knows, do help.
Mark :Friends_Name "John"
Mark :Stays_In "USA"
John :Stays_In "USA
The graph-notebook rendering engine will create connections between items that have the same literal value displayed as their label in the visualization. It essentially treats the values as if you had created the graph using either of:
PREFIX : <http://www.example.com/>
INSERT DATA
{
:mark :name "Mark" .
:john :name "John" .
:usa :country "USA" .
:mark :Stays_In :usa .
:john :Stays_In :usa
}
or
PREFIX : <http://www.example.com/>
INSERT DATA
{
:mark :name "Mark" .
:john :name "John" .
:mark :Stays_In "USA" .
:john :Stays_In "USA"
}
To work around this, at least for now, you would need to use different labels for USA. In terms of data modelling however, I would think that you usually would want the Graph 1 visualization to show that the values are common but I can also see wanting a visualization where each subject is linked with just its own objects where the objects are literals. Feel free to create an issue (feature request) against the graph-notebook project.
This is rather ugly but you could create the graph this way if the visualization is essential.
%%sparql
PREFIX : <http://www.example.com/>
INSERT DATA
{
:mark :name "Mark" .
:john :name "John" .
:mark :friend :john .
:mark :Stays_In "USA(1)" .
:john :Stays_In "USA(2)"
}
Or even more hacky, add a space to one of the USAs (I'm not encouraging this but if making a visual is the key goal this will work). There is a space in the second USA.
%%sparql
PREFIX : <http://www.example.com/>
INSERT DATA
{
:mark :name "Mark" .
:john :name "John" .
:mark :friend :john .
:mark :Stays_In "USA" .
:john :Stays_In "USA "
}