Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

adding the same triple into two graphs does not work #114

Open
k00ni opened this issue Jun 14, 2018 · 5 comments
Open

adding the same triple into two graphs does not work #114

k00ni opened this issue Jun 14, 2018 · 5 comments
Labels
bug question store Related to the RDF store.

Comments

@k00ni
Copy link
Collaborator

k00ni commented Jun 14, 2018

The following test code shows, that ARC2 does not seem to allow the same triple in different graphs. Is that right @semsol?

$store = \ARC2::getStore([...]);

$store->query(
    'INSERT INTO <http://graph1/> {<http://foo/1> <http://foo/2> <http://foo/3> . }'
);

$store->query(
    'INSERT INTO <http://graph2/> {<http://foo/1> <http://foo/2> <http://foo/3> . }'
);
$store->query(
    'INSERT INTO <http://graph2/> {<http://foo/4> <http://foo/5> <http://foo/6> . }'
);

// thats OK, 1 row
$res = $this->fixture->query('SELECT * FROM <http://graph1/> WHERE {?s ?p ?o.}');
echo count($res['result']['rows']);

// thats OK, 3 rows
$res = $this->fixture->query('SELECT * WHERE {?s ?p ?o.}');
echo count($res['result']['rows']);

// FAILED, got 1 row, expected 2
$res = $this->fixture->query('SELECT * FROM <http://graph2/> WHERE {?s ?p ?o.}');
echo count($res['result']['rows']);
@k00ni k00ni added bug store Related to the RDF store. labels Jun 14, 2018
@k00ni k00ni added the question label Jul 15, 2018
@cbinding
Copy link
Contributor

cbinding commented Jan 3, 2019

Hello, a modification of your second test (and your row count of 3) demonstrates the insertions are successful; ARC2 allows the same triple in different graphs:

$res = $store->query('SELECT * WHERE { GRAPH ?g {?s ?p ?o }}');  
print_r($res['result']['rows']);
// 3 rows are returned, also showing the graph associated with each triple 

However the query in the last test is indeed only returning the first of the two triples actually present in graph2.

Unfortunately I don't yet have a solution(!) but I am interested if you have any further information on this, as I have what I believe are similar issues for multiple 'LOAD' statements - the data is loaded to the triple store but only the data from the first 'LOAD' is actually visible in subsequent queries.

@cbinding
Copy link
Contributor

cbinding commented Jan 4, 2019

After further testing I now have a solution for this issue, which also resolves the problems experienced with multiple 'LOAD' statements. In file ARC2_StoreLoadQueryHandler.php try changing line 228:

# old: 
if (false !== empty($binaryValue)) {
# new:
if (false == empty($binaryValue)) {

The code here is locating the ID for a previously inserted value, but I believe the condition logic here is incorrect - the ID is never found, so a value may get inserted multiple times with different IDs. This leads to the inconsistencies observed, where inserted/loaded data is present in the triple store but not retrieved.

@k00ni
Copy link
Collaborator Author

k00ni commented Jan 9, 2019

Unfortunately I don't yet have a solution(!) but I am interested if you have any further information on this [...]

Unfortunately no.

After further testing I now have a solution for this issue, which also resolves the problems experienced with multiple 'LOAD' statements.

Would you be OK with creating a test or two to reproduce the problem? And submit it as pull request, so that we can discuss the merge? That would be great.

@cbinding
Copy link
Contributor

cbinding commented Jan 9, 2019

OK yes I will do, have set up a separate issue #122 (related to LOAD statements) but it should fix this issue also

@k00ni
Copy link
Collaborator Author

k00ni commented Jan 9, 2019

OK yes I will do

Nice to hear, looking for forward to it!

k00ni added a commit that referenced this issue Jan 25, 2019
k00ni added a commit that referenced this issue Feb 20, 2020
The change was intended to potentially solve #122 and #114

But it caused some tests to fail, which were working before.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug question store Related to the RDF store.
Projects
None yet
Development

No branches or pull requests

2 participants