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

industrial-production-specific SPIRES #340

Open
caufieldjh opened this issue Feb 27, 2024 · 2 comments
Open

industrial-production-specific SPIRES #340

caufieldjh opened this issue Feb 27, 2024 · 2 comments
Labels
template A request for a new or modified template

Comments

@caufieldjh
Copy link
Member

...I am trying to build an industrial-production-specific SPIRES. I found the upper level production ontology built by Industrial Foundry Ontology. Do you have any suggestions how to inverse-engineeringly design a template using an exsisting ontology, e.g. https://github.com/iofoundry/ontology

Or just manual work on template editing makes more sense?

Originally posted by @OldskiGinger in #338 (comment)

@OldskiGinger
Copy link

hi all.
I am a master student studying mechanical engineering (relatively poor coding and cs skills).
Now I am doing a subproject researching on the possibility of applying ontology as knowledge base for industrial production general use case chatbot.
Lucky am I that I found OntoGPT and IOF Core. However, I found no existing production SPIRES. Now I am thinking of generating a production SPIRES using IOF core (sounds like reverse-OntoGPT). I just noted that there was a guide in OntoGPT repository called start_with_owl.md. It stated reverse engineering might be possible using schema-automator tool and robot tool. I am gonna try it in the next few days.

Thanks for your interest @cmungall and @caufieldjh . I will upgrade my progress and questions here. Looking forward to sharing with you.

@OldskiGinger
Copy link

Hi there. As discussed before, I am building a SPIRES for production use case. I tried with a simplified iPhone assembly process. The process description is as below phone_assembly.txt:

During the assembly phase of the iPhone, each component is meticulously installed into the device frame. A technician uses a precision screwdriver (tool) to secure the motherboard within the chassis. Resistors and other delicate electronic components are soldered (action) onto the motherboard using a soldering iron (tool). The screen assembly, which includes the LCD or OLED panel, is carefully aligned and then attached using a set of specialized adhesives (tool). Camera modules are inserted (action) into their designated slots and then fixed in place with miniature screws (tool). The speaker unit is placed (action) into the housing and connected to the mainboard with fine wiring. Lastly, the microphone is installed (action) with tweezers (tool) and secured to the device.

Based on the description before, I built the template phone.yaml for similar cases. However, I met some challenges. Firstly, there is no special uri for some terms. Therefore, I used e.g. local:tech to avoid http access error later. The template is shown as below:

id: local:ontogpt:phone
name: smartphone-assembly-template
title: Smartphone Assembly Template
description: >-
  A template for smartphone assembly processes
license:
prefixes:
  rdf: http://www.w3.org/1999/02/22-rdf-syntax-ns#
  linkml: https://w3id.org/linkml/
  tech: local:tech
  UO: http://purl.obolibrary.org/obo/UO_
  dcterms: http://purl.org/dc/terms/
  NCIT: http://purl.obolibrary.org/obo/NCIT_
  BFO: http://purl.obolibrary.org/obo/BFO_
  RO: http://purl.obolibrary.org/obo/RO_
  qudt: http://qudt.org/schema/qudt/
  dbpediaont: http://dbpedia.org/ontology/

default_prefix: tech
default_range: string

imports:
  - linkml:types
  - core

classes:
  SmartphoneAssembly:
    tree_root: true
    close_mappings:
      - tech000001  # 移除了冒号
    attributes:
      url:
        identifier: true
        range: uriorcurie
        slot_uri: rdf:Resource
        annotations:
          prompt.skip: true
      label:
        description: the name of the smartphone assembly process
        slot_uri: rdfs:label
        annotations:
          owl: AnnotationProperty, AnnotationAssertion
      description:
        description: a brief textual description of the smartphone assembly process
        slot_uri: dcterms:description
        annotations:
          owl: AnnotationProperty, AnnotationAssertion
      categories:
        description: a semicolon separated list of the categories to which this assembly process belongs
        range: AssemblyCategory
        multivalued: true
        slot_uri: dcterms:subject
        annotations:
          owl: AnnotationAssertion
      components:
        description: a semicolon separated list of the components plus quantities used in the assembly
        multivalued: true
        range: Component
        slot_uri: tech0000020
        annotations:
          owl: ObjectProperty, ObjectSomeValuesFrom
      steps:
        description: a semicolon separated list of the individual steps involved in this assembly process
        multivalued: true
        range: AssemblyStep
        annotations:
          owl: ObjectProperty, ObjectSomeValuesFrom
    annotations:
      owl: Class

  Component:
    is_a: CompoundExpression
    class_uri: tech0000030
    annotations:
      owl: IntersectionOf
    attributes:
      part:
        description: the component part
        range: PartItem
        annotations:
          owl: ObjectProperty, ObjectSomeValuesFrom
      amount:
        description: the quantity of the component, e.g. 1 unit
        range: Quantity
        annotations:
          owl: ObjectProperty, ObjectSomeValuesFrom

  AssemblyStep:
    is_a: CompoundExpression
    class_uri: tech0000040
    annotations:
      owl: IntersectionOf
    attributes:
      action:
        description: the action taken in this step (e.g. secure, install)
        range: Action
      inputs:
        description: a semicolon separated list of the inputs of this step
        range: PartItem
        multivalued: true
        slot_uri: RO:0002233
        annotations:
          owl: ObjectProperty, ObjectSomeValuesFrom
      outputs:
        description: a semicolon separated list of the outputs of this step
        range: PartItem
        multivalued: true
        slot_uri: RO:0002234
        annotations:
          owl: ObjectProperty, ObjectSomeValuesFrom
      tools:
        description: the tool used in this step (e.g. screwdriver, soldering iron)
        range: ToolType
        multivalued: true
        slot_uri: RO:0002500
        annotations:
          owl: ObjectProperty, ObjectSomeValuesFrom

  PartItem:
    is_a: CompoundExpression
    annotations:
      owl: IntersectionOf
    attributes:
      part:
        description: the part item
        range: PartType
        slot_uri: BFO:0000051
        annotations:
          owl: ObjectProperty, ObjectSomeValuesFrom
      state:
        description: the state of the part item (e.g. unsecured, installed)
        annotations:
          owl: DataProperty, DataHasValue

  PartType:
    is_a: NamedEntity
    id_prefixes:
      - dbpediaont
      - tech
    annotations:
      annotators: tech, dbpediaont

  AssemblyCategory:
    is_a: NamedEntity
    id_prefixes:
      - dbpediaont
      - tech
      - NCIT
    annotations:
      annotators: tech, dbpediaont

  Action:
    is_a: NamedEntity
    id_prefixes:
      - dbpediaont
      - tech
    annotations:
      annotators: dbpediaont, tech

  ToolType:
    is_a: NamedEntity
    id_prefixes:
      - dbpediaont
      - tech  
    annotations:
      annotators: dbpediaont, tech

  Quantity:
    is_a: CompoundExpression
    annotations:
      owl: IntersectionOf
    attributes:
      value:
        description: the value of the quantity
        annotations:
          owl: DataProperty, DataHasValue
      unit:
        description: the unit of the quantity, e.g. pieces, units
        range: Unit
        slot_uri: qudt:unit
        annotations:
          owl: ObjectProperty, ObjectSomeValuesFrom

  Unit:
    is_a: NamedEntity
    id_prefixes:
      - UO
      - NCIT
      - dbpediaont
    annotations:
      annotators: uo, dbpediaont, tech

Then I used gen-pydantic to convert .yaml to .py.

When I ran

ontogpt extract -t phone -i phone_assembly.txt

It showed error:

ERROR:root:Line 'There is no text provided to assign fields to.' does not contain a colon; ignoring
Traceback (most recent call last):
  File "/Users/j.rockski/anaconda3/envs/mynewenv/lib/python3.10/site-packages/pronto/utils/io.py", line 68, in get_handle
    return open(path, "rb", buffering=0)
FileNotFoundError: [Errno 2] No such file or directory: 'tech'

During handling of the above exception, another exception occurred:

Can you please give me some hints on SPIRES correction when there is no uri for specific term in this case. Thanks a lot!

@caufieldjh caufieldjh added the template A request for a new or modified template label Jul 23, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
template A request for a new or modified template
Projects
None yet
Development

No branches or pull requests

2 participants