Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merge from dev #646

Merged
merged 23 commits into from
Apr 16, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
23 commits
Select commit Hold shift + click to select a range
d6ca385
Fix missing class on qualified restrictions (#566)
jamesamcl Nov 15, 2023
065a0ed
Update issue templates
henrietteharmse Feb 12, 2024
c2b3560
Update issue templates
henrietteharmse Feb 12, 2024
ad47ca2
- Update build widget script
haideriqbal Mar 7, 2024
3428131
- Add README.md
haideriqbal Mar 7, 2024
1d8d286
- Update package version
haideriqbal Mar 7, 2024
3d48584
- Update README.md
haideriqbal Mar 11, 2024
b36c2ae
Add routing support for ebi-lookup service (#631)
haideriqbal Mar 12, 2024
86c5262
Add biolink (#632)
jamesamcl Mar 13, 2024
37256e2
Merge pull request #630 from EBISPOT/feature/update-ols-widget-config
henrietteharmse Mar 18, 2024
34b819d
Merge pull request #577 from EBISPOT/issue-566
henrietteharmse Mar 20, 2024
5cff727
Owl2 completeness (#635)
henrietteharmse Mar 25, 2024
108d0e0
Add DCAT
jamesamcl Mar 28, 2024
4804871
Testcases for stackoverflow and nesting issue introduced by https://g…
henrietteharmse Apr 2, 2024
2561298
Recognise datatype leaf nodes to fix stackoverflow.
henrietteharmse Apr 2, 2024
fa543bf
Merge pull request #637 from EBISPOT/nesting-issue
henrietteharmse Apr 3, 2024
817ab85
Changed check for leaf node to just check for any builtin XML data type.
henrietteharmse Apr 3, 2024
54fbdbb
Merge pull request #638 from EBISPOT/nesting-issue
henrietteharmse Apr 3, 2024
5fa3192
Merge pull request #636 from EBISPOT/jamesamcl-patch-1
henrietteharmse Apr 5, 2024
0a39cdb
fix frontend exception when linked property has no type
jamesamcl Apr 7, 2024
33c51f2
Alignment of dev branch with stable branch.
henrietteharmse Apr 9, 2024
cd1fe5f
Merge branch 'stable' into dev
henrietteharmse Apr 9, 2024
1568297
Merge pull request #643 from EBISPOT/fix-anno-error2
henrietteharmse Apr 16, 2024
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions dataload/json2neo/src/main/java/OntologyScanner.java
Original file line number Diff line number Diff line change
Expand Up @@ -207,6 +207,8 @@ private static void visitValue(String predicate, Object value, Set<String> outPr

visitValue(predicate, mapValue.get("value"), outProps, outEdgeProps);

} else if(types.contains("datatype")) {

} else {
throw new RuntimeException("???");
}
Expand Down
2 changes: 2 additions & 0 deletions dataload/json2solr/src/main/java/JSON2Solr.java
Original file line number Diff line number Diff line change
Expand Up @@ -276,6 +276,8 @@ public static Object discardMetadata(Object obj) {
// (4) reification
return discardMetadata(dict.get("value"));

} else if(types.contains("datatype")) {
return null;
} else {
throw new RuntimeException("???");
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -476,6 +476,9 @@ public void writePropertyValue(JsonWriter writer, PropertyValue value, Set<Strin

}

private boolean isXMLBuiltinDatatype(String uri) {
return uri.startsWith("http://www.w3.org/2001/XMLSchema#");
}
public void writeValue(JsonWriter writer, PropertyValue value) throws IOException {
assert (value.axioms == null);

Expand Down Expand Up @@ -511,7 +514,14 @@ public void writeValue(JsonWriter writer, PropertyValue value) throws IOExceptio
writer.endObject();
break;
case URI:
writer.value(((PropertyValueURI) value).getUri());
String uri = ((PropertyValueURI) value).getUri();
OntologyNode uriNode = nodes.get(uri);
if(uriNode != null && !isXMLBuiltinDatatype(uri) && uriNode.types.contains(OntologyNode.NodeType.DATATYPE)) {
// special case for rdfs:Datatype; nest it as with a bnode instead of referencing
writeNode(writer, uriNode, Set.of("datatype"));
} else {
writer.value(uri);
}
break;
case RELATED:
writer.beginObject();
Expand Down Expand Up @@ -694,6 +704,10 @@ public void handleType(OntologyNode subjNode, Node type) {
case "http://www.w3.org/2002/07/owl#NegativePropertyAssertion":
subjNode.types.add(OntologyNode.NodeType.NEGATIVE_PROPERTY_ASSERTION);
break;

case "http://www.w3.org/2000/01/rdf-schema#Datatype":
subjNode.types.add(OntologyNode.NodeType.DATATYPE);
break;
}
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,8 @@ public enum NodeType {
ALL_DISJOINT_CLASSES("allDisjointClasses"),
ALL_DIFFERENT("allDifferent"),
ALL_DISJOINT_PROPERTIES("allDisjointProperties"),
NEGATIVE_PROPERTY_ASSERTION("negativePropertyAssertion");
NEGATIVE_PROPERTY_ASSERTION("negativePropertyAssertion"),
DATATYPE("datatype");

public final String name;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,9 @@ public static void annotateShortForms(OntologyGraph graph) {
OntologyNode c = graph.nodes.get(id);
if (c.types.contains(OntologyNode.NodeType.CLASS) ||
c.types.contains(OntologyNode.NodeType.PROPERTY) ||
c.types.contains(OntologyNode.NodeType.INDIVIDUAL)) {
c.types.contains(OntologyNode.NodeType.INDIVIDUAL) ||
c.types.contains(OntologyNode.NodeType.DATATYPE)
) {

// skip bnodes
if(c.uri == null)
Expand Down
4 changes: 4 additions & 0 deletions ebi_ontologies.json
Original file line number Diff line number Diff line change
@@ -1,5 +1,9 @@
{
"ontologies": [
{
"id": "dcat",
"ontology_purl": "https://www.w3.org/ns/dcat.ttl"
},
{
"id": "biolink",
"ontology_purl": "https://github.com/biolink/biolink-model/raw/master/project/owl/biolink_model.owl.ttl",
Expand Down
152 changes: 97 additions & 55 deletions frontend/src/components/ClassExpression.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,20 @@ export default function ClassExpression({

linkedEntities = linkedEntities.mergeWith(expr.linkedEntities)

const types = asArray(expr['type'])

if(types && types.indexOf('datatype') !== -1) {
// rdfs:Datatype
let equivClass = expr['http://www.w3.org/2002/07/owl#equivalentClass'];
if(equivClass) {
return <Fragment>
{ expr['label'] && <span>{expr['label']} </span> }
<ClassExpression currentEntity={currentEntity} ontologyId={ontologyId} entityType={'properties'} expr={equivClass} linkedEntities={linkedEntities} />
</Fragment>
}
}


///
/// 1. owl:Class expressions
///
Expand Down Expand Up @@ -312,43 +326,6 @@ export default function ClassExpression({
</span>
);
}

let minQualifiedCardinality = asArray(
expr["http://www.w3.org/2002/07/owl#minQualifiedCardinality"]
)[0];
if (minQualifiedCardinality) {
return (
<span>
<ClassExpression ontologyId={ontologyId} currentEntity={currentEntity} entityType={'properties'} expr={onProperty} linkedEntities={linkedEntities} />
<span className="px-1 text-embl-purple-default italic">min</span>
<ClassExpression
currentEntity={currentEntity}
ontologyId={ontologyId} entityType={'classes'}
expr={minQualifiedCardinality}
linkedEntities={linkedEntities}
/>
</span>
);
}

let maxQualifiedCardinality = asArray(
expr["http://www.w3.org/2002/07/owl#maxQualifiedCardinality"]
)[0];
if (maxQualifiedCardinality) {
return (
<span>
<ClassExpression ontologyId={ontologyId} currentEntity={currentEntity} entityType={'properties'} expr={onProperty} linkedEntities={linkedEntities} />
<span className="px-1 text-embl-purple-default italic">max</span>
<ClassExpression
currentEntity={currentEntity}
ontologyId={ontologyId} entityType={'classes'}
expr={maxQualifiedCardinality}
linkedEntities={linkedEntities}
/>
</span>
);
}

let exactCardinality = asArray(
expr["http://www.w3.org/2002/07/owl#cardinality"]
)[0];
Expand All @@ -362,24 +339,6 @@ export default function ClassExpression({
);
}

let exactQualifiedCardinality = asArray(
expr["http://www.w3.org/2002/07/owl#qualifiedCardinality"]
)[0];
if (exactQualifiedCardinality) {
return (
<span>
<ClassExpression ontologyId={ontologyId} currentEntity={currentEntity} entityType={'properties'} expr={onProperty} linkedEntities={linkedEntities} />
<span className="px-1 text-embl-purple-default italic">exactly</span>
<ClassExpression
ontologyId={ontologyId} entityType={'classes'}
currentEntity={currentEntity}
expr={exactQualifiedCardinality}
linkedEntities={linkedEntities}
/>
</span>
);
}

let hasSelf = asArray(expr["http://www.w3.org/2002/07/owl#hasSelf"])[0];
if (hasSelf) {
return (
Expand All @@ -391,6 +350,89 @@ export default function ClassExpression({
}


///
/// 4. owl:Restriction qualified cardinalities (property and class)
///
const onClass = expr["http://www.w3.org/2002/07/owl#onClass"];

if(onClass) {
let minQualifiedCardinality = asArray(
expr["http://www.w3.org/2002/07/owl#minQualifiedCardinality"]
)[0];
if (minQualifiedCardinality) {
return (
<span>
<ClassExpression ontologyId={ontologyId} currentEntity={currentEntity} entityType={'properties'} expr={onProperty} linkedEntities={linkedEntities} />
<span className="px-1 text-embl-purple-default italic">min</span>
<ClassExpression
currentEntity={currentEntity}
ontologyId={ontologyId} entityType={'classes'}
expr={minQualifiedCardinality}
linkedEntities={linkedEntities}
/>
&nbsp;
<ClassExpression
currentEntity={currentEntity}
ontologyId={ontologyId} entityType={'classes'}
expr={onClass}
linkedEntities={linkedEntities}
/>
</span>
);
}

let maxQualifiedCardinality = asArray(
expr["http://www.w3.org/2002/07/owl#maxQualifiedCardinality"]
)[0];
if (maxQualifiedCardinality) {
return (
<span>
<ClassExpression ontologyId={ontologyId} currentEntity={currentEntity} entityType={'properties'} expr={onProperty} linkedEntities={linkedEntities} />
<span className="px-1 text-embl-purple-default italic">max</span>
<ClassExpression
currentEntity={currentEntity}
ontologyId={ontologyId} entityType={'classes'}
expr={maxQualifiedCardinality}
linkedEntities={linkedEntities}
/>
&nbsp;
<ClassExpression
currentEntity={currentEntity}
ontologyId={ontologyId} entityType={'classes'}
expr={onClass}
linkedEntities={linkedEntities}
/>
</span>
);
}

let exactQualifiedCardinality = asArray(
expr["http://www.w3.org/2002/07/owl#qualifiedCardinality"]
)[0];
if (exactQualifiedCardinality) {
return (
<span>
<ClassExpression ontologyId={ontologyId} currentEntity={currentEntity} entityType={'properties'} expr={onProperty} linkedEntities={linkedEntities} />
<span className="px-1 text-embl-purple-default italic">exactly</span>
<ClassExpression
ontologyId={ontologyId} entityType={'classes'}
currentEntity={currentEntity}
expr={exactQualifiedCardinality}
linkedEntities={linkedEntities}
/>
&nbsp;
<ClassExpression
currentEntity={currentEntity}
ontologyId={ontologyId} entityType={'classes'}
expr={onClass}
linkedEntities={linkedEntities}
/>
</span>
);
}
}


return (
<span className="text-embl-red-default italic">
unknown class expression
Expand Down
2 changes: 1 addition & 1 deletion frontend/src/components/EntityLink.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ export default function EntityLink({

// reference to self; just display label bc we are already on that page
if (currentEntity && iri === currentEntity.getIri()) {
return <b>{currentEntity.getName()}</b>;
return <span>{currentEntity.getName()}</span>;
}

const label =
Expand Down
4 changes: 4 additions & 0 deletions frontend/src/model/Class.ts
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,10 @@ export default class Class extends Entity {
return asArray(this.properties['http://www.w3.org/2002/07/owl#disjointWith'])
}

getUnionOf() {
return asArray(this.properties['http://www.w3.org/2002/07/owl#unionOf'])
}

getHasKey() {
return asArray(this.properties['http://www.w3.org/2002/07/owl#hasKey'])
}
Expand Down
4 changes: 2 additions & 2 deletions frontend/src/model/Entity.ts
Original file line number Diff line number Diff line change
Expand Up @@ -116,8 +116,8 @@ export default abstract class Entity extends Thing {
// Object properties and data properties are not annotation properties, except in the case of informal vocabularies.
if (!this.isPredicateFromInformalVocabulary(predicate)) {
let linkedEntity = this.getLinkedEntities().get(predicate)
if (linkedEntity != undefined && linkedEntity.type.indexOf("objectProperty") !== -1) continue;
if (linkedEntity != undefined && linkedEntity.type.indexOf("dataProperty") !== -1) continue;
if (linkedEntity != undefined && linkedEntity.type && linkedEntity.type.indexOf("objectProperty") !== -1) continue;
if (linkedEntity != undefined && linkedEntity.type && linkedEntity.type.indexOf("dataProperty") !== -1) continue;
}

// If the value was already interpreted as definition/synonym/hierarchical, do
Expand Down
5 changes: 5 additions & 0 deletions frontend/src/pages/ontologies/entities/EntityPage.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,7 @@ import DomainSection from "./entityPageSections/DomainSection";
import EntityAnnotationsSection from "./entityPageSections/EntityAnnotationsSection";
import EntityDescriptionSection from "./entityPageSections/EntityDescriptionSection";
import EntityEquivalentsSection from "./entityPageSections/EntityEquivalentsSection";
import UnionOfSection from "./entityPageSections/UnionOfSection";
import EntityImagesSection from "./entityPageSections/EntityImagesSection";
import EntityParentsSection from "./entityPageSections/EntityParentsSection";
import EntityRelatedFromSection from "./entityPageSections/EntityRelatedFromSection";
Expand Down Expand Up @@ -462,6 +463,10 @@ export default function EntityPage({
entity={entity}
linkedEntities={linkedEntities}
/>
<UnionOfSection
entity={entity}
linkedEntities={linkedEntities}
/>
<PropertyInverseOfSection
entity={entity}
linkedEntities={linkedEntities}
Expand Down
Loading
Loading