Sheet2Rdf : conditional skos:topConceptOf

30 views
Skip to first unread message

Thomas Francart

unread,
Mar 31, 2025, 11:35:22 AMMar 31
to vocbench-user
Hello

I am trying to import a table in Sheet2Rdf using the following 2-columns structure:

```
label ; parent
agent ;
person ; agent
organization ; agent
document ;
report ; document
web page ; document
```

As you can see, it defines a hierarchy, with some entries being top concepts, the ones where the "parent" column is empty.
I can successfully assign URI and resolve the parent to the assigned URI using Random ID Converter + memoize.

What I would like to do next is to assign a skos:topConceptOf predicate to those lines where the parent is empty. I found the doc for conditional mappings here https://art.uniroma2.it/coda/documentation/pearl.jsf#conditions_for_rule_triggering, however I can't get this to work. I tried this:

```
rule it.uniroma2.art.Sheet2RDFAnnotation id:row {
  // Here : base rules coming from mapping wizard
}

rule it.uniroma2.art.Sheet2RDFAnnotation id:row_root {
   // here : attempt to insert a condition for when the parent column is empty
   conditions = {
     col_1/value IN [""] .
   }
   nodes = {
     @Memoized(product_name)
     subject uri(coda:randIdGen('concept')) col_0/value .
    }
    graph = {
     $subject skos:topConceptOf <http://example.org> .
    }
}
```

I am getting the following exception:

java.lang.NullPointerException: Cannot invoke "java.util.List.size()" because "listOfStringOrFeat" is null at it.uniroma2.art.coda.pearl.model.ConditionStruct.evaluteCondition(ConditionStruct.java:56) at it.uniroma2.art.coda.pearl.model.ProjectionRule.evaluateConditions(ProjectionRule.java:227) at it.uniroma2.art.coda.core.CODACore.processNextAnnotation(CODACore.java:890) at it.uniroma2.art.coda.core.CODACore.processNextAnnotation(CODACore.java:789) at it.uniroma2.art.sheet2rdf.coda.Sheet2RDFCODA.suggestTriples(Sheet2RDFCODA.java:42)


Am I on the right track or is there another way to approach this need for conditional assignment of a triple ? (I would like to avoid SPARQL update query after the import)

Many thanks
Thomas


--

Thomas Francart - SPARNA
linked data | domain ontologies | knowledge graphs
blog :
blog.sparna.fr, site : sparna.fr, linkedin : fr.linkedin.com/in/thomasfrancart
tel : 
 +33 (0)6.71.11.25.97

stel...@uniroma2.it

unread,
Mar 31, 2025, 1:13:52 PMMar 31
to Thomas Francart, vocbench-user

Dear Thomas,

 

thanks for reporting this. Before we delve more into this, I’ve an educated guess: the value in the feature structure is not even created because an empty cell is not read as a “” (which makes sense, as we shouldn’t then create values by transforming empty strings).

So, since you already have the data at hand, can I kindly ask you to check it by testing the value for, say, “agent” and seeing if this is applied to those rows with value “agent” on the second column

If confirmed:

  1. Well, for you it suffices (I know, not ideal, but will do the job) to replace the empty cell with a reserved word (say, “empty” :-D )
  2. For us, it’s definitely a needed improvement, e.g. IS EMPTY (the conditional part is indeed very simple and there are broad margins for improvement)

 

Cheers,

 

Armando

 

--
You received this message because you are subscribed to the Google Groups "vocbench-user" group.
To unsubscribe from this group and stop receiving emails from it, send an email to vocbench-use...@googlegroups.com.
To view this discussion visit https://groups.google.com/d/msgid/vocbench-user/CAPugn7X5kAMFzL1u2353tx9YZQfPtLEHvyWs9VW_VQVkzZXWhA%40mail.gmail.com.

Thomas Francart

unread,
Mar 31, 2025, 3:14:11 PMMar 31
to stel...@uniroma2.it, vocbench-user
Dear Armando

Thank you for your answer. Yes, I can definitely set empty cells to a default value. I tried, and it worked fine on the minimalistic example I provided, but not on my real file. I got a different "NullPointerException". I will investigate to understand why, I suspect there may still be some empty cells somewhere that cause the issue.

Kind Regards
Thomas

Reply all
Reply to author
Forward
0 new messages