possible, let me check.

But, I would like to try another way.

The usecase I have is that I want to upload concepts that are organized in
categorized ids, e.g 1.0.0, 1.1.0, 1.0.2, 1.1.1, 1.1.2. (spreadsheet).

Thus, I want to reproduce it in my tree so:

1.1.0
   1.1.1
   1.1.2

which should be the best way to do it?

script or importing spreadsheet?,

Luis











El lun, 18 nov 2024 a las 11:41, Holger Knublauch (<hol...@topquadrant.com>)
escribió:

> Ok thanks. When you run this in Preview mode from the Script Editor panel,
> can you see which resources are changed?
>
> The system will perform constraint validation on those changed resources.
> Maybe some of them don't have rdf:type skos:Concept.
>
> Holger
>
>
> On 18 Nov 2024, at 11:38 AM, 'Luis Enrique Ramos García' via TopBraid
> Suite Users <topbraid-users@googlegroups.com> wrote:
>
> sure:
>
> let s = IO.uploadedFile(file).asSpreadsheet();
> machine_prefix_en= 'Machine for '
> machine_prefix_de= 'Maschine für '
>
>
> s.rows().forEach(row =>{
>         let concept = skos.createConcept({
>             uri: ' *http:sampleuri.com/id <http://sampleuri.com/id> * /'+
> row['id'],
>             notation: row.id
>         })
>          //adding the current row to a taxon
>         //concept.topConceptOf= graph.namedNode(' *http:sampleuri.com/
> <http://sampleuri.com/id>conceptschema1*')
>
>         graph.addTriples
>
>         try{
>             prefLabelwithLang(concept,machine_prefix_en+row['label
> en'],'en')
>             prefLabelwithLang(concept,machine_prefix_de+row['label
> de'],'de')
>             let conceptLangEn =    graph.langString(row['concept en'],'en')
>             concept.add(skos.definition, conceptLangEn);
>             let conceptLangDe =    graph.langString(row['concept de'],'de')
>             concept.add(skos.definition, conceptLangDe);
>             //first level of clasification
>             firstLevelTaxon(concept, row['id'])
>         }
>         catch{
>             console.log()
>         }
>     }//end row
> )//end forEach
>
> //working with german
>
>
> function splitStringAtParentheses(input) {
>   // Use a regular expression to match the content between parentheses
>   const match = input.match(/^(.*?)\s*\(([^)]+)\)$/);
>
>   // If a match is found, return an array with both parts, otherwise
> return null
>   if (match) {
>     return [match[1].trim(), match[2].trim()];
>   } else {
>     return null;
>   }
> }
>
>
>
> function prefLabelwithLang(my_concept,my_label,my_lang){
>     let prefLabelLang =    graph.langString(my_label,my_lang)
>     my_concept.add(skos.prefLabel, prefLabelLang);
> }
>
> function altLabelwithLang(my_concept,my_label,my_lang){
>     let altLabelLang =    graph.langString(my_label,my_lang)
>     my_concept.add(skos.altLabel, altLabelLang);
> }
>
> function firstLevelTaxon(my_concept, id){
>     const taxonLevel1
> =["1.17.03.01.00.00","1.17.03.02.00.00","1.17.03.03.00.00","1.17.03.04.00.00","1.17.03.05.00.00","1.17.03.06.00.00"]
>     if (taxonLevel1.includes(id)){
>         my_concept.broader =  graph.namedNode(' *http:sampleuri.com/
> <http://sampleuri.com/id>*/1.17.03.00.00.00')
>     }//if not first level
>
>     else{
>         const idArray = id.split(".");
>         //evaluating the taxon
>         if (idArray[-1] !== '00'){
>             broaded_id = ' *http:sampleuri.com/ <http://sampleuri.com/id>*
> /1.17.03. <http://1.17.0.3/>'+idArray[3]+'.'+idArray[4]+'.00'
>             my_concept.broader =  graph.namedNode(broaded_id)
>         }
>     }//elnd else first level
>
>     //console.log()
> }//firstLevelTaxon
>
> function prefLabelwithLang(my_concept,my_label,my_lang){
>     let prefLabelLang =    graph.langString(my_label,my_lang)
>     my_concept.add(skos.prefLabel, prefLabelLang);
> }
>
> function altLabelwithLang(my_concept,my_label,my_lang){
>     let altLabelLang =    graph.langString(my_label,my_lang)
>     my_concept.add(skos.altLabel, altLabelLang);
> }
>
> El lun, 18 nov 2024 a las 11:34, Holger Knublauch (<hol...@topquadrant.com>)
> escribió:
>
>> From the information provided I don't see anything wrong. But there may
>> be other steps in your script. For example, you may change other resources
>> that are not correctly typed and thus the sh:class constraint fails.
>>
>> Could you paste the whole script?
>>
>> Holger
>>
>>
>> On 18 Nov 2024, at 11:07 AM, 'Luis Enrique Ramos García' via TopBraid
>> Suite Users <topbraid-users@googlegroups.com> wrote:
>>
>> Dear All,
>>
>> I am receiving this error message in the execution of an script:
>>
>>
>> * Value must be an instance of skos:Concept *
>>
>>
>> *Value: http:sampleuri.com/id <http://sampleuri.com/id> Suggestion: Set
>> type of  http:sampleuri.com/id <http://sampleuri.com/id> to Concept*
>>
>> However, in the output of statements  I get:
>>
>> <http:sampleuri.com/id>
>>  * a skos:Concept ;*
>>   skos:broader <http:sampleuri.com/anotherid> ;
>>
>> Where I can see that http:sampleuri.com/id is a skos:Concept,
>>
>> thus I wonder why I am recieving this message?.
>>
>> this is the part of the script I use to create the concepts:
>>
>>
>> let concept = skos.createConcept({
>>             uri: 'http:sampleuri.com/'+ row['id'],
>>             notation: row.id
>>         })
>>
>> Best regards
>>
>>
>> Luis Ramos
>>
>>
>>
>> --
>> The topics of this mailing list include TopBraid EDG and related
>> technologies such as SHACL.
>> To post to this group, send email to topbraid-users@googlegroups.com
>> ---
>> 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-users+unsubscr...@googlegroups.com.
>> To view this discussion visit
>> https://groups.google.com/d/msgid/topbraid-users/CABy94XnQXBo2R-sO3m0GeNpwRt%3DAGOYvnKV7g3ADP0yT0YNDBw%40mail.gmail.com
>> <https://groups.google.com/d/msgid/topbraid-users/CABy94XnQXBo2R-sO3m0GeNpwRt%3DAGOYvnKV7g3ADP0yT0YNDBw%40mail.gmail.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 topbraid-users@googlegroups.com
>> ---
>> 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-users+unsubscr...@googlegroups.com.
>> To view this discussion visit
>> https://groups.google.com/d/msgid/topbraid-users/D7B7795B-7520-4873-849B-DB56665B02F1%40topquadrant.com
>> <https://groups.google.com/d/msgid/topbraid-users/D7B7795B-7520-4873-849B-DB56665B02F1%40topquadrant.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 topbraid-users@googlegroups.com
> ---
> 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-users+unsubscr...@googlegroups.com.
> To view this discussion visit
> https://groups.google.com/d/msgid/topbraid-users/CABy94X%3DoAyfyG7dJRx%3DU60t4bhYzJvPM8A2BD6WgF1jQ%2B1iDtw%40mail.gmail.com
> <https://groups.google.com/d/msgid/topbraid-users/CABy94X%3DoAyfyG7dJRx%3DU60t4bhYzJvPM8A2BD6WgF1jQ%2B1iDtw%40mail.gmail.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 topbraid-users@googlegroups.com
> ---
> 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-users+unsubscr...@googlegroups.com.
> To view this discussion visit
> https://groups.google.com/d/msgid/topbraid-users/EA55FD78-9FC8-4E72-A54F-657843358E45%40topquadrant.com
> <https://groups.google.com/d/msgid/topbraid-users/EA55FD78-9FC8-4E72-A54F-657843358E45%40topquadrant.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 topbraid-users@googlegroups.com
--- 
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-users+unsubscr...@googlegroups.com.
To view this discussion visit 
https://groups.google.com/d/msgid/topbraid-users/CABy94XmMfki8Fu0xCey-NCKvoFHfpzZB7t0fCHvZX3aegsgAOQ%40mail.gmail.com.
  • [topbraid-users] Val... 'Luis Enrique Ramos García' via TopBraid Suite Users
    • Re: [topbraid-u... Holger Knublauch
      • Re: [topbra... 'Luis Enrique Ramos García' via TopBraid Suite Users
        • Re: [to... Holger Knublauch
          • Re:... 'Luis Enrique Ramos García' via TopBraid Suite Users
          • Re:... 'Luis Enrique Ramos García' via TopBraid Suite Users
            • ... Holger Knublauch
              • ... 'Luis Enrique Ramos García' via TopBraid Suite Users
                • ... Holger Knublauch

Reply via email to