Need an example of sparql insert with rdfs:subClassOf

Continuing the discussion from Selecting multiple types:

@pavel - thanks for your example in the post above. How can I wrap this code that you have provided into a sparql statement that I can execute in Studio?

:Tea rdfs:subClassOf :Drink.
  • Is it an INSERT DATA kind of of statement?

Thanks,
Radu

If you enable reasoning you can execute the following query assuming you have the subclass axioms in your schema.

select ?s where {
    ?s rdf:type :Drink
}

without reasoning based on what you've mentioned

select ?s where {
   { ?s rdf:type :Tea } union { ?s rdf:type :Coffee } union { ?s rdf:type :Drink }
}

These would be select statements. You seem to be getting a bit confused between data and queries. They can look similar if the data is serialized with the turtle format. It might clear up some confusion to look at RDF 1.1 Turtle and SPARQL 1.1 Overview

Zach,

Thanks for your prompt reply. No I don't have "subclass axioms in my schema" yet... This is what I actually need.

Context - my knowledge graph is created by an NLP process that extracts data from documents and writes triples (i.e. INSERT DATA) to Stardog. So subClassOf statement is more like a post processing task - I don't know yet how to do.

Thanks,
Radu

Ok, I think I see what you were talking about, yes that would be an insert

insert data { 
:Tea rdfs:subClassOf :Drink.
}

which would include the axiom for the first query previously given (assuming the schema is using the default graph)

So easy and obvious - sorry should have figured myself - Thank you!

It worked - but now it is ugly in visualizing subClassOf - every relationship....

I have to use some other way...

Regards,
Radu

You could use the new(ish) schema muti-tenancy feature so that the default schema doesn't include them but just include them in your queries where you need it.

Hi Radu,

Can you elaborate a little on the "ugly visualisation" of rdfs:subClassOf? A screenshot would help. Do you see only those axioms that you have added or also inferred rdfs:subClassOf links? Some old version of Studio used to clutter the schema viz screen with schema inferences but that was fixed some time ago.

Best,
Pavel

Oh @pavel it is not Studio it is Linkurious ...

P.S. As you know Linkurious will no longer support RDF databases ... :frowning: ... So it would be really nice to see a similar Studio visualization capability but offered in a form of a wweb application

Regards,
Radu

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