Build A Basic Ontology Using The SmartRDF Editor

Next: Transform Between Different RDF Syntaxes

RDF Studio contains an array of intellisense features to help you build, or extend an ontology quickly using RDF autocompletion. We show you what you can do by guiding you through creating your own basic ontology, from scratch.

After this tutorial, you should be able to:

  • Create a new RDF document.
  • Define a number of classes and properties.
  • Define a number of individuals.
  • Use RDF autocompletion to help find the right ontology vocabulary to use.

Estimated time: 10 minutes

You should have already understood the following lesson (and pre-requisites) before you begin:

One of the main purposes of writing RDF is to build, or extend, an ontology. For this purpose, RDF Studio comes armed with a number useful tools to make this easier.

1. Create A New RDF Document

To learn how to make a simple ontology in RDF Studio, we will start by creating a new RDF document.

  1. Click on "New..." in the FILE menu, or click "Create A New RDF File" on the Start Page (the tab that is visible when you first open RDF Studio).
  2. Click on the 'Save as type' drop-down menu at the bottom of the New File window, and select 'Turtle Documents (.ttl)'.
  3. Enter the filename 'tutorial.ttl' into the filename box, and choose an appropriate folder to save our new document.

All being well, you should now see your new tutorial.ttl file appear in the Model Explorer panel. Expand the tutorial.ttl model node and click on the RDF Editor node, as we learned how to do in the Quick Start Tutorial.

You should now see the new Turtle template file as below:

Note that this template new Turtle file already contains prefix definitions for our standard RDF and RDFS namespaces, and some comments to give examples of how you might add your own prefixes and RDF statements to the document.

2. Reference Some Basic Vocabularies

Okay, now you're ready to reference some basic vocabularies. The ontology we're going to build is going to be for an e-commerce site, so we're going to need some commonly used e-commerce terms. That's okay, because RDF Studio comes built-in with the Good Relations ontology, which we will reference in our new ontology.

First, let's add a reference to the Good Relations ontology by adding its namespace. Start typing the following Turtle into your tutorial.ttl RDF editor (don't just copy and paste - you'll see why in a moment!):

@prefix gr: <http://purl.org/goodrelations/v1#>.

Notice that as soon as you hit the '@' character, just like we found when building a SPARQL query in our previous tutorial, we find an immediate list of common RDF vocabularies in our autocomplete list for you to use in your own ontologies. Use the arrow keys to select the 'gr' (Good Relations) vocabulary namespace - you might want to remove the example prefix declaration comment at the same time.

Completely new to ontologies? We recommend you start with our acclaimed RDFS & OWL primer tutorial to get you started.

You should now see something like the following:

Notice that the Turtle syntax has been highlighted in different colors to make it clearer the different component parts of the Turtle ontology.

Because we're extending good relations with our own vocabulary, we'll need to add our own namespace http://www.linkeddatatools.com/example too by adding our own prefix underneath those that have already been added. Type in the following (this time, we won't be using any of the autocompleted namespaces so just ignore the autocomplete options and continue typing):

@prefix example: <http://www.linkeddatatools.com/example#>.

3. Add Our Own Brand And Company Identity Using Good Relations

Let's now extend good relations with our own classes and properties in our own namespace, which the RDF editor will help us to do.

We want to add a Linked Data Tools brand to our own ontology, so let's add an individual of the gr:Brand class underneath our prefix declarations, like so:

example:brand a gr:Brand

Notice as we type, RDF Studio picks up that we're using our reference Good Relations vocabulary and gives us in-depth help on what the terms mean in our tooltips. The icon next the term in the autocomplete list also tells you whether it is a property or a class you are adding, like so:

Select gr:Brand from the autocompletion list as shown above and hit enter. We now have our first individual, defining our e-commerce brand for Linked Data Tools, as shown below:

Now we'll add a few more declarations to finish off the basic definition of the Linked Data Tools company brand, this time using the standard RDFS vocabulary to add some helpful labels and comments. Type the following below the brand we just defined:

example:brand rdfs:label "The Linked Data Tools brand".
example:brand rdfs:comment "The Good Relations based brand for Linked Data Tools".

You should now see the following:

Notice as you type, again you can select the label and comment terms from the list without having to type them in manually yourself - just remember to terminate each line with a dot ('.').

As an exercise, experiment yourself with some of the terms using the Good Relations vocabulary. There are plenty of terms available you can use to enrich our company brand definition - from company location, to opening hours, to the specific products and services offered.

 

Add comment

Security code
Refresh

Community

Register to download software from our site and interact with other users as you learn semantic web.