Re: RDF mapped to PropertyGraphs

On Jan 3, 2014, at 1:55 AM, Andy Seaborne <andy@apache.org> wrote:

> Gregg looked at using RDF to encode property graphs (PG), using bnode properties for links with attributes. [1]
> 
> What about other way round - mapping RDF to PG?
> 
> In the PropertyGraphs data model there are vertexes, links (edges, relationalships) and attributes (named values for a vertex and edges).
> 
> This is similar to XML (elements and attributes) and OWL (object properties and data type properties).
> 
> 2 features of RDF make the mapping from RDF into PG easy:
> 
> 1/ Literals only appear in the object position.
> 2/ Properties don't have qualifiers.
> 
> Blank Nodes can be treated some kind of label to be distinguished from URIs.  We write use the pseudo URI scheme "_:" here.
> 
> Mapping RDF onto PropertyGraphs --
> 
> A/ Each subject or object URI or bNode becomes a vertex with a URI or bNode as label.
> 
> B/ Each property value of subject V, if it has a literal object, it becomes an attribute of V, named by the URI of the property.

From my understanding, a PG attribute is single-valued (e.g., [attr=value], whereas RDF properties can be multi-valued (:s :attr :value1, :value2). How might we handle this? Modeling literal values as a vertex might solve this, but it might require using something like [rdf:value "the literal value"; :datatype <datatype>; :language "en" ].

> C/ Each property value of subject V that is a URI or blank node, becomes an edge in the property graph, with label the URI of the property.
> 
> Attributes on edges are not used.
> 
> In the language of the RDF-2004 working group, literals are not tidy [2] in property graphs.
> 
> In RDF-speak:
> 
> :a :p 123 .
> :b :q 123 .
> 
> and pattern
> { ?x :p ?v .
>  ?y :q ?v . }
> 
> works because 123 has in-edges of :p and :q.  It is a tidy literal meaning there is on node in the graph for 123, not two.
> 
> This does not happen in PropertyGraphs; access to attributes is different to accessing vertexes (e.g. the ".has" operation in gremlin).
> 
> This mapping also suggests how to turn a property graph without attributes on edges into an RDF graph.  Edges with attributes can be encoded as n-ary relationships [3].

I like the idea of N-ary relationships for such modeling; they are similar to my JSON-LD proposal, but avoid the use of BNode predicates.

Gregg

> An alternative mapping is to not use attributes at all.  Each subject or object becomes a vertex, and every triple becomes and edge.  But now the labelling of the vertexes needs to include datatype/URI information.
> 
> This is much more an encoding of RDF onto PG, rather than a mapping.
> 
> In an encoding, the information is there and can be extracted but working directly on the encoding with the PG tools can be unnatural. In a mapping, you could query and navigate the PG graph using PG tools e.g. look up all vertexes with an attribute of 123.
> 
> 	Andy
> 
> [1] http://lists.w3.org/Archives/Public/semantic-web/2013Aug/0026.html
> [2] http://www.w3.org/TR/2002/WD-rdf-concepts-20020829/
> [3] http://www.w3.org/TR/swbp-n-aryRelations/
> 

Received on Friday, 3 January 2014 18:25:47 UTC