@@ -215,27 +215,35 @@ def exportrdf(exportType, subdirectory_path: str | None = None):
215215 log .debug ("Generate Foreign types – SPARQL INSERT" )
216216 # Insert all the types and properties that are equivalent or inherited from.
217217 insert_foreign_types = """
218- PREFIX rdf: <http://www.w3.org/1999/02/22-rdf-syntax-ns#>
219- PREFIX rdfs: <http://www.w3.org/2000/01/rdf-schema#>
220- PREFIX owl: <http://www.w3.org/2002/07/owl#>
221-
222- INSERT {
223- ?classNode a rdfs:Class .
224- ?propNode a rdf:Property .
225- }
226- WHERE {
227- # Find Foreign Classes (used in subClassOf or equivalentClass)
228- {
229- { ?s rdfs:subClassOf ?classNode } UNION { ?s owl:equivalentClass ?classNode }
230- FILTER (isURI(?classNode) && !strstarts(str(?classNode), "%s://schema.org"))
231- }
232- UNION
233- # Find Foreign Properties (used in subPropertyOf or equivalentProperty)
234- {
235- { ?s rdfs:subPropertyOf ?propNode } UNION { ?s owl:equivalentProperty ?propNode }
236- FILTER (isURI(?propNode) && !strstarts(str(?propNode), "%s://schema.org"))
237- }
238- }
218+ PREFIX rdf: <http://www.w3.org/1999/02/22-rdf-syntax-ns#>
219+ PREFIX rdfs: <http://www.w3.org/2000/01/rdf-schema#>
220+ PREFIX owl: <http://www.w3.org/2002/07/owl#>
221+
222+ INSERT {
223+ ?classNode a rdfs:Class .
224+ ?propNode a rdf:Property .
225+ }
226+ WHERE {
227+ { # Find Foreign Classes
228+ { ?s rdfs:subClassOf ?classNode } UNION { ?s owl:equivalentClass ?classNode }
229+
230+ FILTER (isURI(?classNode))
231+ FILTER (?classNode != rdfs:Class)
232+ FILTER (?classNode != owl:Class)
233+ FILTER (?classNode != rdf:Property)
234+ FILTER (!strstarts(str(?classNode), "%s://schema.org"))
235+ }
236+ UNION
237+ { # Find Foreign Properties
238+ { ?s rdfs:subPropertyOf ?propNode } UNION { ?s owl:equivalentProperty ?propNode }
239+
240+ FILTER (isURI(?propNode))
241+ FILTER (?propNode != rdf:Property)
242+ FILTER (?propNode != owl:ObjectProperty)
243+ FILTER (?propNode != owl:DatatypeProperty)
244+ FILTER (!strstarts(str(?propNode), "%s://schema.org"))
245+ }
246+ }
239247 """ % (protocol , protocol )
240248
241249 allGraph .update (insert_foreign_types )
0 commit comments