# Unable to Visualize data as connected Graph

**URL:** <https://community.stardog.com/t/unable-to-visualize-data-as-connected-graph/3275>\
**Category:** Stardog Explorer\
**Created:** [September 20, 2021, 3:07pm UTC](https://community.stardog.com/t/unable-to-visualize-data-as-connected-graph/3275 "2021-09-20T15:07:05Z")\
**Posts on this page:** 7\
**Page:** 1

<div class="post-metadata">

**Author:** ![Sam](https://avatars.discourse-cdn.com/v4/letter/s/5f9b8f/32.png) [@Sam](https://community.stardog.com/u/Sam)\
**Post date:** [September 20, 2021, 3:07pm UTC](https://community.stardog.com/t/unable-to-visualize-data-as-connected-graph/3275/1 "2021-09-20T15:07:05Z")

</div>

Hi Team,

Could you please advise, how can we able to see the data from virtual graph in a "graph" visualization ?

Able to identify 2 options,

1. Selecting the query result in Stardog studio and click "visualize".
2. With Stardog explorer .

Both didn't work for my case. Could you please tell us what is missing , to get it work ?  
or do we need to get it done with external tool set ?

Below are the details !!

**1. Using Stardog studio** :

 ![image](https://canada1.discourse-cdn.com/flex030/uploads/stardog/original/2X/7/78bc9d9932dcfb29a59652580ccf1f7f960dee8e.png)

Selecting the results and clicking visualize, gives below result

 ![image](https://canada1.discourse-cdn.com/flex030/uploads/stardog/original/2X/f/fb96fb019478c819824d2444684b54037e1d1750.png)

Below is the query plan for "construct" query

```auto
From default
From named local named
From named virtual
Reduced [#280]
`─ Projection(?iri AS ?subject, ?predicate, ?object, <tag:stardog:api:context:default> AS ?context;
   +─ ?object AS ?subject, rdf:type AS ?predicate, ?object_type AS ?object, <tag:stardog:api:context:default> AS ?context;
   +─ ?object AS ?subject, <tag:stardog:studio:label> AS ?predicate, ?object_label_0 AS ?object, <tag:stardog:api:context:default> AS ?context;
   +─ ?object AS ?subject, rdfs:label AS ?predicate, ?object_label_1 AS ?object, <tag:stardog:api:context:default> AS ?context;
   +─ ?object AS ?subject, <http://purl.org/dc/elements/1.1/title> AS ?predicate, ?object_label_2 AS ?object, <tag:stardog:api:context:default> AS ?context;
   +─ ?subject, ?predicate_2 AS ?predicate, ?iri AS ?object, <tag:stardog:api:context:default> AS ?context;
   +─ ?subject, rdf:type AS ?predicate, ?subject_type AS ?object, <tag:stardog:api:context:default> AS ?context;
   +─ ?subject, <tag:stardog:studio:label> AS ?predicate, ?subject_label_0 AS ?object, <tag:stardog:api:context:default> AS ?context;
   +─ ?subject, rdfs:label AS ?predicate, ?subject_label_1 AS ?object, <tag:stardog:api:context:default> AS ?context;
   +─ ?subject, <http://purl.org/dc/elements/1.1/title> AS ?predicate, ?subject_label_2 AS ?object, <tag:stardog:api:context:default> AS ?context) [#280]
   `─ Slice(offset=0, limit=1000) [#28]
      `─ Union [#28]
         +─ VALUES (?iri) {
         │ +─ ( <http://abc.com/movies/adult> )
         │ +─ ( <http://abc.com/movies/budget> )
         │ +─ ( <http://abc.com/movies/imdb_id> )
         │ +─ ( <http://abc.com/movies/movid> )
         │ +─ ( <http://abc.com/movies/original_language> )
         │ +─ ( <http://abc.com/movies/original_title> )
         │ +─ ( <http://abc.com/movies/overview> )
         │ +─ ( <http://abc.com/movies/release_date> )
         │ +─ ( <http://abc.com/movies/revenue> )
         │ +─ ( <http://abc.com/movies/runtime> )
         │ +─ ( <http://abc.com/movies/tagline> )
         │ +─ ( <http://abc.com/movies/title> )
         │ +─ ( rdf:type )
         │ `─ ( <http://abc.com/movies/film> )
         │ }
         `─ VALUES (?iri) {
            +─ ( <http://abc.com/movies/adult> )
            +─ ( <http://abc.com/movies/budget> )
            +─ ( <http://abc.com/movies/imdb_id> )
            +─ ( <http://abc.com/movies/movid> )
            +─ ( <http://abc.com/movies/original_language> )
            +─ ( <http://abc.com/movies/original_title> )
            +─ ( <http://abc.com/movies/overview> )
            +─ ( <http://abc.com/movies/release_date> )
            +─ ( <http://abc.com/movies/revenue> )
            +─ ( <http://abc.com/movies/runtime> )
            +─ ( <http://abc.com/movies/tagline> )
            +─ ( <http://abc.com/movies/title> )
            +─ ( rdf:type )
            `─ ( <http://abc.com/movies/film> )
            }

```

**2. Using Stardog Explorer:**

tried searching for a movie name. but no luck.

 ![image](https://canada1.discourse-cdn.com/flex030/uploads/stardog/original/2X/f/f12815e360e38b45633c6a69d7c45aa49b01158e.png)

Selected a database which has "fulltext search" properties enabled .

Selected Graph as "all" and also tried "selecting a particular virtual graph" in the below options.

 ![image](https://canada1.discourse-cdn.com/flex030/uploads/stardog/original/2X/c/cf05bbbe5a235248b45263c7e3ccfa8c58c93b03.png)

Please advise, am i missing something / which is the right approach for graph based visualization of the data from virtual graph.

Requesting a help on this .

Thanks,  
Muthu

---

<div class="post-metadata">

**Author:** ![pedro](https://yyz2.discourse-cdn.com/flex030/user_avatar/community.stardog.com/pedro/32/108_2.png) [@pedro](https://community.stardog.com/u/pedro)\
**Post date:** [September 21, 2021, 1:55pm UTC](https://community.stardog.com/t/unable-to-visualize-data-as-connected-graph/3275/2 "2021-09-21T13:55:25Z")

</div>

Hi Muthu,

For complex graph visualizations, we recommend using Explorer. We have some [documentation](https://docs.stardog.com/stardog-applications/explorer/) on how search works with explorer, but I will summarize here some quick instructions for your use case:

- Resources should have at least one label property (e.g.: `rdfs:label`), as mentioned in the [docs](https://docs.stardog.com/stardog-applications/explorer/#searching-in-explorer)
- Disable [full text search](https://docs.stardog.com/query-stardog/full-text-search), since you're searching virtual graphs
- Enable [virtual transparency](https://docs.stardog.com/operating-stardog/database-administration/database-configuration#virtualtransparency) in your database: `virtual.transparency=True` and `query.all.graphs=True`
- Set graph [option](https://docs.stardog.com/stardog-applications/explorer/#settings) in Explorer to `all` or `virtual`

After all this, you should be able to search and [navigate](https://docs.stardog.com/stardog-applications/explorer/#visualization-capabilities) your Virtual Graph.

---

<div class="post-metadata">

**Author:** ![Sam](https://avatars.discourse-cdn.com/v4/letter/s/5f9b8f/32.png) [@Sam](https://community.stardog.com/u/Sam)\
**Post date:** [September 27, 2021, 1:06pm UTC](https://community.stardog.com/t/unable-to-visualize-data-as-connected-graph/3275/3 "2021-09-27T13:06:00Z")

</div>

Thanks @pedro

Now i'm able to see some data in explorer by importing ontology into a stardog db with labels for a class.

Wondering with the below issue.

When i select an expand by instance and selected a particular individual.

While trying to expand an individual based on relationships , i don't find any .

 ![image](https://canada1.discourse-cdn.com/flex030/uploads/stardog/original/2X/c/c489dd235fb6950f6de0b186c121984836bb5c96.png)

But when i click "see details" i'm able to view all the relationships.

 ![image](https://canada1.discourse-cdn.com/flex030/uploads/stardog/original/2X/4/44a3548586f8a64471d52d321b76bef81533f2df.png)

Is it how this works, or should i change something to view the relationships under this instance in a connected graph format ?

**Query 2:**

If i right click the movies node and select "expand by instance" and selected a value, it's coming as "no class" ? could you pls advise what should be corrected here ?

 ![image](https://canada1.discourse-cdn.com/flex030/uploads/stardog/original/2X/6/6f23369946bc251fbd331d4d397b6a4d296eb30d.png)

Requesting a clarification.

Attached the mapping and ontology file, that i'm using .

[map.ttl](https://community.stardog.com/uploads/short-url/wdnyYEw0PlwmKrppGJNow9PfZ09.ttl) (1.9 KB)  
[onto.ttl](https://community.stardog.com/uploads/short-url/jeoivMzEmHPIniAWv6UAZvOFmpB.ttl) (8.4 KB)

Thanks in Advance,  
Muthu

---

<div class="post-metadata">

**Author:** ![pedro](https://yyz2.discourse-cdn.com/flex030/user_avatar/community.stardog.com/pedro/32/108_2.png) [@pedro](https://community.stardog.com/u/pedro)\
**Post date:** [September 29, 2021, 1:21pm UTC](https://community.stardog.com/t/unable-to-visualize-data-as-connected-graph/3275/4 "2021-09-29T13:21:49Z")

</div>

Hi Muthu,

Wrt you first question, the nodes you are trying to expand are literals (e.g., numbers, strings). That metadata is only available on the details tab, the graph visualization part is for resources aka other nodes that can have metadata attached to them.  
Looking at `map.ttl`, some of your properties are indeed leading to resources, but your mappings are incorrect. Resources need to have a valid IRI, so they should be something like `BIND (template("http://abc.com/producers/{companyid}") AS ?producer)`.

Wrt your second question, I think you need to take a look at your ontology and mappings, since there are many discrepancies. For example, properties have different names (e.g., `imdb_id` vs `imdbId`), and you need to fix your `template` in your mappings as referred before, so IRIs match the ones in the ontology.  
I recommend starting with a smaller dataset and ontology (e.g., just one class), and work up from there.

-pedro

---

<div class="post-metadata">

**Author:** ![Sam](https://avatars.discourse-cdn.com/v4/letter/s/5f9b8f/32.png) [@Sam](https://community.stardog.com/u/Sam)\
**Post date:** [September 30, 2021, 2:38pm UTC](https://community.stardog.com/t/unable-to-visualize-data-as-connected-graph/3275/5 "2021-09-30T14:38:44Z")

</div>

Thanks @pedro for your inputs. It really , helped a lot.

After this i'm able to see the movies belonging to a particular genre, as like below, which is fine.

 ![image](https://canada1.discourse-cdn.com/flex030/uploads/stardog/original/2X/9/95cc02c59637805946b76fb0b7b92a35b10245c0.png)

But, why no details for a instance of class "Movie" is getting displayed and not getting connected with the Movie node ?

 ![image](https://canada1.discourse-cdn.com/flex030/uploads/stardog/original/2X/e/e76531c1f66ec56257bfee6f40127b08154cf751.png)

Attached new mapping and ontology with reduced fields as you suggested

[newmap.ttl](https://community.stardog.com/uploads/short-url/bXdP99e27sJUxXPCnZTUaq1Cl34.ttl) (1.3 KB)  
[newonto.ttl](https://community.stardog.com/uploads/short-url/xzeHKGLlRw3Jejk1PW17mzghnxq.ttl) (3.3 KB)  
[sampledata\_csv.txt](https://community.stardog.com/uploads/short-url/ywVdiSMImMxEnXY3xbOPHyF0WMH.txt) (3.9 KB)

 ![image](https://canada1.discourse-cdn.com/flex030/uploads/stardog/original/2X/8/894abbb5852324f4c4de8f26645724e42410bfa4.png)

Any thoughts on this would complete the analysis of Stardog explorer capability for us !!!

Requesting a help !!

Best regards,  
Muthu

---

<div class="post-metadata">

**Author:** ![pedro](https://yyz2.discourse-cdn.com/flex030/user_avatar/community.stardog.com/pedro/32/108_2.png) [@pedro](https://community.stardog.com/u/pedro)\
**Post date:** [September 30, 2021, 3:11pm UTC](https://community.stardog.com/t/unable-to-visualize-data-as-connected-graph/3275/6 "2021-09-30T15:11:13Z")

</div>

I think your data has a movie, with ID 21032, which is probably empty or lacking most fields.

---

<div class="post-metadata">

**Author:** ![Sam](https://avatars.discourse-cdn.com/v4/letter/s/5f9b8f/32.png) [@Sam](https://community.stardog.com/u/Sam)\
**Post date:** [October 1, 2021, 4:36am UTC](https://community.stardog.com/t/unable-to-visualize-data-as-connected-graph/3275/7 "2021-10-01T04:36:34Z")

</div>

Hi @pedro ,

Thanks for your response.

it's the case for all the instances in Movie node, not for a particular movie id

Moreover, i could see the details for the same node in Stardog studio

 ![image](https://canada1.discourse-cdn.com/flex030/uploads/stardog/original/2X/3/3c98b0a5dbe6d79aba5139ee1eb1f33133bcee6a.png)

Also could find a strange behavior, when i tried to filter based on subject IRI. Hope if this get solved, then i may be able to see the details in Stardog explorer. Please Correct me if I'm wrong.

 ![image](https://canada1.discourse-cdn.com/flex030/uploads/stardog/original/2X/7/7c63ea245ae0572f4dcbf885380c234fd5452ec4.png)

**note** : Tried with double quotes and single quotes appended for filter value as well like `FILTER(?movies = "<http://ey.com/movies/21032>"")`. but no luck.

**Query Plan** for above query:

```auto
From default
From named local named
From named virtual
Slice(offset=0, limit=1000) [#258]
`─ Projection(?movies, ?genretriple, ?movieId, ?imdbId) [#258]
   `─ Bind(<http://abc.com/movies/21032> AS ?movies) [#258]
      `─ NestedLoopJoin(_) [#258]
         +─ NestedLoopJoin(_) [#233]
         │ +─ NestedLoopJoin(_) [#233]
         │ │ +─ VirtualGraphMongoDB<virtual://spokeAproduct> [#116] {
         │ │ │ +─ RelNode=
         │ │ │ +─ LogicalProject(imdbId=[$1])
         │ │ │ +─ LogicalFilter(condition=[AND(=($1.0, '21032':VARCHAR(2048)), IS NOT NULL($1))])
         │ │ │ +─ UnwoundRel(coll=[movies], key=[[$_id]], projection=[movieId=$id, imdbId=$imdb_id, lang=$original_language, title=$original_title])
         │ │ │ +─ Query=
         │ │ │ +─ { $match : {$and : [{"id" : {$eq : "21032"}}, {"imdb_id" : {$exists : true, $ne : null}}]} },
         │ │ │ +─ {$project: {imdbId: '$imdb_id'} }
         │ │ │ +─ Vars=
         │ │ │ +─ ?imdbId <- COLUMN($0)^^xsd:string
         │ │ │ }
         │ │ `─ VirtualGraphMongoDB<virtual://spokeAproduct> [#174] {
         │ │ +─ RelNode=
         │ │ +─ LogicalProject(gName=[$1])
         │ │ +─ LogicalFilter(condition=[AND(=($0, '21032':VARCHAR(2048)), IS NOT NULL($1))])
         │ │ +─ UnwoundRel(coll=[movies], unwind=[[$genres]], projection=[movieId=$id, gName=$genres.name])
         │ │ +─ Query=
         │ │ +─ {$unwind: "$genres"},
         │ │ +─ { $match : {$and : [{"id" : {$eq : "21032"}}, {"genres.name" : {$exists : true, $ne : null}}]} },
         │ │ +─ {$project: {gName: '$genres.name'} }
         │ │ +─ Vars=
         │ │ +─ ?genretriple <- TEMPLATE(http://abc.com/movies/{gName/0})
         │ │ }
         │ `─ VirtualGraphMongoDB<virtual://spokeAproduct> [#116] {
         │ +─ RelNode=
         │ +─ LogicalProject(movieId=[$0])
         │ +─ LogicalFilter(condition=[AND(=($2.0, '21032':VARCHAR(2048)), IS NOT NULL($0))])
         │ +─ UnwoundRel(coll=[movies], key=[[$_id]], projection=[movieId=$id, imdbId=$imdb_id, lang=$original_language, title=$original_title])
         │ +─ Query=
         │ +─ { $match : {$and : [{"id" : {$eq : "21032"}}, {"id" : {$exists : true, $ne : null}}]} },
         │ +─ {$project: {movieId: '$id'} }
         │ +─ Vars=
         │ +─ ?movieId <- COLUMN($0)^^xsd:string
         │ }
         `─ VirtualGraphMongoDB<virtual://spokeAproduct> [#129] {
            +─ RelNode=
            +─ LogicalProject
            +─ LogicalFilter(condition=[=($3.0, '21032':VARCHAR(2048))])
            +─ UnwoundRel(coll=[movies], key=[[$_id]], projection=[movieId=$id, imdbId=$imdb_id, lang=$original_language, title=$original_title])
            +─ Query=
            +─ { $match : {"id" : {$eq : "21032"}} },
            +─ {$limit:1}
            +─ Vars=
            +─ 
            }

```

Please advise.

Thanks,  
Muthu
