diff --git a/cookbook/advanced/12_Unstructured_to_Ontology.ipynb b/cookbook/advanced/12_Unstructured_to_Ontology.ipynb index 21b65979..17661456 100644 --- a/cookbook/advanced/12_Unstructured_to_Ontology.ipynb +++ b/cookbook/advanced/12_Unstructured_to_Ontology.ipynb @@ -6,7 +6,7 @@ "source": [ "[![Open In Colab](https://colab.research.google.com/assets/colab-badge.svg)](https://colab.research.google.com/github/Hawksight-AI/semantica/blob/main/cookbook/advanced/12_Unstructured_to_Ontology.ipynb)\n", "\n", - "# Advanced: Unstructured Text to Ontology\n", + "# Unstructured Text to Ontology\n", "\n", "Welcome to the advanced guide on extracting structured ontologies from unstructured text. This notebook explores two powerful paradigms available in Semantica:\n", "\n", @@ -24,11 +24,45 @@ }, { "cell_type": "code", - "execution_count": null, + "execution_count": 5, + "id": "9c21e116", "metadata": {}, - "outputs": [], + "outputs": [ + { + "name": "stderr", + "output_type": "stream", + "text": [ + "WARNING: Ignoring invalid distribution ~gno (C:\\Users\\Mohd Kaif\\AppData\\Local\\Programs\\Python\\Python311\\Lib\\site-packages)\n", + "WARNING: Ignoring invalid distribution ~lotly (C:\\Users\\Mohd Kaif\\AppData\\Local\\Programs\\Python\\Python311\\Lib\\site-packages)\n", + "WARNING: Ignoring invalid distribution ~ython-socketio (C:\\Users\\Mohd Kaif\\AppData\\Local\\Programs\\Python\\Python311\\Lib\\site-packages)\n", + "WARNING: Ignoring invalid distribution ~gno (C:\\Users\\Mohd Kaif\\AppData\\Local\\Programs\\Python\\Python311\\Lib\\site-packages)\n", + "WARNING: Ignoring invalid distribution ~lotly (C:\\Users\\Mohd Kaif\\AppData\\Local\\Programs\\Python\\Python311\\Lib\\site-packages)\n", + "WARNING: Ignoring invalid distribution ~ython-socketio (C:\\Users\\Mohd Kaif\\AppData\\Local\\Programs\\Python\\Python311\\Lib\\site-packages)\n", + "WARNING: Ignoring invalid distribution ~gno (C:\\Users\\Mohd Kaif\\AppData\\Local\\Programs\\Python\\Python311\\Lib\\site-packages)\n", + "WARNING: Ignoring invalid distribution ~lotly (C:\\Users\\Mohd Kaif\\AppData\\Local\\Programs\\Python\\Python311\\Lib\\site-packages)\n", + "WARNING: Ignoring invalid distribution ~ython-socketio (C:\\Users\\Mohd Kaif\\AppData\\Local\\Programs\\Python\\Python311\\Lib\\site-packages)\n" + ] + } + ], "source": [ - "# !pip install semantica[all]\n", + "!pip install -qU semantica" + ] + }, + { + "cell_type": "code", + "execution_count": 6, + "metadata": {}, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "Environment setup complete.\n" + ] + } + ], + "source": [ + "\n", "\n", "from semantica.utils.logging import get_logger\n", "\n", @@ -49,7 +83,7 @@ }, { "cell_type": "code", - "execution_count": null, + "execution_count": 7, "metadata": {}, "outputs": [], "source": [ @@ -81,9 +115,33 @@ }, { "cell_type": "code", - "execution_count": null, + "execution_count": 8, + "id": "75f896b9", "metadata": {}, - "outputs": [], + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "Extracting entities...\n", + "Found 12 entities.\n", + " - QuantumDynamics (ORG) [Conf: 1.0]\n", + " - AI (ORG) [Conf: 1.0]\n", + " - Elena Rostova (PERSON) [Conf: 1.0]\n", + " - 2018 (DATE) [Conf: 1.0]\n", + " - Zurich (GPE) [Conf: 1.0]\n", + "\n", + "Extracting relationships...\n", + "DEBUG: Entity map keys: ['quantumdynamics', 'ai', 'elena rostova', '2018', 'zurich', 'switzerland', 'rostova', 'the q-1 processor', 'the neuralbridge sdk', 'mit', 'eth zurich']\n", + "DEBUG: Match found! Subject='Elena Rostova', Object='2018'\n", + "DEBUG: Subject Entity found: True, Object Entity found: True\n", + "Found 1 relationships.\n", + " - Elena Rostova -> located_in -> 2018\n", + "\n", + "Generated NLP Ontology with 3 classes and 0 properties.\n" + ] + } + ], "source": [ "from semantica.semantic_extract import NERExtractor, RelationExtractor\n", "from semantica.ontology import OntologyGenerator, OntologyOptimizer\n", @@ -95,19 +153,65 @@ "# 2. Extract Entities\n", "print(\"Extracting entities...\")\n", "entities = ner.extract(text_corpus)\n", - "print(f\"Found {len(entities)} entities: {[e['text'] for e in entities]}\")\n", + "\n", + "# Note: entities are returned as Entity objects (dataclasses), not dictionaries.\n", + "# We access properties using dot notation (e.g., entity.text, entity.label).\n", + "print(f\"Found {len(entities)} entities.\")\n", + "for e in entities[:5]:\n", + " print(f\" - {e.text} ({e.label}) [Conf: {e.confidence}]\")\n", "\n", "# 3. Extract Relationships\n", - "print(\"Extracting relationships...\")\n", + "print(\"\\nExtracting relationships...\")\n", "relationships = re.extract(text_corpus, entities)\n", + "\n", + "# Note: relationships are returned as Relation objects.\n", + "print(f\"Found {len(relationships)} relationships.\")\n", "for r in relationships:\n", - " print(f\" - {r['source']} -> {r['type']} -> {r['target']}\")\n", + " print(f\" - {r.subject.text} -> {r.predicate} -> {r.object.text}\")\n", "\n", - "# 4. Generate Structure\n", + "# 4. Prepare Data for Ontology Generation\n", + "# The OntologyGenerator expects dictionaries, so we convert our objects.\n", + "# We also ensure we handle both object attributes and potential dictionary keys for robustness.\n", + "entities_data = []\n", + "for e in entities:\n", + " if hasattr(e, 'to_dict'):\n", + " entities_data.append(e.to_dict())\n", + " else:\n", + " # Manual conversion for dataclasses without to_dict\n", + " entities_data.append({\n", + " \"id\": getattr(e, \"text\", str(e)),\n", + " \"text\": getattr(e, \"text\", str(e)),\n", + " \"type\": getattr(e, \"label\", getattr(e, \"type\", \"Unknown\")),\n", + " \"confidence\": getattr(e, \"confidence\", 1.0)\n", + " })\n", + "\n", + "relationships_data = []\n", + "for r in relationships:\n", + " if hasattr(r, 'to_dict'):\n", + " relationships_data.append(r.to_dict())\n", + " else:\n", + " # Manual conversion for dataclasses without to_dict\n", + " # Handle nested Entity objects in subject/object fields\n", + " subj = r.subject\n", + " obj = r.object\n", + " subj_text = getattr(subj, \"text\", str(subj))\n", + " obj_text = getattr(obj, \"text\", str(obj))\n", + " \n", + " relationships_data.append({\n", + " \"source\": subj_text,\n", + " \"target\": obj_text,\n", + " \"type\": getattr(r, \"predicate\", getattr(r, \"type\", \"related_to\")),\n", + " \"confidence\": getattr(r, \"confidence\", 1.0)\n", + " })\n", + "\n", + "# 5. Generate Structure\n", "generator = OntologyGenerator()\n", - "nlp_ontology = generator.generate_ontology({\"entities\": entities, \"relationships\": relationships}, name=\"QuantumOntologyNLP\")\n", + "nlp_ontology = generator.generate_ontology(\n", + " {\"entities\": entities_data, \"relationships\": relationships_data},\n", + " name=\"QuantumOntologyNLP\"\n", + ")\n", "\n", - "# 5. Optimize (Clean up)\n", + "# 6. Optimize (Clean up)\n", "optimizer = OntologyOptimizer()\n", "nlp_ontology = optimizer.optimize_ontology(nlp_ontology, remove_redundancy=True)\n", "\n", @@ -132,9 +236,18 @@ }, { "cell_type": "code", - "execution_count": null, + "execution_count": 9, "metadata": {}, - "outputs": [], + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "Generating ontology with LLM...\n", + "Skipping LLM generation: LLM ontology generation failed: Error code: 401 - {'error': {'message': 'Incorrect API key provided: sk-proj-********************************************************************************************************************************************************bt8A. You can find your API key at https://platform.openai.com/account/api-keys.', 'type': 'invalid_request_error', 'code': 'invalid_api_key', 'param': None}, 'status': 401}\n" + ] + } + ], "source": [ "from semantica.ontology import LLMOntologyGenerator\n", "\n", @@ -169,9 +282,931 @@ }, { "cell_type": "code", - "execution_count": null, + "execution_count": 10, "metadata": {}, - "outputs": [], + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "--- NLP Approach Visualization ---\n" + ] + }, + { + "data": { + "application/vnd.plotly.v1+json": { + "config": { + "plotlyServerURL": "https://plot.ly" + }, + "data": [ + { + "hoverinfo": "none", + "line": { + "color": "#888", + "width": 1 + }, + "mode": "lines", + "opacity": 0.5, + "showlegend": false, + "type": "scatter", + "x": [], + "y": [] + }, + { + "hoverinfo": "text", + "hovertext": [ + "Org
Type: class", + "Person
Type: class", + "Gpe
Type: class" + ], + "marker": { + "color": [ + "#1f77b4", + "#1f77b4", + "#1f77b4" + ], + "line": { + "color": "white", + "width": 2 + }, + "opacity": 1, + "size": [ + 10, + 10, + 10 + ] + }, + "mode": "markers+text", + "showlegend": false, + "text": [ + "Org", + "Person", + "Gpe" + ], + "textfont": { + "color": "#333", + "size": 10 + }, + "textposition": "top center", + "type": "scatter", + "x": [ + 0.9419800352228437, + -0.18860676984531644, + -0.7533732653775272 + ], + "y": [ + -0.3103654151906184, + 1, + -0.6896345848093814 + ] + } + ], + "layout": { + "hovermode": "closest", + "margin": { + "b": 20, + "l": 5, + "r": 5, + "t": 40 + }, + "plot_bgcolor": "white", + "showlegend": false, + "template": { + "data": { + "bar": [ + { + "error_x": { + "color": "#2a3f5f" + }, + "error_y": { + "color": "#2a3f5f" + }, + "marker": { + "line": { + "color": "#E5ECF6", + "width": 0.5 + }, + "pattern": { + "fillmode": "overlay", + "size": 10, + "solidity": 0.2 + } + }, + "type": "bar" + } + ], + "barpolar": [ + { + "marker": { + "line": { + "color": "#E5ECF6", + "width": 0.5 + }, + "pattern": { + "fillmode": "overlay", + "size": 10, + "solidity": 0.2 + } + }, + "type": "barpolar" + } + ], + "carpet": [ + { + "aaxis": { + "endlinecolor": "#2a3f5f", + "gridcolor": "white", + "linecolor": "white", + "minorgridcolor": "white", + "startlinecolor": "#2a3f5f" + }, + "baxis": { + "endlinecolor": "#2a3f5f", + "gridcolor": "white", + "linecolor": "white", + "minorgridcolor": "white", + "startlinecolor": "#2a3f5f" + }, + "type": "carpet" + } + ], + "choropleth": [ + { + "colorbar": { + "outlinewidth": 0, + "ticks": "" + }, + "type": "choropleth" + } + ], + "contour": [ + { + "colorbar": { + "outlinewidth": 0, + "ticks": "" + }, + "colorscale": [ + [ + 0, + "#0d0887" + ], + [ + 0.1111111111111111, + "#46039f" + ], + [ + 0.2222222222222222, + "#7201a8" + ], + [ + 0.3333333333333333, + "#9c179e" + ], + [ + 0.4444444444444444, + "#bd3786" + ], + [ + 0.5555555555555556, + "#d8576b" + ], + [ + 0.6666666666666666, + "#ed7953" + ], + [ + 0.7777777777777778, + "#fb9f3a" + ], + [ + 0.8888888888888888, + "#fdca26" + ], + [ + 1, + "#f0f921" + ] + ], + "type": "contour" + } + ], + "contourcarpet": [ + { + "colorbar": { + "outlinewidth": 0, + "ticks": "" + }, + "type": "contourcarpet" + } + ], + "heatmap": [ + { + "colorbar": { + "outlinewidth": 0, + "ticks": "" + }, + "colorscale": [ + [ + 0, + "#0d0887" + ], + [ + 0.1111111111111111, + "#46039f" + ], + [ + 0.2222222222222222, + "#7201a8" + ], + [ + 0.3333333333333333, + "#9c179e" + ], + [ + 0.4444444444444444, + "#bd3786" + ], + [ + 0.5555555555555556, + "#d8576b" + ], + [ + 0.6666666666666666, + "#ed7953" + ], + [ + 0.7777777777777778, + "#fb9f3a" + ], + [ + 0.8888888888888888, + "#fdca26" + ], + [ + 1, + "#f0f921" + ] + ], + "type": "heatmap" + } + ], + "heatmapgl": [ + { + "colorbar": { + "outlinewidth": 0, + "ticks": "" + }, + "colorscale": [ + [ + 0, + "#0d0887" + ], + [ + 0.1111111111111111, + "#46039f" + ], + [ + 0.2222222222222222, + "#7201a8" + ], + [ + 0.3333333333333333, + "#9c179e" + ], + [ + 0.4444444444444444, + "#bd3786" + ], + [ + 0.5555555555555556, + "#d8576b" + ], + [ + 0.6666666666666666, + "#ed7953" + ], + [ + 0.7777777777777778, + "#fb9f3a" + ], + [ + 0.8888888888888888, + "#fdca26" + ], + [ + 1, + "#f0f921" + ] + ], + "type": "heatmapgl" + } + ], + "histogram": [ + { + "marker": { + "pattern": { + "fillmode": "overlay", + "size": 10, + "solidity": 0.2 + } + }, + "type": "histogram" + } + ], + "histogram2d": [ + { + "colorbar": { + "outlinewidth": 0, + "ticks": "" + }, + "colorscale": [ + [ + 0, + "#0d0887" + ], + [ + 0.1111111111111111, + "#46039f" + ], + [ + 0.2222222222222222, + "#7201a8" + ], + [ + 0.3333333333333333, + "#9c179e" + ], + [ + 0.4444444444444444, + "#bd3786" + ], + [ + 0.5555555555555556, + "#d8576b" + ], + [ + 0.6666666666666666, + "#ed7953" + ], + [ + 0.7777777777777778, + "#fb9f3a" + ], + [ + 0.8888888888888888, + "#fdca26" + ], + [ + 1, + "#f0f921" + ] + ], + "type": "histogram2d" + } + ], + "histogram2dcontour": [ + { + "colorbar": { + "outlinewidth": 0, + "ticks": "" + }, + "colorscale": [ + [ + 0, + "#0d0887" + ], + [ + 0.1111111111111111, + "#46039f" + ], + [ + 0.2222222222222222, + "#7201a8" + ], + [ + 0.3333333333333333, + "#9c179e" + ], + [ + 0.4444444444444444, + "#bd3786" + ], + [ + 0.5555555555555556, + "#d8576b" + ], + [ + 0.6666666666666666, + "#ed7953" + ], + [ + 0.7777777777777778, + "#fb9f3a" + ], + [ + 0.8888888888888888, + "#fdca26" + ], + [ + 1, + "#f0f921" + ] + ], + "type": "histogram2dcontour" + } + ], + "mesh3d": [ + { + "colorbar": { + "outlinewidth": 0, + "ticks": "" + }, + "type": "mesh3d" + } + ], + "parcoords": [ + { + "line": { + "colorbar": { + "outlinewidth": 0, + "ticks": "" + } + }, + "type": "parcoords" + } + ], + "pie": [ + { + "automargin": true, + "type": "pie" + } + ], + "scatter": [ + { + "fillpattern": { + "fillmode": "overlay", + "size": 10, + "solidity": 0.2 + }, + "type": "scatter" + } + ], + "scatter3d": [ + { + "line": { + "colorbar": { + "outlinewidth": 0, + "ticks": "" + } + }, + "marker": { + "colorbar": { + "outlinewidth": 0, + "ticks": "" + } + }, + "type": "scatter3d" + } + ], + "scattercarpet": [ + { + "marker": { + "colorbar": { + "outlinewidth": 0, + "ticks": "" + } + }, + "type": "scattercarpet" + } + ], + "scattergeo": [ + { + "marker": { + "colorbar": { + "outlinewidth": 0, + "ticks": "" + } + }, + "type": "scattergeo" + } + ], + "scattergl": [ + { + "marker": { + "colorbar": { + "outlinewidth": 0, + "ticks": "" + } + }, + "type": "scattergl" + } + ], + "scattermapbox": [ + { + "marker": { + "colorbar": { + "outlinewidth": 0, + "ticks": "" + } + }, + "type": "scattermapbox" + } + ], + "scatterpolar": [ + { + "marker": { + "colorbar": { + "outlinewidth": 0, + "ticks": "" + } + }, + "type": "scatterpolar" + } + ], + "scatterpolargl": [ + { + "marker": { + "colorbar": { + "outlinewidth": 0, + "ticks": "" + } + }, + "type": "scatterpolargl" + } + ], + "scatterternary": [ + { + "marker": { + "colorbar": { + "outlinewidth": 0, + "ticks": "" + } + }, + "type": "scatterternary" + } + ], + "surface": [ + { + "colorbar": { + "outlinewidth": 0, + "ticks": "" + }, + "colorscale": [ + [ + 0, + "#0d0887" + ], + [ + 0.1111111111111111, + "#46039f" + ], + [ + 0.2222222222222222, + "#7201a8" + ], + [ + 0.3333333333333333, + "#9c179e" + ], + [ + 0.4444444444444444, + "#bd3786" + ], + [ + 0.5555555555555556, + "#d8576b" + ], + [ + 0.6666666666666666, + "#ed7953" + ], + [ + 0.7777777777777778, + "#fb9f3a" + ], + [ + 0.8888888888888888, + "#fdca26" + ], + [ + 1, + "#f0f921" + ] + ], + "type": "surface" + } + ], + "table": [ + { + "cells": { + "fill": { + "color": "#EBF0F8" + }, + "line": { + "color": "white" + } + }, + "header": { + "fill": { + "color": "#C8D4E3" + }, + "line": { + "color": "white" + } + }, + "type": "table" + } + ] + }, + "layout": { + "annotationdefaults": { + "arrowcolor": "#2a3f5f", + "arrowhead": 0, + "arrowwidth": 1 + }, + "autotypenumbers": "strict", + "coloraxis": { + "colorbar": { + "outlinewidth": 0, + "ticks": "" + } + }, + "colorscale": { + "diverging": [ + [ + 0, + "#8e0152" + ], + [ + 0.1, + "#c51b7d" + ], + [ + 0.2, + "#de77ae" + ], + [ + 0.3, + "#f1b6da" + ], + [ + 0.4, + "#fde0ef" + ], + [ + 0.5, + "#f7f7f7" + ], + [ + 0.6, + "#e6f5d0" + ], + [ + 0.7, + "#b8e186" + ], + [ + 0.8, + "#7fbc41" + ], + [ + 0.9, + "#4d9221" + ], + [ + 1, + "#276419" + ] + ], + "sequential": [ + [ + 0, + "#0d0887" + ], + [ + 0.1111111111111111, + "#46039f" + ], + [ + 0.2222222222222222, + "#7201a8" + ], + [ + 0.3333333333333333, + "#9c179e" + ], + [ + 0.4444444444444444, + "#bd3786" + ], + [ + 0.5555555555555556, + "#d8576b" + ], + [ + 0.6666666666666666, + "#ed7953" + ], + [ + 0.7777777777777778, + "#fb9f3a" + ], + [ + 0.8888888888888888, + "#fdca26" + ], + [ + 1, + "#f0f921" + ] + ], + "sequentialminus": [ + [ + 0, + "#0d0887" + ], + [ + 0.1111111111111111, + "#46039f" + ], + [ + 0.2222222222222222, + "#7201a8" + ], + [ + 0.3333333333333333, + "#9c179e" + ], + [ + 0.4444444444444444, + "#bd3786" + ], + [ + 0.5555555555555556, + "#d8576b" + ], + [ + 0.6666666666666666, + "#ed7953" + ], + [ + 0.7777777777777778, + "#fb9f3a" + ], + [ + 0.8888888888888888, + "#fdca26" + ], + [ + 1, + "#f0f921" + ] + ] + }, + "colorway": [ + "#636efa", + "#EF553B", + "#00cc96", + "#ab63fa", + "#FFA15A", + "#19d3f3", + "#FF6692", + "#B6E880", + "#FF97FF", + "#FECB52" + ], + "font": { + "color": "#2a3f5f" + }, + "geo": { + "bgcolor": "white", + "lakecolor": "white", + "landcolor": "#E5ECF6", + "showlakes": true, + "showland": true, + "subunitcolor": "white" + }, + "hoverlabel": { + "align": "left" + }, + "hovermode": "closest", + "mapbox": { + "style": "light" + }, + "paper_bgcolor": "white", + "plot_bgcolor": "#E5ECF6", + "polar": { + "angularaxis": { + "gridcolor": "white", + "linecolor": "white", + "ticks": "" + }, + "bgcolor": "#E5ECF6", + "radialaxis": { + "gridcolor": "white", + "linecolor": "white", + "ticks": "" + } + }, + "scene": { + "xaxis": { + "backgroundcolor": "#E5ECF6", + "gridcolor": "white", + "gridwidth": 2, + "linecolor": "white", + "showbackground": true, + "ticks": "", + "zerolinecolor": "white" + }, + "yaxis": { + "backgroundcolor": "#E5ECF6", + "gridcolor": "white", + "gridwidth": 2, + "linecolor": "white", + "showbackground": true, + "ticks": "", + "zerolinecolor": "white" + }, + "zaxis": { + "backgroundcolor": "#E5ECF6", + "gridcolor": "white", + "gridwidth": 2, + "linecolor": "white", + "showbackground": true, + "ticks": "", + "zerolinecolor": "white" + } + }, + "shapedefaults": { + "line": { + "color": "#2a3f5f" + } + }, + "ternary": { + "aaxis": { + "gridcolor": "white", + "linecolor": "white", + "ticks": "" + }, + "baxis": { + "gridcolor": "white", + "linecolor": "white", + "ticks": "" + }, + "bgcolor": "#E5ECF6", + "caxis": { + "gridcolor": "white", + "linecolor": "white", + "ticks": "" + } + }, + "title": { + "x": 0.05 + }, + "xaxis": { + "automargin": true, + "gridcolor": "white", + "linecolor": "white", + "ticks": "", + "title": { + "standoff": 15 + }, + "zerolinecolor": "white", + "zerolinewidth": 2 + }, + "yaxis": { + "automargin": true, + "gridcolor": "white", + "linecolor": "white", + "ticks": "", + "title": { + "standoff": 15 + }, + "zerolinecolor": "white", + "zerolinewidth": 2 + } + } + }, + "title": { + "text": "Knowledge Graph Network" + }, + "xaxis": { + "showgrid": false, + "showticklabels": false, + "zeroline": false + }, + "yaxis": { + "showgrid": false, + "showticklabels": false, + "zeroline": false + } + } + } + }, + "metadata": {}, + "output_type": "display_data" + } + ], "source": [ "from semantica.visualization import OntologyVisualizer\n", "\n", @@ -200,9 +1235,17 @@ }, { "cell_type": "code", - "execution_count": null, + "execution_count": 11, "metadata": {}, - "outputs": [], + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "Successfully exported ontology to quantum_ontology.ttl\n" + ] + } + ], "source": [ "from semantica.export import OWLExporter\n", "\n", diff --git a/cookbook/advanced/quantum_ontology.ttl b/cookbook/advanced/quantum_ontology.ttl new file mode 100644 index 00000000..543e377e --- /dev/null +++ b/cookbook/advanced/quantum_ontology.ttl @@ -0,0 +1,21 @@ +@prefix rdf: . +@prefix rdfs: . +@prefix owl: . +@prefix xsd: . +@prefix ont: . + + a owl:Ontology ; + rdfs:label "QuantumOntologyNLP" ; + owl:versionInfo "1.0" . + +<> a owl:Class ; + rdfs:label "Org" . + rdfs:comment "Class representing org entities" . + +<> a owl:Class ; + rdfs:label "Person" . + rdfs:comment "Class representing person entities" . + +<> a owl:Class ; + rdfs:label "Gpe" . + rdfs:comment "Class representing gpe entities" .