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

Named Graph and SPARUL #103

Closed
johnss opened this issue Jan 22, 2018 · 11 comments
Closed

Named Graph and SPARUL #103

johnss opened this issue Jan 22, 2018 · 11 comments

Comments

@johnss
Copy link

johnss commented Jan 22, 2018

Does this this library support Named graph SPARQL 1.1 Update
?

https://en.m.wikipedia.org/wiki/SPARUL

@johnss
Copy link
Author

johnss commented Jan 22, 2018

#102 doesn't mention anything about named graph
https://en.m.wikipedia.org/wiki/Named_graph

@bnowack
Copy link
Collaborator

bnowack commented Jan 22, 2018

Does https://github.com/semsol/arc2/wiki/SPARQL- help?

ARC2 does not distinguish graphs from named graphs, and the syntax may be out of date, but it is possible to add triples to URI-identified graphs.

@k00ni
Copy link
Collaborator

k00ni commented Jan 22, 2018

Hi, ARC2 uses a SPARQL syntax which is similar to SPARUL. More information about that in the wiki.

I am the maintainer of Saft, which integrates ARC2. It transforms SPARUL queries such as:

DELETE WHERE {
    Graph <http://localhost/Saft/TestGraph/> {
        ?s ?p ?o .
    }
}

to queries which ARC2 understands, like:

DELETE FROM <http://localhost/Saft/TestGraph/> {
    ?s ?p ?o .
}
WHERE {
    ?s ?p ?o .
}

Maybe it helps.

@k00ni
Copy link
Collaborator

k00ni commented Jan 22, 2018

Btw. #102 was not about adding new functionality, but to provide a set of tests, checking that a feature is there or missing.

@johnss
Copy link
Author

johnss commented Jan 22, 2018

@bnowack I know it can extend triple but I'm not sure it will become 4 statement or 5 statement
@k00ni will it become 4 statement or 5 statement

I want the graph to be (subject-predicate-object)-context

I don't want to become
subject-predicate-(subject–predicate–object)

@k00ni
Copy link
Collaborator

k00ni commented Jan 22, 2018

Can you paste some example code? I can't follow you, i am afraid.

@johnss
Copy link
Author

johnss commented Jan 23, 2018

My project is i want to create site like wikidata, I don't have a code example as I will probably use php method directly and not using SPARQL.

My question is how your plug in distinguish between named graph or triples added to URI-
identified graphs?

Triples added to URI-
identified graphs will become 5 node, while true named graph are 4 node, I assume no as Its just a query translator, there's no way to differentiate between named graph or triple added to graph URI

@k00ni
Copy link
Collaborator

k00ni commented Jan 23, 2018

identified graphs will become 5 node, while true named graph are 4 node, I assume no as Its just a query translator, there's no way to differentiate between named graph or triple added to graph URI

What do you mean by "become 5 node"? ARC2 only knows graphs (with their URI), regardless if named or not in the first place. They are not added as triples, if that is what you meant.

If you are not using SPARQL, how would like to "query" the data? Maybe you want something like this or that?

@johnss
Copy link
Author

johnss commented Jan 25, 2018

I already know that arc2 store it several different table, the values of triple stored it in id2val,s2val,o2val, a triples table that link that 3 table together, I don't know what exactly G2T table is used for but I think its used for nesting triple.

Example for 5 node is

Book1 (subject) -> title (predicate) -> example book title (object)
And triple that link to book1 as object
BookStore (subject) -> Have (predicate) -> [Book1 (subject) -> title (predicate) -> example book title (object)]

A true named graph doesn't need the predicate relation and will look like this
BookStore (context) -> [Book1 (subject) -> title (predicate) -> example book title (object)]

The ResourceGuy & Helper and the unit test look the same to me, can you explain the differences?

@k00ni k00ni added the question label May 7, 2018
@k00ni
Copy link
Collaborator

k00ni commented May 7, 2018

@johnss: ResourceGuy basically represents a sub graph, starting by a certain resource. You can access nodes and edges via array-access, like:

$guy = new ResourceGuy();
$anotherGuy = new ResourceGuy();

// storing
$guy['foaf:name'] = $nodeFactory->createLiteral('Mister X');
$guy['foaf:knows'] = $anotherGuy; // ResourceGuy

// getting
$guy['foaf:name'] = $nodeFactory->createLiteral('Mister X');
echo $guy['foaf:name'];

// set and get URI of the ResourceGuy instance
$guy['_idUri'] = $nodeFactory->createNamedNode('http://uri/');
echo $guy['_idUri']->getUri(); // will output a string

ResourceGuyHelper makes it easier to get/create these subgraphs. For instance get all resources of a certain RDF type.

@k00ni
Copy link
Collaborator

k00ni commented May 7, 2018

Can this issue be closed?

@johnss johnss closed this as completed Dec 4, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants