Franz Position Statement: support for RDF triple properties in SPARQL ===================================================================== Willem Broekema, Franz Inc. (Software Engineer) Jans Aasman, Franz Inc. (CEO) Background ---------- Franz Inc. is a semantic database and knowledge graph company that has been around since 1984. Our flagship product is AllegroGraph, a graph database and triple store in use by many Fortune 500 companies. It adheres to W3C specifications regarding e.g. RDF, SPARQL, SHACL and JSON-LD. Franz always experiments with new advanced features based on customer requirements. AllegroGraph has a rule engine in the form of an embedded Prolog engine, and there is an extension to support attributes on RDF triples. Below we will discuss the latter. Summary ------- Triples consists of a subject, predicate and object, and a fourth component called 'graph' or 'context'. Our customers often use the graph component to add properties to a triple. The downside of this approach is that it takes away the possibility to use the graph component for other purposes, in particular grouping triples together, and it causes more join operations while executing queries and doing triple retrieval. Franz therefore decided to introduce the concept of properties on RDF triples [1]. A triple can have any number of user defined properties. We also implemented SPARQL extensions to use these properties in queries. We are looking for input on how to standardise this in SPARQL. Position -------- In this position statement we present an extended N-Quad format that includes triple properties, and a SPARQL extension for supporting triple properties, as currently implemented in AllegroGraph. It would be beneficial to discuss this extension among vendor in order to reach a standard interface. * Triple Attributes Triple attributes are defined as name/value pairs, both strings. One potential use case is access control where triples have an associated access level. The attribute could be named "security-level" with possible values "high", "medium" and "low". The triple's access level will then be compared to that of the user to see if access is permitted. * Extended N-Quad format The Extended N-Quad format (NQX, for short) extends the N-Quads format (see [2]) to allow the specification of attributes for each triple in the file. Each line of an NQX file has the following format: [An N-Quad line without the ending .] [attributes] . The attributes can be absent. If present, it must be in JSON format: { "key1": "val1", "key2": [ "val2a", "val2b" ] } Here we specify three attribute name/value pairs: "key1" = "val1" "key2" = "val2a" "key2" = "val2b" Example lines are: {"key1": "val1"} . {"key1": "val1", "key2": ["val2a", "val2b"]} . {"key1": "val1"} . For example: _:b0EF918FCx100 "Joe Smith" {"securityLevel": "low", "department": ["sales", "accounting", "hr", "devel"], "accessToken": "A"} . * SPARQL property access AllegroGraph makes extensions available to SPARQL in the form of "magic properties" [3] which are predicates that produce bindings using something other than simple subgraph matching. For example searching for matches in a free-text index is done with a pattern like: ?subject fti:match 'baseball' where AllegroGraph provides the implementation of fti:match predicate. In the same way the triple attributes for a given triple pattern are retrieved with: ?attributes (?s ?p ?o) which binds ?attributes to the JSON string (see [4]); or using: (?name ?value) (?s ?p ?o) This magic property binds ?name and ?value to each of the key/value pairs of the attributes associated with each (?s ?p ?o) triple (see [5]). References ---------- [1] https://franz.com/agraph/support/documentation/current/triple-attributes.html [2] http://www.w3.org/TR/n-quads/ [3] https://franz.com/agraph/support/documentation/current/magic-properties.html [4] https://franz.com/ns/allegrograph/6.2.0/attributes/index.html [5] https://franz.com/ns/allegrograph/6.2.0/attributesNameValue/index.html