Skip to content

Commit

Permalink
Merge branch 'main' into feature/4472-Better-built-in-layer-selection
Browse files Browse the repository at this point in the history
* main:
  [maven-release-plugin] prepare for next development iteration
  [maven-release-plugin] prepare release inception-30.4
  #4379 - Suppress or mark concepts in the search that are marked as owl:deprecated
  #4484 - Error marker on annotations with required concept feature is missing
  #4480 - Show validation problems in annotation sidebar and Apache Annotator editor
  #4482 - Error when fetching state of background tasks from UI
  #4478 - Some external editor configuration properties cannot be configured
  • Loading branch information
reckart committed Jan 30, 2024
2 parents 17ffa7e + 0557a1b commit 660dd31
Show file tree
Hide file tree
Showing 24 changed files with 217 additions and 84 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -195,6 +195,11 @@ public String getLanguage()
return handle.getLanguage();
}

public boolean isDeprecated()
{
return handle.isDeprecated();
}

@SuppressWarnings("unchecked")
public <T> Optional<T> get(Key<T> aKey)
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -112,14 +112,23 @@ public void thatTrainingWorks() throws Exception
@Test
public void thatPredictionWorks() throws Exception
{
List<KBHandle> mockResult = asList(
new KBHandle("https://www.wikidata.org/wiki/Q76", "Barack Obama",
"44th President of the United States of America"),
new KBHandle("https://www.wikidata.org/wiki/Q26446735", "Obama",
"Japanese Family Name"),
new KBHandle("https://www.wikidata.org/wiki/Q18355807", "Obama", "genus of worms"),
new KBHandle("https://www.wikidata.org/wiki/Q41773", "Obama",
"city in Fukui prefecture, Japan"));
var mockResult = asList(
KBHandle.builder().withIdentifier("https://www.wikidata.org/wiki/Q76") //
.withName("Barack Obama") //
.withDescription("44th President of the United States of America") //
.build(),
KBHandle.builder().withIdentifier("https://www.wikidata.org/wiki/Q26446735") //
.withName("Obama") //
.withDescription("Japanese Family Name") //
.build(),
KBHandle.builder().withIdentifier("https://www.wikidata.org/wiki/Q18355807") //
.withName("Obama") //
.withDescription("genus of worms") //
.build(),
KBHandle.builder().withIdentifier("https://www.wikidata.org/wiki/Q41773") //
.withName("Obama") //
.withDescription("city in Fukui prefecture, Japan") //
.build());

KnowledgeBaseService kbService = mock(KnowledgeBaseService.class);
KnowledgeBase kb = new KnowledgeBase();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,8 @@
$: backgroundColor = annotation.color || "var(--bs-secondary)";
$: textColor = bgToFgColor(backgroundColor);
$: hasError = annotation.comments?.find(comment => comment.type === 'error')
$: hasInfo = annotation.comments?.find(comment => comment.type === 'info')
function handleSelect(ev: MouseEvent) {
ajaxClient.selectAnnotation(annotation.vid, { scrollTo: true });
Expand Down Expand Up @@ -97,7 +99,13 @@
{/if}
</button>
{:else}
<div class="btn-group mb-0 ms-1 bg-body" role="group">
<div class="input-group mb-0 ms-1 bg-body" role="group">
{#if hasError || hasInfo}
<span class="input-group-text py-0 px-1">
{#if hasError}<i class="fas fa-exclamation-circle" style="color: var(--i7n-error-color)"></i>{/if}
{#if hasInfo}<i class="fas fa-exclamation-circle" style="color: var(--i7n-info-color)"></i>{/if}
</span>
{/if}
<button
type="button"
class="btn-select btn btn-colored btn-sm py-0 px-1 border-dark"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -54,13 +54,13 @@ html > body {
border-right-width: 0px;

&.iaa-first-highlight {
padding-left: 5px;
margin-left: var(--border-width)
border-top-left-radius: 0.25em;
border-bottom-left-radius: 0.25em;
}

&.iaa-last-highlight {
padding-right: 5px;
margin-right: var(--border-width)
border-top-right-radius: 0.25em;
border-bottom-right-radius: 0.25em;
}

&.iaa-zero-width {
Expand All @@ -76,6 +76,8 @@ html > body {
border-style: solid;

&.iaa-first-highlight {
padding-left: 5px;
margin-left: var(--border-width);
border-top-left-radius: 0.5em;
border-bottom-left-radius: 0.5em;
border-left-width: var(--border-width);
Expand All @@ -98,6 +100,7 @@ html > body {
margin-right: 5px;
border-top-left-radius: 0.5em;
border-bottom-left-radius: 0.5em;
color: var(--iaa-color);
background-color: var(--iaa-border-color);
}

Expand All @@ -107,6 +110,8 @@ html > body {
}

&.iaa-last-highlight {
padding-right: 5px;
margin-right: var(--border-width);
border-top-right-radius: 0.5em;
border-bottom-right-radius: 0.5em;
border-right-width: var(--border-width);
Expand All @@ -127,6 +132,11 @@ html > body {
background: rgba(255, 165, 0, 0);
}
}

.iaa-error-marker {
filter: drop-shadow(0 0 clamp(3px, 0.3em, 10px) var(--i7n-error-color)) brightness(var(--hover-brightness));
}

.iaa-ping-marker {
background: rgba(255, 165, 0, 0);
animation: iaa-ping-fade-animation 0.3s ease-in-out .2s 3 normal forwards;
Expand Down Expand Up @@ -190,47 +200,26 @@ html > body {
&.iaa-first-highlight {
border-left-style: solid;
border-left-color: var(--i7n-focus-bounds-color) !important;
border-left-width: calc(2 * var(--border-width)) !important;
}

&.iaa-last-highlight {
border-right-style: solid;
border-right-color: var(--i7n-focus-bounds-color) !important;
border-right-width: calc(2 * var(--border-width)) !important;
}

&:not(.iaa-inline-label) {
filter: drop-shadow(0 0 clamp(3px, 0.3em, 10px) var(--i7n-focus-color)) brightness(var(--hover-brightness));

&.iaa-first-highlight {
margin-left: calc(0px - var(--border-width)) !important;
}

&.iaa-last-highlight {
margin-right: calc(0px - var(--border-width)) !important;
}
}

&.iaa-inline-label {
border-color: var(--i7n-focus-color);
filter: drop-shadow(0 0 clamp(3px, 0.3em, 10px) var(--i7n-focus-color)) brightness(var(--hover-brightness));

&.iaa-first-highlight {

&:not(.iaa-marker-focus) {
margin-left: 0px;
}

&:before {
background-color: var(--i7n-focus-color)t;
}
}

&.iaa-last-highlight {
&:not(.iaa-marker-focus) {
margin-right: 0px;
}
}
}
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,10 +21,13 @@ import { CompactAnnotatedText } from '@inception-project/inception-js-api/src/mo
import { highlightText } from '@apache-annotator/dom'
import { showEmptyHighlights, showLabels } from './ApacheAnnotatorState'
import { ResizeManager } from './ResizeManager'
import { bgToFgColor } from '@inception-project/inception-js-api/src/util/Coloring'

export const CLASS_RELATED = 'iaa-related'

export const NO_LABEL = '◌'
export const ERROR_LABEL = '🔴'
export const INFO_LABEL = 'ℹ️'

export class ApacheAnnotatorVisualizer {
private ajax: DiamAjax
Expand Down Expand Up @@ -305,14 +308,31 @@ export class ApacheAnnotatorVisualizer {

if (begin === end) classList.push('iaa-zero-width')

var decorations = ''

const hasError = span.comments?.find(comment => comment.type === 'error')
if (hasError) {
classList.push('iaa-error-marker')
decorations += ERROR_LABEL
}

const hasInfo = span.comments?.find(comment => comment.type === 'info')
if (hasInfo) {
classList.push('iaa-info-marker')
decorations += INFO_LABEL
}

const styleList = [
`--iaa-color: ${bgToFgColor(span.color || '#000000')}`,
`--iaa-background-color: ${span.color || '#000000'}${this.alpha}`,
`--iaa-border-color: ${span.color || '#000000'}`
]

decorations += ' '

const attributes = {
'data-iaa-id': `${span.vid}`,
'data-iaa-label': `${span.label || `[${span.layer.name}]` || NO_LABEL}`,
'data-iaa-label': `${decorations}${span.label || `[${span.layer.name}]` || NO_LABEL}`,
class: classList.join(' '),
style: styleList.join('; ')
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@
* limitations under the License.
*/
$i7n-focus-color: rgba(255,165,0);
$i7n-focus-bounds-color: rgb(255, 106, 0);
$i7n-focus-bounds-color: rgba(255, 106, 0, 0.7);
$i7n-match-focus-color: rgb(0, 217, 255);
$i7n-error-color: rgb(255, 0, 0);

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -696,7 +696,8 @@ public Optional<KBConcept> readConcept(KnowledgeBase aKB, String aIdentifier, bo
.withIdentifier(aIdentifier) //
.excludeInferred() //
.retrieveLabel() //
.retrieveDescription();
.retrieveDescription() //
.retrieveDeprecation();

Optional<KBHandle> result;
if (aKB.isReadOnly()) {
Expand Down Expand Up @@ -750,6 +751,7 @@ public List<KBHandle> listAllConcepts(KnowledgeBase aKB, boolean aAll)
var query = SPARQLQueryBuilder.forClasses(aKB) //
.retrieveLabel() //
.retrieveDescription() //
.retrieveDeprecation() //
.excludeInferred();

List<KBHandle> result;
Expand Down Expand Up @@ -786,7 +788,7 @@ public Optional<KBProperty> readProperty(KnowledgeBase aKB, String aIdentifier)
.withIdentifier(aIdentifier) //
.retrieveDescription() //
.retrieveLabel() //
.retrieveDomainAndRange() //
.retrieveDeprecation().retrieveDomainAndRange() //
.excludeInferred();

Optional<KBHandle> result;
Expand Down Expand Up @@ -835,6 +837,7 @@ public List<KBHandle> listProperties(KnowledgeBase aKB, boolean aIncludeInferred
var query = SPARQLQueryBuilder.forProperties(aKB) //
.retrieveLabel() //
.retrieveDescription() //
.retrieveDeprecation() //
.retrieveDomainAndRange() //
.includeInferred(aIncludeInferred);

Expand Down Expand Up @@ -873,7 +876,7 @@ public Optional<KBInstance> readInstance(KnowledgeBase aKB, String aIdentifier)
.withIdentifier(aIdentifier) //
.retrieveDescription() //
.retrieveLabel() //
.excludeInferred();
.retrieveDeprecation().excludeInferred();

Optional<KBHandle> result;
if (aKB.isReadOnly()) {
Expand Down Expand Up @@ -926,7 +929,8 @@ public List<KBHandle> listInstances(KnowledgeBase aKB, String aConceptIri, boole
var query = SPARQLQueryBuilder.forInstances(aKB) //
.childrenOf(aConceptIri) //
.retrieveLabel() //
.retrieveDescription();
.retrieveDescription() //
.retrieveDeprecation();

List<KBHandle> result;
if (aKB.isReadOnly()) {
Expand Down Expand Up @@ -1034,6 +1038,7 @@ public List<KBProperty> listDomainProperties(KnowledgeBase aKB, String aDomain,
.matchingDomain(aDomain) //
.retrieveLabel() //
.retrieveDescription() //
.retrieveDeprecation() //
.retrieveDomainAndRange() //
.includeInferred(aIncludeInferred);

Expand All @@ -1056,7 +1061,8 @@ public List<KBHandle> listRootConcepts(KnowledgeBase aKB, boolean aAll)
{
try (var watch = new StopWatch(LOG, "listRootConcepts()")) {
var query = SPARQLQueryBuilder.forClasses(aKB).roots().retrieveLabel()
.retrieveDescription();
.retrieveDescription() //
.retrieveDeprecation();

List<KBHandle> result;
if (aKB.isReadOnly()) {
Expand Down Expand Up @@ -1095,7 +1101,8 @@ public List<KBHandle> getConceptForInstance(KnowledgeBase aKB, String aIdentifie
var query = SPARQLQueryBuilder.forClasses(aKB) //
.parentsOf(aIdentifier) //
.retrieveLabel() //
.retrieveDescription();
.retrieveDescription() //
.retrieveDeprecation();

List<KBHandle> result;
if (aKB.isReadOnly()) {
Expand All @@ -1117,7 +1124,8 @@ public List<KBHandle> getParentConceptList(KnowledgeBase aKB, String aIdentifier
var query = SPARQLQueryBuilder.forClasses(aKB) //
.ancestorsOf(aIdentifier) //
.retrieveLabel() //
.retrieveDescription();
.retrieveDescription() //
.retrieveDeprecation();

List<KBHandle> result;
if (aKB.isReadOnly()) {
Expand All @@ -1141,6 +1149,7 @@ public List<KBHandle> listChildConcepts(KnowledgeBase aKB, String aParentIdentif
.childrenOf(aParentIdentifier) //
.retrieveLabel() //
.retrieveDescription() //
.retrieveDeprecation() //
.limit(aLimit);

List<KBHandle> result;
Expand Down Expand Up @@ -1264,7 +1273,8 @@ public Optional<KBHandle> readHandle(KnowledgeBase aKB, String aIdentifier)
var query = SPARQLQueryBuilder.forItems(aKB) //
.withIdentifier(aIdentifier) //
.retrieveLabel() //
.retrieveDescription();
.retrieveDescription() //
.retrieveDeprecation();

Optional<KBHandle> result;
if (aKB.isReadOnly()) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,7 @@ public class KBConcept
private String identifier;
private String name;
private String description;
private boolean deprecated;
private KnowledgeBase kb;
private String language;

Expand Down Expand Up @@ -166,6 +167,17 @@ public void setDescription(String aDescription)
description = aDescription;
}

public void setDeprecated(boolean aDeprecated)
{
deprecated = aDeprecated;
}

@Override
public boolean isDeprecated()
{
return deprecated;
}

@Override
public String getLanguage()
{
Expand Down
Loading

0 comments on commit 660dd31

Please sign in to comment.