2

I'm trying to insert new classes by using Sparql in TopBraid Composer (ME 5.5.2). My simple ontology looks like this:

enter image description here

Then I wrote a Sparql query to insert Berry as a subclass of Fruit:

PREFIX ft: <http://www.semanticweb.org/ontologies/2018/7/fruit#>
PREFIX rdfs: <ttp://www.w3.org/2000/01/rdf-schema#>

INSERT
{ft:Berry    rdfs:subClassOf  ft:Fruit}

But an error message appeared, saying Encountered "insert". Was expecting one of: "base, "select", ...

A similar post: Sparql insert data not working says that Sparql Query is a different language from Sparql Update. Some other post says that Sparql Update is not supported in Protege but is supported in Composer (for which reason I downloaded Composer). I also checked the Composer manual: https://www.topquadrant.com/docs/TBC-Getting-Started-Guide52.pdf, which mentions Sparql Update but doesn't say much.

My question then is, is it possible to insert classes and axioms in TopBraid? If so, how? My end goal is that the inserted classes will appear in the hierarchical view, and their inserted class definitions can be seen on the side as well. If Composer can't do this, what other tools/workflows can I use?

Sorry for such a newbie question. Any help is appreciated.

vw511
  • 171
  • 10
  • Try `INSERT DATA` instead of `INSERT`. – Stanislav Kralin Jul 31 '18 at 17:55
  • @StanislavKralin I tried `INSERT DATA`. There were red lines under `ft:Berry`and `ft:Fruit`. I right-clicked on them, and the only options it gave are `Reset to empty SELECT query` and `RESET to empty CONSTRUCT query`. Seems like it's still not happy about `INSERT`. – vw511 Jul 31 '18 at 18:04

1 Answers1

1

There are two forms of INSERT in SPARQL 1.1 Update:

You are mixing them up.

The following works for me in TBC 5.5.2 Free Edition against the kennedys.ttl example:

INSERT DATA
    { kennedys:UralStateUniversity a kennedys:College }

Being an unknown URI, the subject is underlined in query editor, but just press the "Execute SPARQL" button.

Update

In your particular case, you should say something like

INSERT DATA
    { ft:Berry rdfs:subClassOf ft:Fruit; a owl:Class }

Please note that owl:Class is used. TBC considers instances of rdfs:Class as "system classes", their icons are brown, not yellow.

Stanislav Kralin
  • 11,070
  • 4
  • 35
  • 58
  • I tried that, and it does work! I was able to see the update in the change history. Thank you! One follow-up question: Does this mean your original ontology is modified? What should I do to make it appear in the hierarchy in the Class view? – vw511 Jul 31 '18 at 21:01
  • 1
    I finally got the display working! Also successfully displayed class definitions, as a result of a long `INSERT` query. Thank you very very much! – vw511 Jul 31 '18 at 23:13