Re: [stardog-users] How to get an entire graph from a root name in java.

0 views
Skip to first unread message

Evren Sirin

unread,
Apr 18, 2013, 9:14:49 AM4/18/13
to Stardog
You can use property paths as in this query (with appropriate prefix declarations):

SELECT * { :A :knows+ ?x }

You can run this query parameterized by making the first argument a variable and binding it to a value right before execution. The CLI command for this looks like this:

./stardog query -c snarl://localhost/myDB -b "x=:A" -q "SELECT * { ?x :knows+ ?y}"

If you save the query into a file, the parameterized version is easier to execute with different args. The API also allows you to bind variables in a query like this. See the docs [2] for details.

Best,
Evren




On Thu, Apr 18, 2013 at 7:52 AM, vishnudev k <vishnu...@gmail.com> wrote:
I have a full list of hierarchy in stardog DB  for example 

                   A knows B
                  
A knows D
                  
B knows C
                   C knows E
                   P knows Q

How can I query the database to get entire structure as graph in java.

For example I will pass A as a parameter

Since A knows B and D they should come

Since B knows C it should come

Since D knows E it should come

Since P or Q have any relation with A they should not come.

--
-- --
You received this message because you are subscribed to the C&P "Stardog" group.
To post to this group, send email to sta...@clarkparsia.com
To unsubscribe from this group, send email to
stardog+u...@clarkparsia.com
For more options, visit this group at
http://groups.google.com/a/clarkparsia.com/group/stardog?hl=en
 
 

vishnudev k

unread,
Apr 19, 2013, 7:37:37 AM4/19/13
to

My Ultimate requirement is  I want to delete entire graph
Recursive execution of parametrized query is the only solution to get the handle of whole graph?

The predicate also not a constant
It should Identify the tuples given below.


            A haveNumber 123
            123 haveCode +01


If I delete A it should delete everything that's related to A.. There should not be any orphan tuples.

Mike Grove

unread,
Apr 19, 2013, 10:23:50 AM4/19/13
to stardog
On Fri, Apr 19, 2013 at 7:33 AM, vishnudev k <vishnu...@gmail.com> wrote:

My Ultimate requirement is  I want to delete entire graph

If you want to delete an entire context, you can use the Remover [1] to delete a specific context.  Otherwise, you're going to have to do something to create the graph that you'd like to delete (again, you can use remover for this).

You can do that by building the graph by hand, or creating it from the results of queries.  But there is no magical "delete everything about 'foo'" function in Stardog; what people might think 'delete everything' means probably differs from person to person and from application to application.  And that makes it hard to provide something that will work for everyone.

Cheers,

Mike 

 
Recursive execution of parametrized query is the only solution to get the handle of whole graph?

The predicate also not a constant
It should Identify the tuples given below.


            A haveNumber 123
            123 haveCode +01


If I delete A it should delete everything thats related to A




On Thursday, 18 April 2013 18:44:49 UTC+5:30, Evren Sirin wrote:

vishnudev k

unread,
Apr 22, 2013, 3:00:23 AM4/22/13
to sta...@clarkparsia.com
thank you for the idea of remover.

btw how to create an object of remover? Cant find it any sample codes any where.

Mike Grove

unread,
Apr 22, 2013, 7:09:26 AM4/22/13
to stardog
On Mon, Apr 22, 2013 at 3:00 AM, vishnudev k <vishnu...@gmail.com> wrote:
thank you for the idea of remover.

btw how to create an object of remover? Cant find it any sample codes any where.

There are examples of it in our documentation and in the example code *in* the distribution.

Cheers,

Mike
Reply all
Reply to author
Forward
0 new messages