1

I'm using GraphDB 9.4 free edition with the Workbench web interface on Ubuntu 18.04.

I have a construct sparql query that shows all the correct triples, including literals, in the output below the query box. When I click on the "Visual" button to display the graph, the literals and associated data properties are not shown. Is there a setting to display them?

Thanks!

2 Answers 2

0

As far as I know, that functionality doesn't exist.

If you click on the node though, the data properties show up on the right side of the screen. But I totally agree, a function to display them directly would be nice.

Sign up to request clarification or add additional context in comments.

Comments

0

I put following code (based on this answer) for "Graph Expansion".

Updated. Now round brackets and spaces are replaced by hyphens when constructing a URI for the Literal Nodes as these are not allowed. If you have other illegal characters in your literals you would have to add those to the REPLACE statements too!

# Note that ?node is the node you clicked and must be used in the query
PREFIX rank: <http://www.ontotext.com/owlim/RDFRank#>
PREFIX ent: <http://www.ontotext.com/owlim/entity#>

CONSTRUCT
{
    # The triples that will be added to the visual graph
    ?newNodeLX  ?edge  ?newNodeRX .
}
WHERE
{
  {
    {
        # Left to right relations (starting IRI is the subject)
        ?node ?edge ?newNodeR .
        # ?node is always an IRI, ?newNodeR must be checked for IRI or Blank
            FILTER(isIRI(?newNodeR) || isBlank(?newNodeR) || isLiteral(?newNodeR))
        BIND(IF(isBlank(?newNodeR), URI(CONCAT("BNode:", STR(ent:id(?newNodeR)))), 
                    IF(isLiteral(?newNodeR),URI(CONCAT("L:", REPLACE(STR(?newNodeR), "[ \\(\\)]", "-"))),
                    ?newNodeR))
                AS ?newNodeRX)
        BIND(?node AS ?newNodeLX)
    }
    UNION
    {
        # Right to left relations (starting IRI is the object)
        ?newNodeL ?edge ?node .
        # ?node is always an IRI, ?newNodeL is always an IRI or Blank
        BIND(IF(isBlank(?newNodeL), URI(CONCAT("BNode:", STR(ent:id(?newNodeL)))), 
                    IF(isLiteral(?newNodeL), URI(CONCAT("L:", REPLACE(STR(?newNodeL), "[ \\(\\)]", "-"))), 
                        ?newNodeL)) 
                AS ?newNodeLX)
        BIND(?node AS ?newNodeRX)
    }
  }
  UNION
  {
    {
        # Left to right relations (starting Blank is the subject)
        ?nodeC ?edge ?newNodeR .
        # ?nodeC must be checked for Blank, ?newNodeR must be checked for IRI or Blank
        FILTER(isBlank(?nodeC))
        FILTER(isIRI(?newNodeR) || isBlank(?newNodeR) || isLiteral (?newNodeR))
        BIND(IF(isBlank(?newNodeR), URI(CONCAT("BNode:", STR(ent:id(?newNodeR)))),
                IF(isLiteral(?newNodeR),URI(CONCAT("L:", REPLACE(STR(?newNodeR), "[ \\(\\)]", "-"))),
                        ?newNodeR)) 
        AS ?newNodeRX)
        BIND(URI(CONCAT("BNode:", STR(ent:id(?nodeC)))) AS ?newNodeLX)
        FILTER(?newNodeLX = ?node)
    }
    UNION
    {
        # Right to left relations (starting Blank is the object)
        ?newNodeL ?edge ?nodeC .
        # ?nodeC must be checked for Blank, ?newNodeL is always an IRI or Blank
        FILTER(isBlank(?nodeC))
        BIND(IF(isBlank(?newNodeL), URI(CONCAT("BNode:", STR(ent:id(?newNodeL)))), 
                    IF(isLiteral(?newNodeL), URI(CONCAT("L:", REPLACE(STR(?newNodeL), "[ \\(\\)]", "-"))), 
                        ?newNodeL)) 
        AS ?newNodeLX)
        BIND(URI(CONCAT("BNode:", STR(ent:id(?nodeC)))) AS ?newNodeRX)
        FILTER(?newNodeRX = ?node)
    }
  }
}
#ORDER BY ?edge

and following for Node Basics:

# Note that ?node is the relevant node's IRI and must be used in the query
PREFIX sesame: <http://www.openrdf.org/schema/sesame#>
PREFIX ent: <http://www.ontotext.com/owlim/entity#>

SELECT ?type {
  {
    # Get node direct type
    ?node sesame:directType ?type.
  }
  UNION
  {
    # Get node direct type
    ?nodeB sesame:directType ?type.
    FILTER(isBlank(?nodeB) && URI(CONCAT("BNode:", STR(ent:id(?nodeB)))) = ?node)
  }
  UNION  
  {
    # Get node direct type
    ?nodeB sesame:directType ?type.
    FILTER(isLiteral(?nodeB) && URI(CONCAT("L:", ?nodeB)) = ?node)
  }
} ORDER BY ?type

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.