# Creating Virtual Graph using Stardog API

**URL:** <https://community.stardog.com/t/creating-virtual-graph-using-stardog-api/900>\
**Category:** Support\
**Created:** [March 27, 2018, 6:27pm UTC](https://community.stardog.com/t/creating-virtual-graph-using-stardog-api/900 "2018-03-27T18:27:33Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![smrati.hans](https://avatars.discourse-cdn.com/v4/letter/s/9de053/32.png) [@smrati.hans](https://community.stardog.com/u/smrati.hans)\
**Post date:** [March 27, 2018, 6:27pm UTC](https://community.stardog.com/t/creating-virtual-graph-using-stardog-api/900/1 "2018-03-27T18:27:33Z")

</div>

Hi Team,

I understand Automatic RDBMS Mappings is a newly introduced functionality. I would like to know if Stardog has a way to implement the same programatically, using stardog API, yet.  
I found this article in the blogs:

> **[A Stardog App in 5 Easy Steps | Stardog](https://www.stardog.com/blog/a-stardog-app-in-5-easy-steps/)**
>
> Stardog makes the Enterprise Knowledge Graph fast and easy. We’re going to build a Java app that talks to Stardog’s RDF graph database in 5 easy steps.

But as per my understanding this also requires a N3 file. Is there any other similar article on the same which might be helpful?  
Any leads would be much appreciated.

Thank you!

---

<div class="post-metadata">

**Author:** ![zachary.whitley](https://yyz2.discourse-cdn.com/flex030/user_avatar/community.stardog.com/zachary.whitley/32/94_2.png) [@zachary.whitley](https://community.stardog.com/u/zachary.whitley)\
**Post date:** [March 27, 2018, 7:05pm UTC](https://community.stardog.com/t/creating-virtual-graph-using-stardog-api/900/2 "2018-03-27T19:05:25Z")

</div>

> [@smrati.hans](#):
>
> I would like to know if Stardog has a way to implement the same programatically, using stardog API, yet.

I'm not sure exactly what you're looking to do but I think a good start would be looking at [VirtualGraphAdminConnection](https://www.stardog.com/docs/java/snarl/com/complexible/stardog/virtual/api/admin/virtualgraphadminconnection)

> [@smrati.hans](#):
>
> But as per my understanding this also requires a N3 file.

The example uses N3 but you can use any serialization that Stardog understands which is most of the ones available. N3, turtle, rdf/xml, etc

> [@smrati.hans](#):
>
> Is there any other similar article on the same which might be helpful?

The Stardog [examples](https://github.com/stardog-union/stardog-examples) github repo is also a great place to look and you can always ask questions here.

---

<div class="post-metadata">

**Author:** ![smrati.hans](https://avatars.discourse-cdn.com/v4/letter/s/9de053/32.png) [@smrati.hans](https://community.stardog.com/u/smrati.hans)\
**Post date:** [April 4, 2018, 9:34pm UTC](https://community.stardog.com/t/creating-virtual-graph-using-stardog-api/900/3 "2018-04-04T21:34:21Z")

</div>

Thank you for the quick response.  
I am using the same VirtualGraphAdminConnection to create Virtual graph. But what should I pass as third parameter if I dont have any mappings file(.tll).  
I understand that we can do it through command line by using command:  
stardog-admin virtual add emp.properties  
as mentioned in : [Easy Graph is Good Graph | Stardog](https://www.stardog.com/blog/easy-graph-is-good-graph/)  
I tried passing null as mappings, but I am facing NullPointerException in that case. Shall I pass an empty file or anything else in that case?

Thank you!

---

<div class="post-metadata">

**Author:** ![jess](https://yyz2.discourse-cdn.com/flex030/user_avatar/community.stardog.com/jess/32/10_2.png) [@jess](https://community.stardog.com/u/jess)\
**Post date:** [April 4, 2018, 10:05pm UTC](https://community.stardog.com/t/creating-virtual-graph-using-stardog-api/900/4 "2018-04-04T22:05:37Z")

</div>

Hi Smrati,

You can do this by passing an empty Model instance which has no statements.

Jess

---

<div class="post-metadata">

**Author:** ![system](https://canada1.discourse-cdn.com/flex030/uploads/stardog/original/2X/e/ed66b48a616f505106a4acde3c9cee7e6da9bc67.svg) [@system](https://community.stardog.com/u/system)\
**Post date:** [April 18, 2018, 10:05pm UTC](https://community.stardog.com/t/creating-virtual-graph-using-stardog-api/900/5 "2018-04-18T22:05:49Z")

</div>

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.
