Re: [topbraid-users] Value must be an instance of skos:Concept

2024-11-18 Thread Holger Knublauch


> On 18 Nov 2024, at 11:55 AM, 'Luis Enrique Ramos García' via TopBraid Suite 
> Users  wrote:
> 
> 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?,

Not sure I understand the question. If you want to automate it, surely a script 
is the answer. If you don't need to automate it and the spreadsheet importers 
can handle everything, just use the latter.

Holger



> 
> Luis
> 
> 
> 
> 
> 
> 
> 
> 
> 
> 
> 
> El lun, 18 nov 2024 a las 11:41, Holger Knublauch ( >) 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 >> > 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  /'+ 
>>> row['id'],
>>> notation: row.id 
>>> })
>>>  //adding the current row to a taxon
>>> //concept.topConceptOf= graph.namedNode(' http:sampleuri.com/ 
>>> 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/ 
>>> /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/ 
>>> /1.17.03. 
>>> '+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 (>> >) 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

Re: [topbraid-users] Value must be an instance of skos:Concept

2024-11-18 Thread 'Luis Enrique Ramos García' via TopBraid Suite Users
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  * /'+
row['id'],
notation: row.id
})
 //adding the current row to a taxon
//concept.topConceptOf= graph.namedNode(' *http:sampleuri.com/
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/
*/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/ */
1.17.03.'+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 ()
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  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  Suggestion: Set
> type of  http:sampleuri.com/id  to Concept*
>
> However, in the output of statements  I get:
>
> 
>  * a skos:Concept ;*
>   skos:broader  ;
>
> 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
> 
> .
>
>
> --
> 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

Re: [topbraid-users] Value must be an instance of skos:Concept

2024-11-18 Thread 'Luis Enrique Ramos García' via TopBraid Suite Users
 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 ()
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  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  * /'+
> row['id'],
> notation: row.id
> })
>  //adding the current row to a taxon
> //concept.topConceptOf= graph.namedNode(' *http:sampleuri.com/
> 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/
> */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/ *
> /1.17.03. '+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 ()
> 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  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  Suggestion: Set
>> type of  http:sampleuri.com/id  to Concept*
>>
>> However, in the output of statements  I get:
>>
>> 
>>  * a skos:Concept ;*
>>   skos:broader  ;
>>
>> 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({
>>

Re: [topbraid-users] Value must be an instance of skos:Concept

2024-11-18 Thread Holger Knublauch
The spreadsheet mapping (with multiple languages) should work better with the 
newly implemented spreadsheet integration

https://www.topquadrant.com/doc/latest/user_guide/sheets/index.html

but meanwhile it looks like you'll need an ADS script as it has more 
flexibility.

(I am not sure where this email thread leaves us, as I don't see how to help 
further and help with specific implementation tasks goes beyond what we can 
cover here)

Holger


> On 18 Nov 2024, at 1:50 PM, 'Luis Enrique Ramos García' via TopBraid Suite 
> Users  wrote:
> 
> Well, let me elaborate it a little more.
> 
> First, regarding your comment: Maybe some of them don't have rdf:type 
> skos:Concept.
> 
> There are more than 200 elements in the spreadsheet I am working on, and all 
> of them present the same message.
> 
> Anyway, attached you will find a spreadsheet similar to my usecase.
> 
> I tried to upload a spreadsheet similar to this, but my first issue was that 
> I could not upload the definition in both languages.
> The importer tool did not provide a language tag, while the label did.
> 
> The second point I want to have is the uri including the id, like : 
> http:sampleuri.com /2.0.1
> 
> Finally, I want to reproduce the hierarchical structure from the spreadsheet 
> into my taxonomy:
> 
> 
> Of course, in the real use case I have more that 1000 elements, so my 
> requirement is to automate as many as possible.
> 
> Hope this very clarify the issues I am facing , and the requirement
> 
> 
> Best regards
> 
> 
> 
> Luis Ramos
> 
> 
> 
> 
> 
> 
> 
> 
> 
> El lun, 18 nov 2024 a las 12:00, Holger Knublauch ( >) escribió:
>> 
>> 
>>> On 18 Nov 2024, at 11:55 AM, 'Luis Enrique Ramos García' via TopBraid Suite 
>>> Users >> > wrote:
>>> 
>>> 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?,
>> 
>> Not sure I understand the question. If you want to automate it, surely a 
>> script is the answer. If you don't need to automate it and the spreadsheet 
>> importers can handle everything, just use the latter.
>> 
>> Holger
>> 
>> 
>> 
>>> 
>>> Luis
>>> 
>>> 
>>> 
>>> 
>>> 
>>> 
>>> 
>>> 
>>> 
>>> 
>>> 
>>> El lun, 18 nov 2024 a las 11:41, Holger Knublauch (>> >) 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  > 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  /'+ 
> row['id'],
> notation: row.id 
> })
>  //adding the current row to a taxon
> //concept.topConceptOf= graph.namedNode(' http:sampleuri.com/ 
> 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;
>   }
> }
> 
> 
> 
> 

Re: [topbraid-users] Value must be an instance of skos:Concept

2024-11-18 Thread Holger Knublauch
>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  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  
> Suggestion: Set type of  http:sampleuri.com/id  to 
> Concept
> 
> However, in the output of statements  I get:
> 
> http://sampleuri.com/id>>
>   a skos:Concept ;
>   skos:broader  > ;
> 
> 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
>  
> .

-- 
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.


Re: [topbraid-users] Value must be an instance of skos:Concept

2024-11-18 Thread 'Luis Enrique Ramos García' via TopBraid Suite Users
Well, let me elaborate it a little more.

First, regarding your comment: Maybe some of them don't have rdf:type
skos:Concept.

There are more than 200 elements in the spreadsheet I am working on, and
all of them present the same message.

Anyway, attached you will find a spreadsheet similar to my usecase.

I tried to upload a spreadsheet similar to this, but my first issue was
that I could not upload the definition in both languages.
The importer tool did not provide a language tag, while the label did.

The second point I want to have is the uri including the id, like :
*http:sampleuri.com /2.0.1 *

Finally, I want to reproduce the hierarchical structure from the
spreadsheet into my taxonomy:
[image: image.png]

Of course, in the real use case I have more that 1000 elements, so my
requirement is to automate as many as possible.

Hope this very clarify the issues I am facing , and the requirement


Best regards



Luis Ramos









El lun, 18 nov 2024 a las 12:00, Holger Knublauch ()
escribió:

>
>
> On 18 Nov 2024, at 11:55 AM, 'Luis Enrique Ramos García' via TopBraid
> Suite Users  wrote:
>
> 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?,
>
>
> Not sure I understand the question. If you want to automate it, surely a
> script is the answer. If you don't need to automate it and the spreadsheet
> importers can handle everything, just use the latter.
>
> Holger
>
>
>
>
> Luis
>
>
>
>
>
>
>
>
>
>
>
> El lun, 18 nov 2024 a las 11:41, Holger Knublauch ()
> 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  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  *
>> /'+ row['id'],
>> notation: row.id
>> })
>>  //adding the current row to a taxon
>> //concept.topConceptOf= graph.namedNode(' *http:sampleuri.com/
>> 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/
>> */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/
>> */1.17.03. 
>> '+idArray[3]+'.'+idArray[4]+'.00'
>> my_concept.broader =  graph.namedNode(broaded_id)
>> }
>> }//elnd else 

Re: [topbraid-users] Value must be an instance of skos:Concept

2024-11-18 Thread 'Luis Enrique Ramos García' via TopBraid Suite Users
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.1








El lun, 18 nov 2024 a las 11:41, Holger Knublauch ()
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  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  * /'+
> row['id'],
> notation: row.id
> })
>  //adding the current row to a taxon
> //concept.topConceptOf= graph.namedNode(' *http:sampleuri.com/
> 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/
> */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/ *
> /1.17.03. '+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 ()
> 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  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  Suggestion: Set
>> type of  http:sampleuri.com/id  to Concept*
>>
>> However, in the output of statements  I get:
>>
>> 
>>  * a skos:Concept ;*
>>   skos:broader  ;
>>
>> 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 regard

Re: [topbraid-users] Value must be an instance of skos:Concept

2024-11-18 Thread Holger Knublauch
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  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  /'+ 
> row['id'],
> notation: row.id 
> })
>  //adding the current row to a taxon
> //concept.topConceptOf= graph.namedNode(' http:sampleuri.com/ 
> 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/ 
> /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/ 
> /1.17.03. 
> '+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 ( >) 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 >> > 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  
>>> Suggestion: Set type of  http:sampleuri.com/id  to 
>>> Concept
>>> 
>>> However, in the output of statements  I get:
>>> 
>>> http://sampleuri.com/id>>
>>>   a skos:Concept ;
>>>   skos:broader >> > ;
>>> 
>>> 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
>>> 
>>> 
>>> 
>>> -- 
>>>