Hi again,

I tried to use the above example with my query:

graph.select(`
    SELECT ?masterGraph
WHERE {
    GRAPH ?masterGraph {
    ?masterGraph rdf:type teamwork:Vocabulary .}
FILTER NOT EXISTS {
    GRAPH ?masterGraph {
      ?s edg:subjectArea ?o .
    }
  }
  FILTER (STRSTARTS(STR(?masterGraph),"urn:x-evn-master:") 
&&(!STRENDS(STR(?masterGraph),"singleton")) )}`
  ).bindings.forEach(b => {
let masterGraph = b.masterGraph;
 console.log (b.masterGraph)
 masterGraph.add(rdfs.comment, 'hello hello')
})


but it only add comment to the graph from which I run the script. In the 
change history panel in the same graph there's information that the comment 
was added but when I go to those other graphs the comment is not visible. 
<urn:x-evn-master:ontology_test_creation>
  rdfs:comment "hello hello" ;
.
<urn:x-evn-master:test3_ontology>
  rdfs:comment "hello hello" ;
.
<urn:x-evn-master:test_test_core_glossary>
  rdfs:comment "hello hello" ;
.
<urn:x-evn-master:x_idea_testontology_v10>
  rdfs:comment "hello hello" ;


Can you tell me what I'm doing wrong :)


Thanks,

Kasia

On Friday, September 1, 2023 at 9:27:23 AM UTC+2 Kasia Kryczka wrote:

> Holger,
>
> thank you :)
>
> Br,
>
> Kasia
>
> On Thursday, August 31, 2023 at 1:35:25 PM UTC+2 Holger Knublauch wrote:
>
>> owl.everyClass().forEach(cls => {
>> cls.add(rdfs.comment, 'Hello World')
>> })
>>
>> or with any SPARQL:
>>
>> graph.select(`
>> SELECT ?cls
>> WHERE {
>> ?cls rdf:type/rdfs:subClassOf* owl:Class .
>> }`).bindings.forEach(b => {
>> let cls = b.cls;
>> cls.add(rdfs.comment, 'Hello World')
>> })
>>
>> HTH
>> Holger
>>
>>
>> On 31 Aug 2023, at 12:19 pm, Kasia Kryczka <[email protected]> wrote:
>>
>> HI Holger,
>>
>> and could you show an example how to find all owl:Class with js or how to 
>> use sparql query to insert the comment?
>> I have the query to get all owl:Class but I don't know how to use it with 
>> js.
>>
>> Thanks,
>>
>> Kasia
>>
>> On Thursday, August 24, 2023 at 10:57:52 AM UTC+2 Holger Knublauch wrote:
>>
>>>
>>> On 24 Aug 2023, at 9:43 am, Kasia Kryczka <[email protected]> wrote:
>>>
>>> Hi Holger,
>>>
>>> we have this script :
>>> dataset.masterGraphs().forEach(masterGraph=> {
>>>     console.log('Adding to ' + masterGraph);
>>>     graph.transaction(masterGraph + ':' +tbs.currentUserId(), 'Adding 
>>> something', () => {
>>>         let subject =graph.namedNode(masterGraph); 
>>> subject.add(rdfs.comment,"Added");
>>>     });
>>> });
>>>
>>> just add something to the history. This adds the change only to the 
>>> ontology level, is it possible to add the change to their classes as well ( 
>>> to all lower levels) ?
>>>
>>>
>>> The script above only uses masterGraph as subject. If you want to add 
>>> triples to specific classes, you need to know the URIs of these classes, 
>>> e.g.
>>>
>>> let subject = graph.namedNode('http://example.org/myOntology#MyClass";);
>>> subject.add(rdfs.comment, "Added comment to the class");
>>>
>>> If you don't know the exact URI of the classes you want to modify you 
>>> could first find all instances of owl:Class or use a SPARQL query to find 
>>> them, then iterate over those.
>>>
>>> Holger
>>>
>>>
>>>
>>> Hope this helps.
>>>
>>> Br, 
>>>
>>> Kasia
>>>
>>> On Wednesday, August 23, 2023 at 5:40:53 PM UTC+2 Holger Knublauch wrote:
>>>
>>>> Sorry I don't understand the question. What do you have and what needs 
>>>> to be changed?
>>>>
>>>> Holger
>>>>
>>>>
>>>> On 23 Aug 2023, at 1:54 pm, Kasia Kryczka <[email protected]> wrote:
>>>>
>>>> Hi Holger,
>>>>
>>>> it seems that we need more of this script. How to make changes to 
>>>> mastergraph and on their classes as well. 
>>>>
>>>> How can we modify the script?
>>>>
>>>> Thanks,
>>>>
>>>> Kasia
>>>>
>>>> On Wednesday, July 19, 2023 at 2:59:11 PM UTC+2 Kasia Kryczka wrote:
>>>>
>>>>> Hi Holger,
>>>>>
>>>>> thank you for quick reply.
>>>>>
>>>>> I'll try do do that.
>>>>>
>>>>> Br,
>>>>>
>>>>> Kasia
>>>>>
>>>>> On Wednesday, July 19, 2023 at 2:22:33 PM UTC+2 Holger Knublauch wrote:
>>>>>
>>>>>> On 19 Jul 2023, at 1:06 pm, Kasia Kryczka <[email protected]> 
>>>>>> wrote:
>>>>>>
>>>>>> Hi,
>>>>>>
>>>>>> When I added this comment (with the script above )and deleted it 
>>>>>> later (in Script editor) it seems that this change is not saved in the 
>>>>>> change history. 
>>>>>>
>>>>>> Where can I find that this change happened?
>>>>>>
>>>>>>
>>>>>> The script below writes to the master graphs directly, bypassing the 
>>>>>> change history.
>>>>>>
>>>>>> To have the changes recorded, you need to use a slightly different 
>>>>>> graph, which includes the user name.
>>>>>>
>>>>>> One way to do that is to do something like 
>>>>>>
>>>>>> graph.transaction(masterGraph + ':Administrator, ...
>>>>>>
>>>>>> or
>>>>>>
>>>>>> graph.transaction(masterGraph + ':' + tbs.currentUserId(), ...
>>>>>>
>>>>>> This will use something like urn:x-evn-master:geo:Administrator and 
>>>>>> changes to that will create change history items too.
>>>>>>
>>>>>> HTH
>>>>>> Holger
>>>>>>
>>>>>>
>>>>>>
>>>>>>
>>>>>> Thanks,
>>>>>>
>>>>>> Kasia
>>>>>>
>>>>>> On Thursday, March 30, 2023 at 11:37:14 AM UTC+2 Holger Knublauch 
>>>>>> wrote:
>>>>>>
>>>>>>> From the Script Editor panel, you could run something like
>>>>>>>
>>>>>>> dataset.masterGraphs().forEach(masterGraph => {
>>>>>>> console.log('Adding to ' + masterGraph);
>>>>>>> graph.transaction(masterGraph, 'Adding something', () => {
>>>>>>> let subject = graph.namedNode(masterGraph);
>>>>>>> subject.add(rdfs.comment, "Added");
>>>>>>> })
>>>>>>> })
>>>>>>>
>>>>>>> Watch out though, the green code above is dangerous and will really 
>>>>>>> add triples to every asset collection. (That's also why I didn't run it 
>>>>>>> on 
>>>>>>> my machine, so I hope it works).
>>>>>>>
>>>>>>> Holger
>>>>>>>
>>>>>>>
>>>>>>> On 30 Mar 2023, at 10:30 am, Kasia Kryczka <[email protected]> 
>>>>>>> wrote:
>>>>>>>
>>>>>>> Hi, 
>>>>>>>
>>>>>>> I have about 170 collections with missing value- the collections are 
>>>>>>> listed from the query.
>>>>>>> I need to insert a value <urn:xyz>.
>>>>>>> Is it possible to create a loop that goes through all listed 
>>>>>>> collections and inserts the missing value?
>>>>>>>
>>>>>>> Thanks,
>>>>>>>
>>>>>>> Kasia
>>>>>>>
>>>>>>> -- 
>>>>>>> The topics of this mailing list include TopBraid EDG and related 
>>>>>>> technologies such as SHACL.
>>>>>>> To post to this group, send email to [email protected]
>>>>>>> --- 
>>>>>>> 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/b388bfe2-422f-42a6-9a41-11ddf6e5744an%40googlegroups.com
>>>>>>>  
>>>>>>> <https://groups.google.com/d/msgid/topbraid-users/b388bfe2-422f-42a6-9a41-11ddf6e5744an%40googlegroups.com?utm_medium=email&utm_source=footer>
>>>>>>> .
>>>>>>>
>>>>>>>
>>>>>>>
>>>>>> -- 
>>>>>> The topics of this mailing list include TopBraid EDG and related 
>>>>>> technologies such as SHACL.
>>>>>> To post to this group, send email to [email protected]
>>>>>> --- 
>>>>>> 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/a112e88e-4e62-41dd-af29-1762c51f98c1n%40googlegroups.com
>>>>>>  
>>>>>> <https://groups.google.com/d/msgid/topbraid-users/a112e88e-4e62-41dd-af29-1762c51f98c1n%40googlegroups.com?utm_medium=email&utm_source=footer>
>>>>>> .
>>>>>>
>>>>>>
>>>>>>
>>>> -- 
>>>> The topics of this mailing list include TopBraid EDG and related 
>>>> technologies such as SHACL.
>>>> To post to this group, send email to [email protected]
>>>> --- 
>>>> 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/db1b8b97-4332-46f1-8950-4f2d4a9f78fen%40googlegroups.com
>>>>  
>>>> <https://groups.google.com/d/msgid/topbraid-users/db1b8b97-4332-46f1-8950-4f2d4a9f78fen%40googlegroups.com?utm_medium=email&utm_source=footer>
>>>> .
>>>>
>>>>
>>>>
>>> -- 
>>> The topics of this mailing list include TopBraid EDG and related 
>>> technologies such as SHACL.
>>> To post to this group, send email to [email protected]
>>> --- 
>>> 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/5a10034c-3eb0-4ed4-a062-2277654b59ccn%40googlegroups.com
>>>  
>>> <https://groups.google.com/d/msgid/topbraid-users/5a10034c-3eb0-4ed4-a062-2277654b59ccn%40googlegroups.com?utm_medium=email&utm_source=footer>
>>> .
>>>
>>>
>>>
>> -- 
>> The topics of this mailing list include TopBraid EDG and related 
>> technologies such as SHACL.
>> To post to this group, send email to [email protected]
>> --- 
>> 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/5f6e330a-fd1c-4c21-86cd-0733656faf5an%40googlegroups.com
>>  
>> <https://groups.google.com/d/msgid/topbraid-users/5f6e330a-fd1c-4c21-86cd-0733656faf5an%40googlegroups.com?utm_medium=email&utm_source=footer>
>> .
>>
>>
>>

-- 
The topics of this mailing list include TopBraid EDG and related technologies 
such as SHACL.
To post to this group, send email to [email protected]
--- 
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/812a4171-ebc7-4874-9fc6-90e74c46cae4n%40googlegroups.com.

Reply via email to