Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
The table of contents is too big for display.
Diff view
Diff view
  •  
  •  
  •  
7 changes: 6 additions & 1 deletion create_pydantic.py
Original file line number Diff line number Diff line change
Expand Up @@ -142,7 +142,7 @@ def generate_models(graph: Graph):
python_type = f"_{python_type}"
# Ditto for property names
if prop_name[0].isdigit() or prop_name.lower() in kwlist:
prop_name = f"_{prop_name}"
prop_name = f"{prop_name}_"
class_info["properties"].append((prop_name, python_type))
except Exception:
pass
Expand Down Expand Up @@ -182,6 +182,11 @@ def generate_models(graph: Graph):

# Class definition
if class_info["parent"]:
# Use the @dataclass decorator for subclasses
# Using @pydantic decorator results in a deep recursion
# and slow startup
f.write("from dataclasses import dataclass\n\n")
f.write("@dataclass\n")
f.write(f"class {class_name}({class_info['parent']}):\n")
else:
if class_name == "Thing":
Expand Down
3 changes: 3 additions & 0 deletions schema_models/_3_d_model.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,9 @@
from dataclasses import dataclass

from schema_models.media_object import MediaObject


@dataclass
class _3DModel(MediaObject):
"""
A 3D model represents some kind of 3D content, which may have [[encoding]]s in one or more [[MediaObject]]s. Many 3D formats are available (e.g. see [Wikipedia](https://en.wikipedia.org/wiki/Category:3D_graphics_file_formats)); specific encoding formats can be represented using the [[encodingFormat]] property applied to the relevant [[MediaObject]]. For the
Expand Down
3 changes: 3 additions & 0 deletions schema_models/__class.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,9 @@
from dataclasses import dataclass

from schema_models.intangible import Intangible


@dataclass
class _Class(Intangible):
"""
A class, also often called a 'Type'; equivalent to rdfs:Class.
Expand Down
3 changes: 3 additions & 0 deletions schema_models/about_page.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,9 @@
from dataclasses import dataclass

from schema_models.web_page import WebPage


@dataclass
class AboutPage(WebPage):
"""
Web page type: About page.
Expand Down
3 changes: 3 additions & 0 deletions schema_models/accept_action.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,9 @@
from dataclasses import dataclass

from schema_models.allocate_action import AllocateAction


@dataclass
class AcceptAction(AllocateAction):
"""
The act of committing to/adopting an object.
Expand Down
2 changes: 2 additions & 0 deletions schema_models/accommodation.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
from dataclasses import dataclass
from typing import List, Optional, Union

from pydantic import HttpUrl
Expand All @@ -7,6 +8,7 @@
from schema_models.place import Place


@dataclass
class Accommodation(Place):
"""
An accommodation is a place that can accommodate human beings, e.g. a hotel room, a camping pitch, or a meeting room. Many accommodations are for overnight stays, but this is not a mandatory requirement.
Expand Down
3 changes: 3 additions & 0 deletions schema_models/accounting_service.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,9 @@
from dataclasses import dataclass

from schema_models.financial_service import FinancialService


@dataclass
class AccountingService(FinancialService):
"""
Accountancy business.
Expand Down
3 changes: 3 additions & 0 deletions schema_models/achieve_action.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,9 @@
from dataclasses import dataclass

from schema_models.action import Action


@dataclass
class AchieveAction(Action):
"""
The act of accomplishing something via previous efforts. It is an instantaneous action rather than an ongoing process.
Expand Down
2 changes: 2 additions & 0 deletions schema_models/action.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
from dataclasses import dataclass
from datetime import datetime, time
from typing import List, Optional, Union

Expand All @@ -7,6 +8,7 @@
from schema_models.thing import Thing


@dataclass
class Action(Thing):
"""
An action performed by a direct agent and indirect participants upon a direct object. Optionally happens at a location with the help of an inanimate instrument. The execution of the action may produce a result. Specific action sub-type documentation specifies the exact expectation of each argument/role.
Expand Down
2 changes: 2 additions & 0 deletions schema_models/action_access_specification.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
from dataclasses import dataclass
from datetime import date, datetime, time
from typing import List, Optional, Union

Expand All @@ -10,6 +11,7 @@
from schema_models.thing import Thing


@dataclass
class ActionAccessSpecification(Intangible):
"""
A set of requirements that must be fulfilled in order to perform an Action.
Expand Down
3 changes: 3 additions & 0 deletions schema_models/action_status_type.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,9 @@
from dataclasses import dataclass

from schema_models.status_enumeration import StatusEnumeration


@dataclass
class ActionStatusType(StatusEnumeration):
"""
The status of an Action.
Expand Down
3 changes: 3 additions & 0 deletions schema_models/activate_action.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,9 @@
from dataclasses import dataclass

from schema_models.control_action import ControlAction


@dataclass
class ActivateAction(ControlAction):
"""
The act of starting or activating a device or application (e.g. starting a timer or turning on a flashlight).
Expand Down
3 changes: 3 additions & 0 deletions schema_models/add_action.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,9 @@
from dataclasses import dataclass

from schema_models.update_action import UpdateAction


@dataclass
class AddAction(UpdateAction):
"""
The act of editing by adding an object to a collection.
Expand Down
3 changes: 3 additions & 0 deletions schema_models/administrative_area.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,9 @@
from dataclasses import dataclass

from schema_models.place import Place


@dataclass
class AdministrativeArea(Place):
"""
A geographical region, typically under the jurisdiction of a particular government.
Expand Down
3 changes: 3 additions & 0 deletions schema_models/adult_entertainment.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,9 @@
from dataclasses import dataclass

from schema_models.entertainment_business import EntertainmentBusiness


@dataclass
class AdultEntertainment(EntertainmentBusiness):
"""
An adult entertainment establishment.
Expand Down
3 changes: 3 additions & 0 deletions schema_models/adult_oriented_enumeration.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,9 @@
from dataclasses import dataclass

from schema_models.enumeration import Enumeration


@dataclass
class AdultOrientedEnumeration(Enumeration):
"""
Enumeration of considerations that make a product relevant or potentially restricted for adults only.
Expand Down
3 changes: 3 additions & 0 deletions schema_models/advertiser_content_article.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,9 @@
from dataclasses import dataclass

from schema_models.article import Article


@dataclass
class AdvertiserContentArticle(Article):
"""
An [[Article]] that an external entity has paid to place or to produce to its specifications. Includes [advertorials](https://en.wikipedia.org/wiki/Advertorial), sponsored content, native advertising and other paid content.
Expand Down
2 changes: 2 additions & 0 deletions schema_models/aggregate_offer.py
Original file line number Diff line number Diff line change
@@ -1,9 +1,11 @@
from dataclasses import dataclass
from typing import List, Optional, Union

from schema_models.demand import Demand
from schema_models.offer import Offer


@dataclass
class AggregateOffer(Offer):
"""
When a single product is associated with multiple offers (for example, the same pair of shoes is offered by different merchants), then AggregateOffer can be used.
Expand Down
2 changes: 2 additions & 0 deletions schema_models/aggregate_rating.py
Original file line number Diff line number Diff line change
@@ -1,9 +1,11 @@
from dataclasses import dataclass
from typing import List, Optional, Union

from schema_models.rating import Rating
from schema_models.thing import Thing


@dataclass
class AggregateRating(Rating):
"""
The average rating based on multiple ratings or reviews.
Expand Down
3 changes: 3 additions & 0 deletions schema_models/agree_action.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,9 @@
from dataclasses import dataclass

from schema_models.react_action import ReactAction


@dataclass
class AgreeAction(ReactAction):
"""
The act of expressing a consistency of opinion with the object. An agent agrees to/about an object (a proposition, topic or theme) with participants.
Expand Down
2 changes: 2 additions & 0 deletions schema_models/airline.py
Original file line number Diff line number Diff line change
@@ -1,8 +1,10 @@
from dataclasses import dataclass
from typing import List, Optional, Union

from schema_models.organization import Organization


@dataclass
class Airline(Organization):
"""
An organization that provides flights for passengers.
Expand Down
2 changes: 2 additions & 0 deletions schema_models/airport.py
Original file line number Diff line number Diff line change
@@ -1,8 +1,10 @@
from dataclasses import dataclass
from typing import List, Optional, Union

from schema_models.civic_structure import CivicStructure


@dataclass
class Airport(CivicStructure):
"""
An airport.
Expand Down
2 changes: 2 additions & 0 deletions schema_models/alignment_object.py
Original file line number Diff line number Diff line change
@@ -1,10 +1,12 @@
from dataclasses import dataclass
from typing import List, Optional, Union

from pydantic import HttpUrl

from schema_models.intangible import Intangible


@dataclass
class AlignmentObject(Intangible):
"""
An intangible item that describes an alignment between a learning resource and a node in an educational framework.
Expand Down
3 changes: 3 additions & 0 deletions schema_models/allocate_action.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,9 @@
from dataclasses import dataclass

from schema_models.organize_action import OrganizeAction


@dataclass
class AllocateAction(OrganizeAction):
"""
The act of organizing tasks/objects/events by associating resources to it.
Expand Down
3 changes: 3 additions & 0 deletions schema_models/am_radio_channel.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,9 @@
from dataclasses import dataclass

from schema_models.radio_channel import RadioChannel


@dataclass
class AMRadioChannel(RadioChannel):
"""
A radio channel that uses AM.
Expand Down
3 changes: 3 additions & 0 deletions schema_models/amp_story.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,9 @@
from dataclasses import dataclass

from schema_models.media_object import MediaObject


@dataclass
class AmpStory(MediaObject):
"""
A creative work with a visual storytelling format intended to be viewed online, particularly on mobile devices.
Expand Down
3 changes: 3 additions & 0 deletions schema_models/amusement_park.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,9 @@
from dataclasses import dataclass

from schema_models.entertainment_business import EntertainmentBusiness


@dataclass
class AmusementPark(EntertainmentBusiness):
"""
An amusement park.
Expand Down
3 changes: 3 additions & 0 deletions schema_models/analysis_news_article.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,9 @@
from dataclasses import dataclass

from schema_models.news_article import NewsArticle


@dataclass
class AnalysisNewsArticle(NewsArticle):
"""
An AnalysisNewsArticle is a [[NewsArticle]] that, while based on factual reporting, incorporates the expertise of the author/producer, offering interpretations and conclusions.
Expand Down
2 changes: 2 additions & 0 deletions schema_models/anatomical_structure.py
Original file line number Diff line number Diff line change
@@ -1,10 +1,12 @@
from dataclasses import dataclass
from typing import List, Optional, Union

from schema_models.anatomical_system import AnatomicalSystem
from schema_models.medical_condition import MedicalCondition
from schema_models.medical_entity import MedicalEntity


@dataclass
class AnatomicalStructure(MedicalEntity):
"""
Any part of the human body, typically a component of an anatomical system. Organs, tissues, and cells are all anatomical structures.
Expand Down
2 changes: 2 additions & 0 deletions schema_models/anatomical_system.py
Original file line number Diff line number Diff line change
@@ -1,8 +1,10 @@
from dataclasses import dataclass
from typing import List, Optional, Union

from schema_models.medical_entity import MedicalEntity


@dataclass
class AnatomicalSystem(MedicalEntity):
"""
An anatomical system is a group of anatomical structures that work together to perform a certain task. Anatomical systems, such as organ systems, are one organizing principle of anatomy, and can include circulatory, digestive, endocrine, integumentary, immune, lymphatic, muscular, nervous, reproductive, respiratory, skeletal, urinary, vestibular, and other systems.
Expand Down
3 changes: 3 additions & 0 deletions schema_models/animal_shelter.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,9 @@
from dataclasses import dataclass

from schema_models.local_business import LocalBusiness


@dataclass
class AnimalShelter(LocalBusiness):
"""
Animal shelter.
Expand Down
2 changes: 2 additions & 0 deletions schema_models/answer.py
Original file line number Diff line number Diff line change
@@ -1,10 +1,12 @@
from dataclasses import dataclass
from typing import List, Optional, Union

from schema_models.comment import Comment
from schema_models.creative_work import CreativeWork
from schema_models.web_content import WebContent


@dataclass
class Answer(Comment):
"""
An answer offered to a question; perhaps correct, perhaps opinionated or wrong.
Expand Down
2 changes: 2 additions & 0 deletions schema_models/apartment.py
Original file line number Diff line number Diff line change
@@ -1,9 +1,11 @@
from dataclasses import dataclass
from typing import List, Optional, Union

from schema_models.accommodation import Accommodation
from schema_models.quantitative_value import QuantitativeValue


@dataclass
class Apartment(Accommodation):
"""
An apartment (in American English) or flat (in British English) is a self-contained housing unit (a type of residential real estate) that occupies only part of a building (source: Wikipedia, the free encyclopedia, see <a href="http://en.wikipedia.org/wiki/Apartment">http://en.wikipedia.org/wiki/Apartment</a>).
Expand Down
2 changes: 2 additions & 0 deletions schema_models/apartment_complex.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
from dataclasses import dataclass
from typing import List, Optional, Union

from pydantic import HttpUrl
Expand All @@ -6,6 +7,7 @@
from schema_models.residence import Residence


@dataclass
class ApartmentComplex(Residence):
"""
Residence type: Apartment complex.
Expand Down
2 changes: 2 additions & 0 deletions schema_models/api_reference.py
Original file line number Diff line number Diff line change
@@ -1,8 +1,10 @@
from dataclasses import dataclass
from typing import List, Optional, Union

from schema_models.tech_article import TechArticle


@dataclass
class APIReference(TechArticle):
"""
Reference documentation for application programming interfaces (APIs).
Expand Down
Loading