Store Semantic Web Triples into Cassandra


The semantic web is the next level of  Web Searching where data is more important and it should be well defined. The semantic web is needed for making the web search more intelligent and intuitive to get the user’s requirement. You all can find some interesting point on the Semantic Web here.

Triples is an atomic entity in RDF. It is composed of subject-predicate-object. It is used for linking the object (Subject & Object) with the help of Predicate. You all can find some interesting point on the Triples here.

RDF stands for Resource Description Framework, It is a framework which is used for representing all information about the source into the graph. RDF store is used for storing the triples and uses SPARQL query to run it where in RDF store it creates some tables and on the basis of those tables it converts SPARQL query into the normal SQL queries and for that, it uses Quetzal.

Now there will be some questions and one of them is: What are we doing here?

We are trying to store the Triples into Cassandra as Quetzal stores into Postgres after creating the tables. Quetzal creates lots of table for storing the Triples on the basis of certain conditions. Tables which is created by the Quetzal:

  1. kb
  2. kb_basestats
  3. kb_direct_preds
  4. kb_dph
  5. kb_ds
  6. kb_dt
  7. kb_lstr
  8. kb_reverse_preds
  9. kb_rph
  10. kb_rs
  11. kb_topkstats

For more information of these tables, you can visit here.

We are trying to implement kb_direct_preds & kb_dph tables on the Cassandra and fetch the object with the help of subject and predicate.

Table kb_direct_preds is used for storing the location of the predicate in the kb_dph table while kb_dph stores every value of the triples along with subject, predicate & object.

Ingest Data into Cassandra

We have to follow these steps to insert the data into the table:

  • Apache Cassandra running on default port [i.e. 9042]
    sbt "runMain com.knoldus.TripleLoader /PATH/TO/TRIPLE/FILE" 

Fetch Data From Cassandra

We have to follow these step to fetch out the data from the Cassandra table:

    • Run project using the command:
sbt run
    • After running the project, hit the endpoint from your browser:
localhost:8082/triples?subject=<subject_value>&predicate=<predicate_value>

You can find more information from the wiki of the project.

We have submitted the template of the project. You can find template with this command:

sbt new knoldus/triple-manipulation.g8 

These are the steps for storing triples into a kb_dph table with the help of kb_direct_preds.

If You have any questions you can comment us here or contact us on:

Github: Triple Manipulation

Twitter: @anuragknoldus, @akashsethi24, @charmygarg

Thanks.


knoldus-advt-sticker


 

Advertisements

About Anurag Srivastava

Anurag is the Sr. Software Consultant @ Knoldus Software LLP. In his 3 years of experience, he has become the developer with proven experience in architecting and developing web applications.
This entry was posted in Scala, Cassandra, akka-http and tagged , , , , . Bookmark the permalink.

One Response to Store Semantic Web Triples into Cassandra

  1. Anurag Srivastava says:

    Reblogged this on Anurag Srivastava.

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s