Re: RDF mapped to PropertyGraphs

On 03/01/14 18:25, Gregg Kellogg wrote:
> 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" ].

Vertexes being literal-labeled is a possibility.  I think it makes the 
PG "unnatural" - I trying to send up with something that worked as a PG.

In PG (well, the simple java implementation), it seems the value can be 
anything, including a set, bag or list.  Storing a JSON doc as a value 
puts structure in, not 1st class but not 2nd class either.

As the "authors of a paper" prototypical example shows, datastructures 
matter.

The role of index to find vertexes by property-values is fairly 
explicit.  Maybe structures won't work out; maybe they will.  The data 
model isn't a simple, automatic choice.

IMO RDF should have had 1st class data structures - all this RDF list 
(seq,alt,bag) encoded in triples does not play out in practical terms. 
Users work in lists and they should not have to worry about encoding in 
triples/edges. Eventually, the triples show through and it's messy for 
the user.  The nice theoretic model isn't nice in practice.  I also 
recognize that list or set values themselves have serious implications 
at scale and if persistent storage is involved (or should we assume NVRAM?).

	Andy

>
>> 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 21:11:04 UTC