> On 23 Sep 2022, at 11:49 pm, Hamid Abdirad <[email protected]> wrote:
> 
> Thank you for your help, Holger. I was able to create assets with your help.
> A couple of followup questions:
> (1) in my script, the prefix does not work for me and I need to use the 
> ontology name as the superclass name. e.g., g.createEverything() does not 
> work but dpr.createEverything() works.
> see the attachement 1 please. Can you hint at what the reason might be?

I don't see an attachment - did you mean to share Turtle files? Without the 
details it's a bit difficult, so feel free to send me your files off-list. Do 
you see any constant called g in the generated source code (either 
auto-complete after g. or open the Panel > Script API Viewer. One possible 
explanation is that the generate prefix constants triple is defined outside of 
an Ontology or File - those cannot be stored in instance graphs such as 
Taxonomies.

> What happens if multiple ontologies use the same prefix (by mistake)? And 
> what if I do not have access to all ontologies of my organization to check 
> for this?

Overlapping prefixes or namespaces is a general issue with the semantic web 
stack, and there is no clean solution beside applying organization-wide 
policies. In practice, we hardly see overlapping prefixes, and even 
http://prefix.cc has few examples where clashes are likely. Having said this, 
you, as the ontology developer, typically have full control over which files or 
graphs you include and at that time you can check for conflicting prefixes.

> 
> (2) I have two classes named "Task" and "Level" and Task assets have an 
> object property named "RelatedLevel". How can I assign Levels to the Tasks 
> using ADS?
> For example: I have  "http://example.org/data-graphs/TestVDC2#Level22 
> <http://example.org/data-graphs/TestVDC2#Level22>" as URI and "Level22" as 
> level but I cannot make ties between the tasks I am creating and the levels.
> see attachment 2 please. I tried using URI, label, javascript object itself 
> but none worked. If applicable, would you give me ADS examples for adding 
> this object using triples or using javascript objects? 

If you already know the URI and just need a reference to that object, you can 
use

        let level = 
graph.namedNode("http://example.org/data-graphs/TestVDC2#Level22 
<http://example.org/data-graphs/TestVDC2#Level22>");

but your mechanism - to fetch the first instance - would also work. OTOH if you 
use something like

        level.uri

then the value that you are assigning is interpreted as a string, and it would 
become an RDF string literal, not an object reference. So in your example, just 
drop the .uri and it should work.

HTH and please feel free to follow up
Holger


> 
> Thank you,
> Hamid
> 
> On Thursday, September 15, 2022 at 10:50:47 PM UTC-7 [email protected] 
> <http://topquadrant.com/> wrote:
> Hi Hamid,
> 
> did you set these properties for your namespace in the ontology?
> 
> 
> 
> For example if your namespace has the prefix "myprefix" then set generate 
> prefix constants to "myprefix" and you SHOULD be able to write things like
> 
> let newAsset = graph.namedNode(URI);
> newAsset.add(rdf.type, myprefix.SampleObject);
> 
> Likewise, if you state generate prefix classes "myprefix" you may be able to 
> just do
> 
> let newAsset = myprefix.createSampleObject(...)
> 
> (Assuming the script editor panel is in write mode using the lock button of 
> the upper right corner, and that you have refreshed the API after changes to 
> the prefixes as above)
> 
> Holger
> 
> 
> 
> 
>> On 16 Sep 2022, at 7:42 am, Hamid Abdirad <[email protected] 
>> <applewebdata://B6E30EB1-863E-4188-BCB6-A9A8B0D723AE>> wrote:
>> 
> 
>> Hi all,
>> I am wondering if there is a better set of guides for using ADS and 
>> ScriptEditor, especially for creating assets based on custom ontologies 
>> included in Data Graphs. 
>> I looked at the following and API guide, but they did not help me much:
>> https://archive.topquadrant.com/doc/7.1/scripting/introduction.html 
>> <https://archive.topquadrant.com/doc/7.1/scripting/introduction.html>
>>  
>> More specifically, I am trying to use graph.add to create and persist 
>> triples but I do not know how to use classes from a custom ontology inside 
>> arguments.
>> 
>> Let's say I have included custom ontology1 and it has Thing > SampleObject 
>> as public classes. Using the ADS in my data graph, how can I create a new 
>> asset that is a SampleObject:
>> graph.add(URI, rdf.type, WHAT_TO_PUT_HERE?) 
>> 
>> I tried things like ontology1.SampleObject, but it does not show as an 
>> asset. Looking at the preview of the script run, it is not being consider a 
>> valid triple. 
>> 
>> Thank you,
>> Hamid
>> 
>> 
> 
>> -- 
>> 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 [email protected] 
>> <applewebdata://B6E30EB1-863E-4188-BCB6-A9A8B0D723AE>.
>> To view this discussion on the web visit 
>> https://groups.google.com/d/msgid/topbraid-users/c58a9d35-c71a-4467-8835-e9a41d0b1d5cn%40googlegroups.com
>>  
>> <https://groups.google.com/d/msgid/topbraid-users/c58a9d35-c71a-4467-8835-e9a41d0b1d5cn%40googlegroups.com?utm_medium=email&utm_source=footer>.
> 
> 
> -- 
> 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 [email protected] 
> <mailto:[email protected]>.
> To view this discussion on the web visit 
> https://groups.google.com/d/msgid/topbraid-users/5ca79ed0-ba02-4e8e-84f7-7f04aa0f3facn%40googlegroups.com
>  
> <https://groups.google.com/d/msgid/topbraid-users/5ca79ed0-ba02-4e8e-84f7-7f04aa0f3facn%40googlegroups.com?utm_medium=email&utm_source=footer>.
> <1.JPG><2.JPG>

-- 
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 [email protected].
To view this discussion on the web visit 
https://groups.google.com/d/msgid/topbraid-users/1F83947C-D82E-4403-94FC-12A743F6271A%40topquadrant.com.

Reply via email to