Sand Box

Sand Box

from gd05 import GenDifS_Map
mm = "Schnitzel_DE"
o = GenDifS_Map(f"../mm/{mm}.mm", verbose = 1, update_mindmap=True)
cwd into input_dir: /home/dsci/a/l/lib/gendifs_05/mm
reading /home/dsci/a/l/lib/gendifs_05/mm > Schnitzel_DE.mm (20 nodes)
Parsing XML: #1 start nodes
ontology node IDs: {'ID_1341768789': 'ONTOLOGY'}
RDF: 280 1180
updated mindmap with backup to /home/dsci/a/l/lib/gendifs_05/mm/Schnitzel_DE.mm_backup_2022-09-08T14-53-57
my_query = """
SELECT DISTINCT ?s ?p ?o
WHERE {
    ?s ?p ?o .
    ?s rdf:type :Kalbschnitzel 
}"""

qres = o.rdflib.query(my_query)
for row in qres:
    print(row.s, row.p, row.o)
http://mm2ttl.net/namespace/ex#Kalbschnitzel_ID_1827400828 http://www.w3.org/1999/02/22-rdf-syntax-ns#type http://mm2ttl.net/namespace/default#Kalbschnitzel
http://mm2ttl.net/namespace/ex#Kalbschnitzel_ID_1953543047 http://www.w3.org/1999/02/22-rdf-syntax-ns#type http://mm2ttl.net/namespace/default#Kalbschnitzel
import pandas as pd
pd.DataFrame.from_dict(o.node_dict, orient='index').sort_index().T
0 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19
parseType object collection object collection object collection object collection collection object collection object collection collection object collection object collection object collection
TEXT topConcept NaN Schnitzel BY hat_Herkunft SOME Tier Schweineschnitzel SOME Schwein Kalbschnitzel SOME Kalb BY wendet_sich_an SOME Zielgruppe Kinderschnitzel SOME Kind Seniorenschnitzel SOME Senior BY serviert_an SOME Sauce Jägerschnitzel SOME Pfifferlinge Zigeunerschnitzel SOME Paprika Rahmschnitzel SOME Sahne
parent_object_ID 0 0 0 2 2 4 2 6 2 2 9 2 11 2 2 14 2 16 2 18
parent_collection_ID 1.0 1.0 NaN 1.0 NaN 3.0 NaN 3.0 1.0 NaN 8.0 NaN 8.0 1.0 NaN 13.0 NaN 13.0 NaN 13.0
tag NaN BY NaN BY NaN SOME NaN SOME BY NaN SOME NaN SOME BY NaN SOME NaN SOME NaN SOME
BY NaN topProperty NaN hat_Herkunft NaN NaN NaN NaN wendet_sich_an NaN NaN NaN NaN serviert_an NaN NaN NaN NaN NaN NaN
SOME NaN topConcept NaN Tier NaN Schwein NaN Kalb Zielgruppe NaN Kind NaN Senior Sauce NaN Pfifferlinge NaN Paprika NaN Sahne
ID NaN NaN 2.0 3.0 4.0 5.0 6.0 7.0 8.0 9.0 10.0 11.0 12.0 13.0 14.0 15.0 16.0 17.0 18.0 19.0
mm_ID NaN NaN ID_703681491 ID_1909572786 ID_1892873496 ID_775016421 ID_1827400828 ID_1953543047 ID_369046285 ID_1270104247 ID_1031562158 ID_305097846 ID_1820306917 ID_1011508176 ID_130548072 ID_1609648857 ID_260209826 ID_1773526489 ID_1782430077 ID_827143455
RESOURCE NaN NaN Schnitzel hat_Herkunft%20SOME%20Tier Schweineschnitzel Schwein Kalbschnitzel Kalb wendet_sich_an%20SOME%20Zielgruppe Kinderschnitzel Kind Seniorenschnitzel Senior serviert_an%20SOME%20Sauce J%C3%A4gerschnitzel Pfifferlinge Zigeunerschnitzel Paprika Rahmschnitzel Sahne
LINK NaN NaN
object_ID NaN NaN 2.0 NaN 4.0 NaN 6.0 NaN NaN 9.0 NaN 11.0 NaN NaN 14.0 NaN 16.0 NaN 18.0 NaN
collection_ID NaN NaN 1.0 3.0 3.0 5.0 3.0 7.0 8.0 8.0 10.0 8.0 12.0 13.0 13.0 15.0 13.0 17.0 13.0 19.0
md NaN NaN * **Schnitzel** * BY hat_Herkunft SOME *Tier* * **Schweineschnitzel** * SOME *Schwein* * **Kalbschnitzel** * SOME *Kalb* * BY wendet_sich_an SOME *Zielgruppe* * **Kinderschnitzel** * SOME *Kind* * **Seniorenschnitzel** * SOME *Senior* * BY serviert_an SOME *Sauce* * **Jägerschnitzel** * SOME *Pfifferlinge* * **Zigeunerschnitzel** * SOME *Paprika* * **Rahmschnitzel** * SOME *Sahne*
BY_LINK NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN
o.result_dict
{'start': [], 'glossary': ['# glossary\n\n', '```{glossary}\n```']}
o.parser_markdown()
  • Schnitzel

    • BY hat_Herkunft SOME Tier

      • Schweineschnitzel

        • SOME Schwein

      • Kalbschnitzel

        • SOME Kalb

    • BY wendet_sich_an SOME Zielgruppe

      • Kinderschnitzel

        • SOME Kind

      • Seniorenschnitzel

        • SOME Senior

    • BY serviert_an SOME Sauce

      • Jägerschnitzel

        • SOME Pfifferlinge

      • Zigeunerschnitzel

        • SOME Paprika

      • Rahmschnitzel

        • SOME Sahne

o.rdflib.serialize(destination=f"../ttl/{mm}.ttl")
<Graph identifier=N30a3da6e5bd34772915fca30fd1a88d9 (<class 'rdflib.graph.Graph'>)>
import rdflib
from rdflib.extras.external_graph_libs import rdflib_to_networkx_multidigraph
#!pip install networkx
import networkx as nx
import matplotlib.pyplot as plt
url = 'https://www.w3.org/TeamSubmission/turtle/tests/test-30.ttl'

g = rdflib.Graph()
result = g.parse(url, format='turtle')

#G = rdflib_to_networkx_multidigraph(result)

G = rdflib_to_networkx_multidigraph(o.rdflib)


# Plot Networkx instance of RDF Graph
pos = nx.shell_layout(G, scale=1000)
edge_labels = nx.get_edge_attributes(G, 'r')
#nx.draw_networkx_edge_labels(G, pos, edge_labels=edge_labels)
nx.draw(G, with_labels=True)
_images/h_sand-box_12_0.png
o.owlrl
<Graph identifier=N68185cd3a0504fbe8962e72acfba5ec5 (<class 'rdflib.graph.Graph'>)>

The parser will read the mindmap file, parse the content, and store the result in the dictionary o.node_dict.

This dict is acessable from outside, e.g. like this:

Then raw turtle code will be generated. It’s stored in the list o.turtle_list. To conveniently inspect distinct entries, use the method o.show_turtle([ <list of IDs > ]), e.g.:

print(o.show_turtle([]))
# 1
# COLLECTION.a, context
#   None: None
#     None: None
#       None: None



# 1
# BY.a, owl
:topProperty
   rdf:type owl:ObjectProperty .


# 1
# BY.b, owl
:topConcept
   a owl:Class .


# 1
# BY.c, owl-test
ex:topConcept_None
   a :topConcept .



# 1
# BY.g, owl-classification
:BY_1_restriction
   a owl:Class ;
   rdfs:label "BY topProperty SOME topConcept" ;
   owl:equivalentClass [ a owl:Restriction ;
      owl:onProperty :topProperty ;
      owl:someValuesFrom :topConcept ] .



# 1
# BY.h, owl-classification
:BY_1_intersection
   a owl:Class ;
   rdfs:label "(BY topProperty SOME topConcept) INTERSECT None_None" ;
   rdfs:subClassOf :None ;
   owl:equivalentClass [ a owl:Class ;
      owl:intersectionOf (
         :BY_1_restriction
         :None ) ] .



# 2
# OBJECT_BY.a, owl
:Schnitzel
   a owl:Class ; # 
   rdfs:subClassOf :None .


# 2
# OBJECT_BY.b, owl-test
ex:Schnitzel_ID_703681491
   a :Schnitzel .



# 2
# OBJECT_BY.c, skos
cpt:Schnitzel
   a skos:Concept ;
   skos:broaderTransitive cpt:None .


# 3
# COLLECTION.a, context
#   None: None
#     2: Schnitzel
#       3: hat_Herkunft%20SOME%20Tier



# 3
# BY.a, owl
:hat_Herkunft
   rdf:type owl:ObjectProperty .


# 3
# BY.b, owl
:Tier
   a owl:Class .


# 3
# BY.c, owl-test
ex:Tier_ID_1909572786
   a :Tier .



# 3
# BY.g, owl-classification
:BY_3_restriction
   a owl:Class ;
   rdfs:label "BY hat_Herkunft SOME Tier" ;
   owl:equivalentClass [ a owl:Restriction ;
      owl:onProperty :hat_Herkunft ;
      owl:someValuesFrom :Tier ] .



# 3
# BY.h, owl-classification
:BY_3_intersection
   a owl:Class ;
   rdfs:label "(BY hat_Herkunft SOME Tier) INTERSECT 2_Schnitzel" ;
   rdfs:subClassOf :Schnitzel ;
   owl:equivalentClass [ a owl:Class ;
      owl:intersectionOf (
         :BY_3_restriction
         :Schnitzel ) ] .



# 4
# OBJECT_BY.a, owl
:Schweineschnitzel
   a owl:Class ; # 
   rdfs:subClassOf :Schnitzel .


# 4
# OBJECT_BY.b, owl-test
ex:Schweineschnitzel_ID_1892873496
   a :Schweineschnitzel .



# 4
# OBJECT_BY.c, skos
cpt:Schweineschnitzel
   a skos:Concept ;
   skos:broaderTransitive cpt:Schnitzel .


# 5
# COLLECTION.a, context
#   3: hat_Herkunft%20SOME%20Tier
#     4: Schweineschnitzel
#       5: Schwein



# 5
# SOME.b, owl
:Schwein
   a owl:Class ;
    rdfs:subClassOf :Tier .


# 5
# SOME.c, owl-test
ex:Schwein_ID_775016421
   a :Schwein .



# 5
# SOME.g, owl-classification
:SOME_5_restriction
   a owl:Class ;
   rdfs:label "BY 3_hat_Herkunft SOME Schwein" ;
   owl:equivalentClass [ a owl:Restriction ;
      owl:onProperty :hat_Herkunft ;
      owl:someValuesFrom :Schwein ] .



# 5
# SOME.h, owl-classification
:SOME_5_intersection
   a owl:Class ;
   rdfs:label "(BY 3_hat_Herkunft SOME Schwein) INTERSECT 2_Schnitzel" ;
   rdfs:subClassOf :Schweineschnitzel ;
   owl:equivalentClass [ a owl:Class ;
      owl:intersectionOf (
          :SOME_5_restriction
          :Schnitzel ) ] .



# 5
# SOME.i, owl-test
# Schnitzel hat_Herkunft Schwein -> Schweineschnitzel
ex:Schnitzel_ID_775016421
   a :Schnitzel ;
   :hat_Herkunft ex:Schwein_ID_775016421 ;
   ex:classifyLike ex:Schweineschnitzel_ID_775016421 .
ex:Schwein_ID_775016421
   a :Schwein .
ex:Schweineschnitzel_ID_775016421
   a :Schweineschnitzel .



# 6
# OBJECT_BY.a, owl
:Kalbschnitzel
   a owl:Class ; # 
   rdfs:subClassOf :Schnitzel .


# 6
# OBJECT_BY.b, owl-test
ex:Kalbschnitzel_ID_1827400828
   a :Kalbschnitzel .



# 6
# OBJECT_BY.c, skos
cpt:Kalbschnitzel
   a skos:Concept ;
   skos:broaderTransitive cpt:Schnitzel .


# 7
# COLLECTION.a, context
#   3: hat_Herkunft%20SOME%20Tier
#     6: Kalbschnitzel
#       7: Kalb



# 7
# SOME.b, owl
:Kalb
   a owl:Class ;
    rdfs:subClassOf :Tier .


# 7
# SOME.c, owl-test
ex:Kalb_ID_1953543047
   a :Kalb .



# 7
# SOME.g, owl-classification
:SOME_7_restriction
   a owl:Class ;
   rdfs:label "BY 3_hat_Herkunft SOME Kalb" ;
   owl:equivalentClass [ a owl:Restriction ;
      owl:onProperty :hat_Herkunft ;
      owl:someValuesFrom :Kalb ] .



# 7
# SOME.h, owl-classification
:SOME_7_intersection
   a owl:Class ;
   rdfs:label "(BY 3_hat_Herkunft SOME Kalb) INTERSECT 2_Schnitzel" ;
   rdfs:subClassOf :Kalbschnitzel ;
   owl:equivalentClass [ a owl:Class ;
      owl:intersectionOf (
          :SOME_7_restriction
          :Schnitzel ) ] .



# 7
# SOME.i, owl-test
# Schnitzel hat_Herkunft Kalb -> Kalbschnitzel
ex:Schnitzel_ID_1953543047
   a :Schnitzel ;
   :hat_Herkunft ex:Kalb_ID_1953543047 ;
   ex:classifyLike ex:Kalbschnitzel_ID_1953543047 .
ex:Kalb_ID_1953543047
   a :Kalb .
ex:Kalbschnitzel_ID_1953543047
   a :Kalbschnitzel .



# 8
# COLLECTION.a, context
#   None: None
#     2: Schnitzel
#       8: wendet_sich_an%20SOME%20Zielgruppe



# 8
# BY.a, owl
:wendet_sich_an
   rdf:type owl:ObjectProperty .


# 8
# BY.b, owl
:Zielgruppe
   a owl:Class .


# 8
# BY.c, owl-test
ex:Zielgruppe_ID_369046285
   a :Zielgruppe .



# 8
# BY.g, owl-classification
:BY_8_restriction
   a owl:Class ;
   rdfs:label "BY wendet_sich_an SOME Zielgruppe" ;
   owl:equivalentClass [ a owl:Restriction ;
      owl:onProperty :wendet_sich_an ;
      owl:someValuesFrom :Zielgruppe ] .



# 8
# BY.h, owl-classification
:BY_8_intersection
   a owl:Class ;
   rdfs:label "(BY wendet_sich_an SOME Zielgruppe) INTERSECT 2_Schnitzel" ;
   rdfs:subClassOf :Schnitzel ;
   owl:equivalentClass [ a owl:Class ;
      owl:intersectionOf (
         :BY_8_restriction
         :Schnitzel ) ] .



# 9
# OBJECT_BY.a, owl
:Kinderschnitzel
   a owl:Class ; # 
   rdfs:subClassOf :Schnitzel .


# 9
# OBJECT_BY.b, owl-test
ex:Kinderschnitzel_ID_1270104247
   a :Kinderschnitzel .



# 9
# OBJECT_BY.c, skos
cpt:Kinderschnitzel
   a skos:Concept ;
   skos:broaderTransitive cpt:Schnitzel .


# 10
# COLLECTION.a, context
#   8: wendet_sich_an%20SOME%20Zielgruppe
#     9: Kinderschnitzel
#       10: Kind



# 10
# SOME.b, owl
:Kind
   a owl:Class ;
    rdfs:subClassOf :Zielgruppe .


# 10
# SOME.c, owl-test
ex:Kind_ID_1031562158
   a :Kind .



# 10
# SOME.g, owl-classification
:SOME_10_restriction
   a owl:Class ;
   rdfs:label "BY 8_wendet_sich_an SOME Kind" ;
   owl:equivalentClass [ a owl:Restriction ;
      owl:onProperty :wendet_sich_an ;
      owl:someValuesFrom :Kind ] .



# 10
# SOME.h, owl-classification
:SOME_10_intersection
   a owl:Class ;
   rdfs:label "(BY 8_wendet_sich_an SOME Kind) INTERSECT 2_Schnitzel" ;
   rdfs:subClassOf :Kinderschnitzel ;
   owl:equivalentClass [ a owl:Class ;
      owl:intersectionOf (
          :SOME_10_restriction
          :Schnitzel ) ] .



# 10
# SOME.i, owl-test
# Schnitzel wendet_sich_an Kind -> Kinderschnitzel
ex:Schnitzel_ID_1031562158
   a :Schnitzel ;
   :wendet_sich_an ex:Kind_ID_1031562158 ;
   ex:classifyLike ex:Kinderschnitzel_ID_1031562158 .
ex:Kind_ID_1031562158
   a :Kind .
ex:Kinderschnitzel_ID_1031562158
   a :Kinderschnitzel .



# 11
# OBJECT_BY.a, owl
:Seniorenschnitzel
   a owl:Class ; # 
   rdfs:subClassOf :Schnitzel .


# 11
# OBJECT_BY.b, owl-test
ex:Seniorenschnitzel_ID_305097846
   a :Seniorenschnitzel .



# 11
# OBJECT_BY.c, skos
cpt:Seniorenschnitzel
   a skos:Concept ;
   skos:broaderTransitive cpt:Schnitzel .


# 12
# COLLECTION.a, context
#   8: wendet_sich_an%20SOME%20Zielgruppe
#     11: Seniorenschnitzel
#       12: Senior



# 12
# SOME.b, owl
:Senior
   a owl:Class ;
    rdfs:subClassOf :Zielgruppe .


# 12
# SOME.c, owl-test
ex:Senior_ID_1820306917
   a :Senior .



# 12
# SOME.g, owl-classification
:SOME_12_restriction
   a owl:Class ;
   rdfs:label "BY 8_wendet_sich_an SOME Senior" ;
   owl:equivalentClass [ a owl:Restriction ;
      owl:onProperty :wendet_sich_an ;
      owl:someValuesFrom :Senior ] .



# 12
# SOME.h, owl-classification
:SOME_12_intersection
   a owl:Class ;
   rdfs:label "(BY 8_wendet_sich_an SOME Senior) INTERSECT 2_Schnitzel" ;
   rdfs:subClassOf :Seniorenschnitzel ;
   owl:equivalentClass [ a owl:Class ;
      owl:intersectionOf (
          :SOME_12_restriction
          :Schnitzel ) ] .



# 12
# SOME.i, owl-test
# Schnitzel wendet_sich_an Senior -> Seniorenschnitzel
ex:Schnitzel_ID_1820306917
   a :Schnitzel ;
   :wendet_sich_an ex:Senior_ID_1820306917 ;
   ex:classifyLike ex:Seniorenschnitzel_ID_1820306917 .
ex:Senior_ID_1820306917
   a :Senior .
ex:Seniorenschnitzel_ID_1820306917
   a :Seniorenschnitzel .



# 13
# COLLECTION.a, context
#   None: None
#     2: Schnitzel
#       13: serviert_an%20SOME%20Sauce



# 13
# BY.a, owl
:serviert_an
   rdf:type owl:ObjectProperty .


# 13
# BY.b, owl
:Sauce
   a owl:Class .


# 13
# BY.c, owl-test
ex:Sauce_ID_1011508176
   a :Sauce .



# 13
# BY.g, owl-classification
:BY_13_restriction
   a owl:Class ;
   rdfs:label "BY serviert_an SOME Sauce" ;
   owl:equivalentClass [ a owl:Restriction ;
      owl:onProperty :serviert_an ;
      owl:someValuesFrom :Sauce ] .



# 13
# BY.h, owl-classification
:BY_13_intersection
   a owl:Class ;
   rdfs:label "(BY serviert_an SOME Sauce) INTERSECT 2_Schnitzel" ;
   rdfs:subClassOf :Schnitzel ;
   owl:equivalentClass [ a owl:Class ;
      owl:intersectionOf (
         :BY_13_restriction
         :Schnitzel ) ] .



# 14
# OBJECT_BY.a, owl
:J%C3%A4gerschnitzel
   a owl:Class ; # 
   rdfs:subClassOf :Schnitzel .


# 14
# OBJECT_BY.b, owl-test
ex:J%C3%A4gerschnitzel_ID_130548072
   a :J%C3%A4gerschnitzel .



# 14
# OBJECT_BY.c, skos
cpt:J%C3%A4gerschnitzel
   a skos:Concept ;
   skos:broaderTransitive cpt:Schnitzel .


# 15
# COLLECTION.a, context
#   13: serviert_an%20SOME%20Sauce
#     14: J%C3%A4gerschnitzel
#       15: Pfifferlinge



# 15
# SOME.b, owl
:Pfifferlinge
   a owl:Class ;
    rdfs:subClassOf :Sauce .


# 15
# SOME.c, owl-test
ex:Pfifferlinge_ID_1609648857
   a :Pfifferlinge .



# 15
# SOME.g, owl-classification
:SOME_15_restriction
   a owl:Class ;
   rdfs:label "BY 13_serviert_an SOME Pfifferlinge" ;
   owl:equivalentClass [ a owl:Restriction ;
      owl:onProperty :serviert_an ;
      owl:someValuesFrom :Pfifferlinge ] .



# 15
# SOME.h, owl-classification
:SOME_15_intersection
   a owl:Class ;
   rdfs:label "(BY 13_serviert_an SOME Pfifferlinge) INTERSECT 2_Schnitzel" ;
   rdfs:subClassOf :J%C3%A4gerschnitzel ;
   owl:equivalentClass [ a owl:Class ;
      owl:intersectionOf (
          :SOME_15_restriction
          :Schnitzel ) ] .



# 15
# SOME.i, owl-test
# Schnitzel serviert_an Pfifferlinge -> J%C3%A4gerschnitzel
ex:Schnitzel_ID_1609648857
   a :Schnitzel ;
   :serviert_an ex:Pfifferlinge_ID_1609648857 ;
   ex:classifyLike ex:J%C3%A4gerschnitzel_ID_1609648857 .
ex:Pfifferlinge_ID_1609648857
   a :Pfifferlinge .
ex:J%C3%A4gerschnitzel_ID_1609648857
   a :J%C3%A4gerschnitzel .



# 16
# OBJECT_BY.a, owl
:Zigeunerschnitzel
   a owl:Class ; # 
   rdfs:subClassOf :Schnitzel .


# 16
# OBJECT_BY.b, owl-test
ex:Zigeunerschnitzel_ID_260209826
   a :Zigeunerschnitzel .



# 16
# OBJECT_BY.c, skos
cpt:Zigeunerschnitzel
   a skos:Concept ;
   skos:broaderTransitive cpt:Schnitzel .


# 17
# COLLECTION.a, context
#   13: serviert_an%20SOME%20Sauce
#     16: Zigeunerschnitzel
#       17: Paprika



# 17
# SOME.b, owl
:Paprika
   a owl:Class ;
    rdfs:subClassOf :Sauce .


# 17
# SOME.c, owl-test
ex:Paprika_ID_1773526489
   a :Paprika .



# 17
# SOME.g, owl-classification
:SOME_17_restriction
   a owl:Class ;
   rdfs:label "BY 13_serviert_an SOME Paprika" ;
   owl:equivalentClass [ a owl:Restriction ;
      owl:onProperty :serviert_an ;
      owl:someValuesFrom :Paprika ] .



# 17
# SOME.h, owl-classification
:SOME_17_intersection
   a owl:Class ;
   rdfs:label "(BY 13_serviert_an SOME Paprika) INTERSECT 2_Schnitzel" ;
   rdfs:subClassOf :Zigeunerschnitzel ;
   owl:equivalentClass [ a owl:Class ;
      owl:intersectionOf (
          :SOME_17_restriction
          :Schnitzel ) ] .



# 17
# SOME.i, owl-test
# Schnitzel serviert_an Paprika -> Zigeunerschnitzel
ex:Schnitzel_ID_1773526489
   a :Schnitzel ;
   :serviert_an ex:Paprika_ID_1773526489 ;
   ex:classifyLike ex:Zigeunerschnitzel_ID_1773526489 .
ex:Paprika_ID_1773526489
   a :Paprika .
ex:Zigeunerschnitzel_ID_1773526489
   a :Zigeunerschnitzel .



# 18
# OBJECT_BY.a, owl
:Rahmschnitzel
   a owl:Class ; # 
   rdfs:subClassOf :Schnitzel .


# 18
# OBJECT_BY.b, owl-test
ex:Rahmschnitzel_ID_1782430077
   a :Rahmschnitzel .



# 18
# OBJECT_BY.c, skos
cpt:Rahmschnitzel
   a skos:Concept ;
   skos:broaderTransitive cpt:Schnitzel .


# 19
# COLLECTION.a, context
#   13: serviert_an%20SOME%20Sauce
#     18: Rahmschnitzel
#       19: Sahne



# 19
# SOME.b, owl
:Sahne
   a owl:Class ;
    rdfs:subClassOf :Sauce .


# 19
# SOME.c, owl-test
ex:Sahne_ID_827143455
   a :Sahne .



# 19
# SOME.g, owl-classification
:SOME_19_restriction
   a owl:Class ;
   rdfs:label "BY 13_serviert_an SOME Sahne" ;
   owl:equivalentClass [ a owl:Restriction ;
      owl:onProperty :serviert_an ;
      owl:someValuesFrom :Sahne ] .



# 19
# SOME.h, owl-classification
:SOME_19_intersection
   a owl:Class ;
   rdfs:label "(BY 13_serviert_an SOME Sahne) INTERSECT 2_Schnitzel" ;
   rdfs:subClassOf :Rahmschnitzel ;
   owl:equivalentClass [ a owl:Class ;
      owl:intersectionOf (
          :SOME_19_restriction
          :Schnitzel ) ] .



# 19
# SOME.i, owl-test
# Schnitzel serviert_an Sahne -> Rahmschnitzel
ex:Schnitzel_ID_827143455
   a :Schnitzel ;
   :serviert_an ex:Sahne_ID_827143455 ;
   ex:classifyLike ex:Rahmschnitzel_ID_827143455 .
ex:Sahne_ID_827143455
   a :Sahne .
ex:Rahmschnitzel_ID_827143455
   a :Rahmschnitzel .

focus_map prints a subset of the mindmap focused on a set of nodes

from rdflib import Graph, URIRef, Literal
import owlrl
graph = Graph()
ttl = o.show_turtle([2])
print(ttl)
# 2
# OBJECT_BY.a, owl
:Schnitzel
   a owl:Class ; # 
   rdfs:subClassOf :None .


# 2
# OBJECT_BY.b, owl-test
ex:Schnitzel_ID_703681491
   a :Schnitzel .



# 2
# OBJECT_BY.c, skos
cpt:Schnitzel
   a skos:Concept ;
   skos:broaderTransitive cpt:None .
namespaces = """
# namespaces to be aligned by the user 
@prefix ex: <http://mm2ttl.net/namespace/ex#> .
@prefix cpt: <http://mm2ttl.net/namespace/x#> .
@prefix : <http://mm2ttl.net/namespace/default#> .

# standard namespaces, c.f. https://www.w3.org/TR/owl2-quick-reference/
@prefix owl: <http://www.w3.org/2002/07/owl#> .
@prefix rdf: <http://www.w3.org/1999/02/22-rdf-syntax-ns#> .
@prefix xml: <http://www.w3.org/XML/1998/namespace> .
@prefix xsd: <http://www.w3.org/2001/XMLSchema#> .
@prefix rdfs: <http://www.w3.org/2000/01/rdf-schema#> .
@prefix skos: <http://www.w3.org/2004/02/skos/core#> .

ex:classifyLike a owl:ObjectProperty .
[ rdf:type owl:Ontology ; owl:imports <http://www.w3.org/2004/02/skos/core> ] .
"""
graph.parse(data = namespaces+ttl, format='ttl')
<Graph identifier=Nbfef66eead1449719eb122244970ab4f (<class 'rdflib.graph.Graph'>)>
len(o.turtle_list)
90
from IPython.display import display, Markdown
display(Markdown("# Hallo <span style='color:red'>ROT</span> und <span style='color:blue'>BLAU</span>"))
txt = """text mit 3 '''!"""
"'''" in txt
True
import re