-
Notifications
You must be signed in to change notification settings - Fork 21
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #467 from EBISPOT/owl2-testcases
Added domain and range sections and fixed my silly mistake wrt number…
- Loading branch information
Showing
13 changed files
with
298 additions
and
42 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
83 changes: 83 additions & 0 deletions
83
frontend/src/pages/ontologies/entities/entityPageSections/DomainSection.tsx
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,83 @@ | ||
import { Fragment } from "react"; | ||
import { randomString } from "../../../../app/util"; | ||
import ClassExpression from "../../../../components/ClassExpression"; | ||
import EntityLink from "../../../../components/EntityLink"; | ||
import Entity from "../../../../model/Entity"; | ||
import Class from "../../../../model/Class"; | ||
import LinkedEntities from "../../../../model/LinkedEntities"; | ||
import Property from "../../../../model/Property"; | ||
|
||
export default function DomainSection({ | ||
entity, | ||
linkedEntities, | ||
}: { | ||
entity: Entity; | ||
linkedEntities: LinkedEntities; | ||
}) { | ||
if (!(entity instanceof Property)) { | ||
return <Fragment />; | ||
} | ||
|
||
let domains = entity.getDomain(); | ||
|
||
if (!domains || domains.length === 0) { | ||
return <Fragment />; | ||
} | ||
|
||
return ( | ||
<div> | ||
<div className="font-bold">Domain</div> | ||
{domains.length === 1 ? ( | ||
<p> | ||
{typeof domains[0] === "object" && | ||
!Array.isArray(domains[0]) ? ( | ||
<ClassExpression | ||
ontologyId={entity.getOntologyId()} | ||
currentEntity={entity} | ||
expr={domains[0]} | ||
linkedEntities={linkedEntities} | ||
/> | ||
) : ( | ||
<EntityLink | ||
ontologyId={entity.getOntologyId()} | ||
currentEntity={entity} | ||
entityType={ | ||
entity.getType() === "property" ? "properties" : "classes" | ||
} | ||
iri={domains[0]} | ||
linkedEntities={linkedEntities} | ||
/> | ||
)} | ||
</p> | ||
) : ( | ||
<ul className="list-disc list-inside"> | ||
{domains.map((domains) => { | ||
return ( | ||
<li key={randomString()}> | ||
{typeof domains === "object" && | ||
!Array.isArray(domains) ? ( | ||
<ClassExpression | ||
ontologyId={entity.getOntologyId()} | ||
currentEntity={entity} | ||
expr={domains} | ||
linkedEntities={linkedEntities} | ||
/> | ||
) : ( | ||
<EntityLink | ||
ontologyId={entity.getOntologyId()} | ||
currentEntity={entity} | ||
entityType={ | ||
entity.getType() === "property" ? "properties" : "classes" | ||
} | ||
iri={domains} | ||
linkedEntities={linkedEntities} | ||
/> | ||
)} | ||
</li> | ||
); | ||
})} | ||
</ul> | ||
)} | ||
</div> | ||
); | ||
} |
83 changes: 83 additions & 0 deletions
83
frontend/src/pages/ontologies/entities/entityPageSections/HasKeySection.tsx
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,83 @@ | ||
import { Fragment } from "react"; | ||
import { randomString } from "../../../../app/util"; | ||
import ClassExpression from "../../../../components/ClassExpression"; | ||
import EntityLink from "../../../../components/EntityLink"; | ||
import Entity from "../../../../model/Entity"; | ||
import Class from "../../../../model/Class"; | ||
import LinkedEntities from "../../../../model/LinkedEntities"; | ||
import Property from "../../../../model/Property"; | ||
|
||
export default function HasKeySection({ | ||
entity, | ||
linkedEntities, | ||
}: { | ||
entity: Entity; | ||
linkedEntities: LinkedEntities; | ||
}) { | ||
if (!(entity instanceof Class)) { | ||
return <Fragment />; | ||
} | ||
|
||
let keys = entity.getHasKey(); | ||
|
||
if (!keys || keys.length === 0) { | ||
return <Fragment />; | ||
} | ||
|
||
return ( | ||
<div> | ||
<div className="font-bold">Has Key</div> | ||
{keys.length === 1 ? ( | ||
<p> | ||
{typeof keys[0] === "object" && | ||
!Array.isArray(keys[0]) ? ( | ||
<ClassExpression | ||
ontologyId={entity.getOntologyId()} | ||
currentEntity={entity} | ||
expr={keys[0]} | ||
linkedEntities={linkedEntities} | ||
/> | ||
) : ( | ||
<EntityLink | ||
ontologyId={entity.getOntologyId()} | ||
currentEntity={entity} | ||
entityType={ | ||
entity.getType() === "property" ? "properties" : "classes" | ||
} | ||
iri={keys[0]} | ||
linkedEntities={linkedEntities} | ||
/> | ||
)} | ||
</p> | ||
) : ( | ||
<ul className="list-disc list-inside"> | ||
{keys.map((keys) => { | ||
return ( | ||
<li key={randomString()}> | ||
{typeof keys === "object" && | ||
!Array.isArray(keys) ? ( | ||
<ClassExpression | ||
ontologyId={entity.getOntologyId()} | ||
currentEntity={entity} | ||
expr={keys} | ||
linkedEntities={linkedEntities} | ||
/> | ||
) : ( | ||
<EntityLink | ||
ontologyId={entity.getOntologyId()} | ||
currentEntity={entity} | ||
entityType={ | ||
entity.getType() === "property" ? "properties" : "classes" | ||
} | ||
iri={keys} | ||
linkedEntities={linkedEntities} | ||
/> | ||
)} | ||
</li> | ||
); | ||
})} | ||
</ul> | ||
)} | ||
</div> | ||
); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.