kbss-cvut / aircraft-maintenance-planning-system

D2020+ project about Aircraft Mainenance Planning System.
GNU Lesser General Public License v3.0
0 stars 0 forks source link

Some finding individuals have multiple :WO-text properties #220

Open kostobog opened 1 year ago

kostobog commented 1 year ago

Examples findings:

The issue is most likely due to how the text-analysis script works and how it was executed. If we use the script to compute it on only unprocessed findings, the problem should not manifest. If we want to recompute all findings that this problem occurs and it is due to change in annotated text. The annotated text looks like this:

<span about="_:27b1-0" property="ddo:je-výskytem-termu" ...

_:27b1-0 is, however blank node that will change when we execute text analysis again. To fix this, we would have to normalize all the blank nodes in those texts, e.g., by replacing it with :1, :2, _:3 ... and thus the output of script enhance-wo-text idempotent.

A/C:

kostobog commented 1 year ago

Use this query to find inconsistent :WO_text values :

# find findings with multiple :WO_text values
PREFIX cm: <http://onto.fel.cvut.cz/ontologies/csat-maintenance/>
PREFIX : <http://onto.fel.cvut.cz/ontologies/csat/enhance-wo-text-0.1/>

SELECT ?finding (COUNT(*) as ?c) (SAMPLE(?annotatedTextVersion) as ?annotatedText) {

    ?finding a cm:finding-individual .
    ?finding :WO_text ?annotatedTextVersion .

} 
GROUP BY ?finding
HAVING (?c > 1)
ORDER BY DESC(?c)

Use this query to remove extra :WO_text values :

# remove extra :WO_text values
PREFIX cm: <http://onto.fel.cvut.cz/ontologies/csat-maintenance/>
PREFIX : <http://onto.fel.cvut.cz/ontologies/csat/enhance-wo-text-0.1/>

DELETE{
    GRAPH <http://onto.fel.cvut.cz/ontologies/csat/enhance-wo-text-0.1-annotated-data> {
        ?finding :WO_text ?annotatedTextVersion2 .
    }
}INSERT{} 
WHERE {
    GRAPH <http://onto.fel.cvut.cz/ontologies/csat/enhance-wo-text-0.1-annotated-data> {
        ?finding a cm:finding-individual .
        ?finding :WO_text ?annotatedTextVersion1 .
        ?finding :WO_text ?annotatedTextVersion2 .
        FILTER(?annotatedTextVersion1 != ?annotatedTextVersion2)
    }
}