Graph-based Selectors

Semantic Web Interest Group,

Hello. I am pleased to share with the group a CSS-based syntax for selecting and styling both nodes and edges from graphs. While the motivating use case involves styling  adding properties and values to  the states and transitions of finite-state machines, the syntax can also be useful for selecting nodes and edges from Semantic Web graphs.

A document describing the syntax is available here: https://github.com/AdamSobieski/Foundation/blob/main/Notes/Graph-based%20Selectors.md .

For an example, here is some RDF/XML content:

<rdf:Description rdf:about="http://www.w3.org/TR/rdf-syntax-grammar"
    xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"
    xmlns:dc="http://purl.org/dc/elements/1.1/"
    xmlns:ex="http://example.org/stuff/1.0/">
  <ex:editor>
    <rdf:Description>
      <ex:homePage>
        <rdf:Description rdf:about="http://purl.org/net/dajobe/" />
      </ex:homePage>
      <ex:fullName>Dave Beckett</ex:fullName>
    </rdf:Description>
  </ex:editor>
  <dc:title>RDF 1.1 XML Syntax</dc:title>
</rdf:Description>

With the new syntax, one could select and style a node or edge:

@namespace rdf url(http://www.w3.org/1999/02/22-rdf-syntax-ns#)
@namespace ex  url(http://example.org/stuff/1.0/)

:node([rdf|about="http://www.w3.org/TR/rdf-syntax-grammar"]):edge(ex|editor):node(*):edge(ex|fullName):?node(*)
{
   color: blue;
}


Best regards,
Adam Sobieski
http://www.phoster.com

Received on Monday, 23 October 2023 09:15:38 UTC