Skip to content

Commit

Permalink
Merge 8387c83 into 3f35b38
Browse files Browse the repository at this point in the history
  • Loading branch information
mboudet committed Aug 16, 2023
2 parents 3f35b38 + 8387c83 commit c50307f
Show file tree
Hide file tree
Showing 5 changed files with 41 additions and 6 deletions.
1 change: 1 addition & 0 deletions CHANGELOG.md
Expand Up @@ -26,6 +26,7 @@ This changelog was started for release 4.2.0.
- Store 'version' value when storing results. Not used for now, but might be used in deprecation warnings later
- Removed some lines from coverage computation
- Added 'indirect relations': Two entities will be linked on the graph, without a direct relation between them (same as faldo relations). This is intended to be used with 'linked attributes' (ex: get all entities B where B.color is the same as A.color, without a direct relation between A and B)
- Basic support for 'skos:broader' and 'skos:narrower' for ontologies.

### Fixed

Expand Down
3 changes: 3 additions & 0 deletions askomics/libaskomics/RdfFile.py
Expand Up @@ -79,10 +79,13 @@ def get_preview(self):
head += ttl_file.readline()

location = None
remote_graph = None
try:
location, remote_graph = self.get_location_and_remote_graph()
except Exception as e:
self.error_message = str(e)
# Todo: Better error management
raise e

return {
'type': self.type,
Expand Down
27 changes: 23 additions & 4 deletions askomics/react/src/routes/query/ontolinkview.jsx
Expand Up @@ -16,6 +16,28 @@ export default class OntoLinkView extends Component {


render () {

let content = (
<>
<option selected={this.props.link.uri == 'http://www.w3.org/2000/01/rdf-schema#subClassOf' ? true : false} value="http://www.w3.org/2000/01/rdf-schema#subClassOf">children of</option>
<option selected={this.props.link.uri == 'http://www.w3.org/2000/01/rdf-schema#subClassOf*' ? true : false} value="http://www.w3.org/2000/01/rdf-schema#subClassOf*">descendants of</option>
<option selected={this.props.link.uri == '^http://www.w3.org/2000/01/rdf-schema#subClassOf' ? true : false} value="^http://www.w3.org/2000/01/rdf-schema#subClassOf">parents of</option>
<option selected={this.props.link.uri == '^http://www.w3.org/2000/01/rdf-schema#subClassOf*' ? true : false} value="^http://www.w3.org/2000/01/rdf-schema#subClassOf*">ancestors of</option>
</>
)

if (this.props.link.uri.includes("http://www.w3.org/2004/02/skos/core")){
content = (
<>
<option selected={this.props.link.uri == 'http://www.w3.org/2004/02/skos/core#broader' ? true : false} value="http://www.w3.org/2004/02/skos/core#broader">children of</option>
<option selected={this.props.link.uri == 'http://www.w3.org/2004/02/skos/core#broader*' ? true : false} value="http://www.w3.org/2004/02/skos/core#broader*">descendants of</option>
<option selected={this.props.link.uri == 'http://www.w3.org/2004/02/skos/core#narrower' ? true : false} value="http://www.w3.org/2004/02/skos/core#narrower">parents of</option>
<option selected={this.props.link.uri == 'http://www.w3.org/2004/02/skos/core#narrower*' ? true : false} value="http://www.w3.org/2004/02/skos/core#narrower*">ancestors of</option>
</>
)
}


return (
<div className="container">
<h5>Ontological Relation</h5>
Expand All @@ -25,10 +47,7 @@ export default class OntoLinkView extends Component {
<tr>
<td>
<CustomInput type="select" id={this.props.link.id} name="ontology_position" onChange={this.handleChangeOntologyType}>
<option selected={this.props.link.uri == 'http://www.w3.org/2000/01/rdf-schema#subClassOf' ? true : false} value="http://www.w3.org/2000/01/rdf-schema#subClassOf">children of</option>
<option selected={this.props.link.uri == 'http://www.w3.org/2000/01/rdf-schema#subClassOf*' ? true : false} value="http://www.w3.org/2000/01/rdf-schema#subClassOf*">descendants of</option>
<option selected={this.props.link.uri == '^http://www.w3.org/2000/01/rdf-schema#subClassOf' ? true : false} value="^http://www.w3.org/2000/01/rdf-schema#subClassOf">parents of</option>
<option selected={this.props.link.uri == '^http://www.w3.org/2000/01/rdf-schema#subClassOf*' ? true : false} value="^http://www.w3.org/2000/01/rdf-schema#subClassOf*">ancestors of</option>
{content}
</CustomInput>
</td>
<td>&nbsp;a term</td>
Expand Down
9 changes: 7 additions & 2 deletions askomics/react/src/routes/query/query.jsx
Expand Up @@ -1548,10 +1548,15 @@ export default class Query extends Component {

getOntoLabel (uri) {
let labels = {}
labels["http://www.w3.org/2000/01/rdf-schema#subClassOf"] = "is children of"
labels["http://www.w3.org/2000/01/rdf-schema#subClassOf"] = "is child of"
labels["http://www.w3.org/2000/01/rdf-schema#subClassOf*"] = "is descendant of"
labels["^http://www.w3.org/2000/01/rdf-schema#subClassOf"] = "is parents of"
labels["^http://www.w3.org/2000/01/rdf-schema#subClassOf"] = "is parent of"
labels["^http://www.w3.org/2000/01/rdf-schema#subClassOf*"] = "is ancestor of"

labels["http://www.w3.org/2004/02/skos/core#broader"] = "is child of"
labels["http://www.w3.org/2004/02/skos/core#broader*"] = "is descendant of"
labels["http://www.w3.org/2004/02/skos/core#narrower"] = "is parent of"
labels["http://www.w3.org/2004/02/skos/core#narrower*"] = "is ancestor of"
return labels[uri]
}

Expand Down
7 changes: 7 additions & 0 deletions docs/abstraction.md
Expand Up @@ -274,6 +274,10 @@ Ontologies needs to be are defined as follows:

You will then need to add any relations and attributes using blank nodes:

!!! warning
If using "skos:narrower" or "skos:broader", you only need to define one of them.
AskOmics will show both options in the UI

```turtle
# SubCLassOf relation
_:blank1 a askomics:AskomicsRelation .
Expand Down Expand Up @@ -304,6 +308,9 @@ Here is an example of an ontological class:
<class_uri> skos:prefLabel "OntologyLabel" .
```

!!! warning
For now, AskOmics expect the classes to be defined by 'owl:Class'

!!! note "Info"
The label does not need to be `rdfs:label`, but you will need to specify the correct label in the UI.

Expand Down

0 comments on commit c50307f

Please sign in to comment.