Skip to content

#125 - Tech debt, Change html parsing from the post ontology flow #115

Merged
ddelpiano merged 5 commits intodevelfrom
feature/ILEX-125
Jul 11, 2025
Merged

#125 - Tech debt, Change html parsing from the post ontology flow #115
ddelpiano merged 5 commits intodevelfrom
feature/ILEX-125

Conversation

@jrmartin
Copy link

@jrmartin jrmartin commented Jul 2, 2025

Changes create new ontology behavior, first POST new ontology. Then once we get back the redirect location of the new term, we do a GET using the endpoint and then we extract json data from there. Before we do the GET though, we need to clean up the URI as we get back 'http://uri.interlex.org/dariodippi/ontologies/uris/test_test_pbt46efr.html' , but we need 'http://uri.olympiangods.orgdariodippi/ontologies/uris/test_test_pbt46efr.jsonld'

As commented on JIRA:

Works now, and a PR was created. However, a couple of issues:

The redirect location we are getting back is not from olympiangods but from uri.interlex.org, and the jsonld is missing the ID in the response. So far our only option seems to extract from URL itself, see new ontology below for newly created: test_099_sbwulriy.jsonld:

{
  "@context": {
    "brick": "https://brickschema.org/schema/Brick#",
    "csvw": "http://www.w3.org/ns/csvw#",
    "dc": "http://purl.org/dc/elements/1.1/",
    "dcam": "http://purl.org/dc/dcam/",
    "dcat": "http://www.w3.org/ns/dcat#",
    "dcmitype": "http://purl.org/dc/dcmitype/",
    "dcterms": "http://purl.org/dc/terms/",
    "doap": "http://usefulinc.com/ns/doap#",
    "foaf": "http://xmlns.com/foaf/0.1/",
    "geo": "http://www.opengis.net/ont/geosparql#",
    "odrl": "http://www.w3.org/ns/odrl/2/",
    "org": "http://www.w3.org/ns/org#",
    "owl": "http://www.w3.org/2002/07/owl#",
    "prof": "http://www.w3.org/ns/dx/prof/",
    "prov": "http://www.w3.org/ns/prov#",
    "qb": "http://purl.org/linked-data/cube#",
    "rdf": "http://www.w3.org/1999/02/22-rdf-syntax-ns#",
    "rdfs": "http://www.w3.org/2000/01/rdf-schema#",
    "schema": "https://schema.org/",
    "sh": "http://www.w3.org/ns/shacl#",
    "skos": "http://www.w3.org/2004/02/skos/core#",
    "sosa": "http://www.w3.org/ns/sosa/",
    "ssn": "http://www.w3.org/ns/ssn/",
    "time": "http://www.w3.org/2006/time#",
    "vann": "http://purl.org/vocab/vann/",
    "void": "http://rdfs.org/ns/void#",
    "wgs": "https://www.w3.org/2003/01/geo/wgs84_pos#",
    "xsd": "http://www.w3.org/2001/XMLSchema#"
  },
  "@graph": [
    {
      "@id": "http://purl.obolibrary.org/obo/BFO_0000001",
      "@type": "owl:Class",
      "http://purl.obolibrary.org/obo/BFO_0000179": "entity",
      "http://purl.obolibrary.org/obo/BFO_0000180": "Entity",
      "http://purl.obolibrary.org/obo/IAO_0000112": [
        {
          "@language": "en",
          "@value": "Julius Caesar"
        },
        {
          "@language": "en",
          "@value": "the Second World War"
        },
        {
          "@language": "en",
          "@value": "Verdi’s Requiem"
        },
        {
          "@language": "en",
          "@value": "your body mass index"
        }
      ],
      "http://purl.obolibrary.org/obo/IAO_0000116": [
        {
          "@language": "en",
          "@value": "BFO 2 Reference: In all areas of empirical inquiry we encounter general terms of two sorts. First are general terms which refer to universals or types:animaltuberculosissurgical procedurediseaseSecond, are general terms used to refer to groups of entities which instantiate a given universal but do not correspond to the extension of any subuniversal of that universal because there is nothing intrinsic to the entities in question by virtue of which they – and only they – are counted as belonging to the given group. Examples are: animal purchased by the Emperortuberculosis diagnosed on a Wednesdaysurgical procedure performed on a patient from Stockholmperson identified as candidate for clinical trial #2056-555person who is signatory of Form 656-PPVpainting by Leonardo da VinciSuch terms, which represent what are called ‘specializations’ in [81"
        },
        {
          "@language": "en",
          "@value": "Entity doesn't have a closure axiom because the subclasses don't necessarily exhaust all possibilites. For example Werner Ceusters 'portions of reality' include 4 sorts, entities (as BFO construes them), universals, configurations, and relations. It is an open question as to whether entities as construed in BFO will at some point also include these other portions of reality. See, for example, 'How to track absolutely everything' at http://www.referent-tracking.com/_RTU/papers/CeustersICbookRevised.pdf"
        }
      ],
      "http://purl.obolibrary.org/obo/IAO_0000600": {
        "@language": "en",
        "@value": "An entity is anything that exists or has existed or will exist. (axiom label in BFO2 Reference: [001-001])"
      },
      "rdfs:isDefinedBy": {
        "@id": "http://purl.obolibrary.org/obo/bfo.owl"
      },
      "rdfs:label": {
        "@language": "en",
        "@value": "entity"
      },
      "rdfs:subClassOf": {
        "@id": "owl:Thing"
      }
    },
    {
      "@id": "http://purl.obolibrary.org/obo/IAO_0000001",
      "@type": "owl:Class",
      "http://purl.obolibrary.org/obo/IAO_0000111": {
        "@language": "en",
        "@value": "conditional specification"
      },
      "http://purl.obolibrary.org/obo/IAO_0000114": {
        "@id": "http://purl.obolibrary.org/obo/IAO_0000120"
      },
      "http://purl.obolibrary.org/obo/IAO_0000115": {
        "@language": "en",
        "@value": "A directive information entity that specifies what should happen if the trigger condition is fulfilled."
      },
      "http://purl.obolibrary.org/obo/IAO_0000117": {
        "@language": "en",
        "@value": "PlanAndPlannedProcess Branch"
      },
      "http://purl.obolibrary.org/obo/IAO_0000119": [
        {
          "@language": "en",
          "@value": "OBI_0000349"
        },
        {
          "@language": "en",
          "@value": "OBI branch derived"
        }
      ],
      "rdfs:label": {
        "@language": "en",
        "@value": "conditional specification"
      },
      "rdfs:subClassOf": {
        "@id": "http://purl.obolibrary.org/obo/IAO_0000033"
      }
    },
    {
      "@id": "http://uri.interlex.org/dariodippi/ontologies/None_None",
      "@type": "owl:Ontology",
      "http://purl.obolibrary.org/obo/IAO_0000136": {
        "@id": "http://uri.interlex.org/dariodippi/None_None"
      },
      "owl:versionIRI": {
        "@id": "http://uri.interlex.org/dariodippi/ontologies/None_None/version/1751425211/None_None"
      },
      "owl:versionInfo": "2025-07-02T03:00:11,248255Z",
      "rdfs:comment": "InterLex single term result for dariodippi/None_None at 2025-07-02T03:00:11,248255Z"
    }
  ]
}

@jrmartin jrmartin requested review from Copilot and ddelpiano July 2, 2025 03:41

This comment was marked as outdated.

@jrmartin jrmartin requested a review from Copilot July 2, 2025 03:56
Copy link

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull Request Overview

This PR refactors the ontology creation flow to handle manual redirects, fetch the JSON-LD from the correct host, and update client-side proxy and UI components accordingly.

  • Adds a Vite proxy rule for .html/.jsonld ontology endpoints and enhanced CORS handling.
  • Simplifies the success/failure logic in the AddNewOntologyDialog component.
  • Rewrites createNewOntology to use fetch with manual redirect handling, custom header parsing, and JSON-LD extraction.

Reviewed Changes

Copilot reviewed 3 out of 3 changed files in this pull request and generated 4 comments.

File Description
vite.config.js New proxy route for ontology HTML/JSON-LD with CORS
src/components/SingleOrganization/AddNewOntologyDialog.jsx Inverted result.created check and removed debug logs
src/api/endpoints/apiService.ts Replaced POST helper with fetch, manual redirect logic, and JSON-LD parsing
Comments suppressed due to low confidence (2)

src/api/endpoints/apiService.ts:165

  • This new redirect-handling branch isn’t covered by existing tests; add unit tests to simulate the x-redirect-location header and the JSON-LD fetch.
    if (redirectLocation) {

src/components/SingleOrganization/AddNewOntologyDialog.jsx:76

  • [nitpick] Success logging was removed entirely; consider logging or displaying the newly created ontology ID or location on success to aid debugging and user feedback.
        if (!result.created) {

Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
@ddelpiano ddelpiano merged commit 96a8a7b into devel Jul 11, 2025
1 check passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants