Extracting Classes and Sub Classes in .py or .npz format from ontology in .ttl format in Top Braid Composer

16 views
Skip to first unread message

mnk.ya...@gmail.com

unread,
Feb 1, 2021, 1:14:35 AM2/1/21
to TopBraid Suite Users
Hello Everyone,
I am using top braid composer maestro edition and I want to extract all classes or subclasses from ontology in a .py file . Content of file should be as shown in screen shot attached.
Anyone Please suggest!!
ontology_list.png

Richard Cyganiak

unread,
Feb 1, 2021, 4:14:17 AM2/1/21
to topbraid-users list
Composer doesn't have an output format like this.

If you know SPARQL, you should be able to write a query that achieves this. Step 1, write a query that selects the label or URI of all the classes you want (1 class per line). Step 2, change the query to use SPARQL string functions to get each line into the 'xxx' format including the single quotes. Step 3, change the query to use SPARQL's GROUP_CONCAT feature to join all Iines to one line.

Richard



--
You received this message because you are subscribed to the Google Groups "TopBraid Suite Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to topbraid-user...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/topbraid-users/c09ae5d5-a983-4aa7-811c-6ec1754c7ea6n%40googlegroups.com.
<ontology_list.png>

mnk.ya...@gmail.com

unread,
Feb 3, 2021, 1:41:27 AM2/3/21
to TopBraid Suite Users
Can we provide index to classes like Class 1 --1, Class 2--2, and then creating a file which will have set of all instances belongs to which class.
Actually I wanted to retrieve two files from my ontology. lets say one is ontology list and other is ontology id. Ontology id contains sets of instances in  the form of indexes. If instance 1 belongs to class 1and instance 2 is also belongs to class1 1 them ontology id contains 1,1

ontology_list2 is all concepts and subconcepts in the ontology, such as "Symptom" (Concept) or name of symptom (sub-concept) in Figure 2 
and ontology_idx is the concept that a word/term in ontology_list2 belongs to. This one depends on how you define your ontology's concept. For example, if I define "Symptom" is concept 1, so all words/ terms belong to "Symptom" equals 1 in the ontology_idx.
Example are attached

Actually I am new to ontology and SPARQL. If you can provide me link then that will be helpful 
ontology_list.png
ontology_idx.png

Richard Cyganiak

unread,
Feb 3, 2021, 8:52:33 AM2/3/21
to topbraid-users list
Does the ontology file already contain the index number for each class? If not, then this will be difficult.

Richard



To view this discussion on the web visit https://groups.google.com/d/msgid/topbraid-users/7e4a84f2-f1d7-4180-89a2-faacb6d3e8e5n%40googlegroups.com.
<ontology_list.png><ontology_idx.png>

Reply all
Reply to author
Forward
0 new messages