How to add properties to nodes and edges?

0 views
Skip to first unread message

novas...@gmail.com

unread,
Oct 28, 2016, 2:04:22 PM10/28/16
to Stardog
Hello everyone,

I have some experience with RDF and with the property graph Neo4j. I understand that Stardog supports properties on both edges and nodes and this feature is one of the reasons I am investigating Stardog.

It is unclear from my reading the manual (Stardog 4.2) how to add property:value pairs to RDF nodes and edges. Is there a tutorial available? 

For example, let's say I have the following loaded into Stardog as RDF:

Tim --- WORKS_AT ---> BurgerKing

I want to add a hire date to the WORKS_AT edge and a street address to the Burger King company node.  How do I approach this very basic task?

Please let me know if this is not the appropriate forum for this type of question (I'm new here!).

Cheers,

Tim  

Pavel Klinov

unread,
Oct 28, 2016, 2:51:52 PM10/28/16
to sta...@clarkparsia.com
Hi Tim,

You can add properties to nodes simply by adding RDF triples. In your example :BurgerKing :address "some address" would just be a triple in the RDF data model which you can add to your database using CLI [1], Java API [2], or HTTP API [3]. 

To add properties to edges, you have to use the TinkerPop API with Stardog [4] because that isn't natively supported in RDF. In addition to using the API from your Java code, you can experiment using the Gremlin Console [5].

Cheers,
Pavel


--
-- --
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+unsubscribe@clarkparsia.com
For more options, visit this group at
http://groups.google.com/a/clarkparsia.com/group/stardog?hl=en

Evren Sirin

unread,
Oct 28, 2016, 5:30:49 PM10/28/16
to Stardog
If your goal is not using the TinkerPop API and/or gremlin then an
alternative is to use named graphs in RDF as triple identifiers and
then attach properties to those identifiers.

Tim WORKS_AT BurgerKing Stmt1.
Stmt1 startDate "..." .

Then you can use the GRAPH keyword in SPARQL to query these "edge properties".

SELECT * {
GRAPH ?id { Tim WORKS_AT BurgerKing }
?id startDate ?date
}

Best,
Evren
>> stardog+u...@clarkparsia.com
>> For more options, visit this group at
>> http://groups.google.com/a/clarkparsia.com/group/stardog?hl=en
>
>
> --
> -- --
> 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

novas...@gmail.com

unread,
Oct 31, 2016, 8:58:25 AM10/31/16
to Stardog
Thanks to both Pavel and Evren for these details. I am not yet familar with TinkerPop. In RDF's current specification it appears that I cannot avoid expanding the graph when I want to describe properties of the edges, by having the edge become the subject of an additional triple for things like time-stamping an edge.  I will investigate further.

Thanks again,


Tim 
Reply all
Reply to author
Forward
0 new messages