FrameNetKCAP2011
From STLab
Porting FrameNet to the LOD Cloud as Lexical Data and Knowledge Patterns
The SPARQL endpoint is http://wit.istc.cnr.it:8894/sparql
The graph ID for the FROM clause is <famenet_lod>
ABox Refactoring
oxsd = <http://ontologydesignpatterns.org/ont/iks/oxsd.owl#> . oxml = <http://ontologydesignpatterns.org/ont/iks/oxml.owl#> . owl = <http://www.w3.org/2002/07/owl#> . rdf = <http://www.w3.org/1999/02/22-rdf-syntax-ns#>. rdfs = <http://www.w3.org/2000/01/rdf-schema#> . xsd = <http://www.w3.org/2001/XMLSchema#> . composite = <http://www.topbraid.org/2007/05/composite.owl#> . fns = <http://www.ontologydesignpatterns.org/ont/framenet/tbox/> . fnd = <http://www.ontologydesignpatterns.org/ont/framenet/abox/> . /* * * This rule transforms any member of a frame's core set into an individual of the class fns:FrameElement and * add the frame element to the core set through the fns:hasMember object property. This rule is needed * to rename the URIs of the frame elements the compose the core set. * */ internalFeRel[ has(composite:child, ?frame, ?coreSet) . has(composite:child, ?coreSet, ?memberFE) . has(oxml:hasElementDeclaration, ?memberFE, fns:memberFE) . values(oxml:nodeValue, ?memberFE, ?name) . values(oxml:nodeName, ?memberFE, "name"^^xsd:string) . let(?uri, concat( concat( substring( namespace(?memberFE), 0, sub(length(namespace(?memberFE)),1) ) , "/fe/" ), concat( str(?name), concat( ".", substring(localname(?frame), 0, sub(length(localname(?frame)), 6)) ) ) ) ) . newNode(?node, ?uri) . -> is(fns:FrameElement, ?node) . is(owl:ObjectProperty, fns:hasMember) . has(fns:hasMember, ?coreSet, ?node) . ] . /* * * Forward chaining rule: marked with ! * * It renames the URIs of frames in order to have the pattern * http://www.ontologydesignpatterns.org/ont/framenet/frame/<FrameName> . * */ !frameRename[ has(oxml:hasElementDeclaration, ?frame, fns:frame) . has(oxml:hasXMLAttribute, ?frame, ?nameAttr) . values(oxml:nodeValue, ?nameAttr, ?name) . values(oxml:nodeName, ?nameAttr, "name"^^xsd:string) . let( ?uri, concat( concat( substring( namespace(?frame), 0, sub(length(namespace(?frame)),1) ), "/frame/" ), str(?name) ) ) . newNode(?node, ?uri) -> is(fns:Frame, ?node) . has(oxsd:mappedTo, ?frame, ?node) ] . /* * * Forward chaining rule: marked with ! * * It renames the URIs of frame elements in order to have the pattern * http://www.ontologydesignpatterns.org/ont/framenet/fe/<FrameElementName.FrameName> . * Frame elements are defined locally respect to a frame. * */ !renameFE[ has(composite:child, ?frame, ?fe) . has(oxml:hasElementDeclaration, ?fe, fns:FE) . has(oxml:hasXMLAttribute, ?fe, ?xmlAttr) . values(oxml:nodeValue, ?xmlAttr, ?value) . values(oxml:nodeName, ?xmlAttr, "name"^^xsd:string) . let(?uri, concat( concat( substring( namespace(?frame), 0, sub(length(namespace(?frame)),1) ) , "/fe/" ), concat( str(?value), concat( ".", substring(localname(?frame), 0, sub(length(localname(?frame)), 6)) ) ) ) ) . newNode(?node, ?uri) -> is(fns:FrameElement, ?node) . has(oxsd:mappedTo, ?fe, ?node) ] . /* * * Forward chaining rule: marked with ! * * It resolves relations between frame elements. Those are kept by the source as reification of relations. * Each reification refers to a related frame element through the literal "subFrameName" that contains * the name of the frame element. The rule resolves the name to the relative URI the identifies the Frame element * */ !feRelStep1[ has(composite:child, ?frameRelation, ?feRel) . has(oxml:hasXMLAttribute, ?frameRelation, ?subFrame) . values(oxml:nodeValue, ?subFrame, ?subFrameName) . values(oxml:nodeName, ?subFrame, "subFrameName"^^xsd:string) . has(oxml:hasElementDeclaration, ?feRel, fns:FERelation) . has(oxml:hasXMLAttribute, ?feRel, ?subAttr) . values(oxml:nodeValue, ?subAttr, ?subID) . values(oxml:nodeName, ?subAttr, "subFEName"^^xsd:string) . let(?uri, concat( concat( substring( namespace(?feRel), 0, sub(length(namespace(?feRel)),1) ) , "/fe/" ), concat( ?subID, concat( ".", ?subFrameName ) ) ) ) . newNode(?subFE, ?uri) . -> has(oxsd:subFE, ?subFE, ?feRel) . has(oxsd:subFrameElement, ?feRel, ?subFrameName) . ] . /* * * Forward chaining rule: marked with ! * * Once the related frame element is resolved in can be associated through predicates fns:hasSuperFE or * fns:hasSubFE the super or sub frame element. * */ !feRelStep2[ has(composite:child, ?frameRelation, ?feRel) . has(oxml:hasXMLAttribute, ?frameRelation, ?superFrame) . values(oxml:nodeValue, ?superFrame, ?superFrameName) . values(oxml:nodeName, ?superFrame, "superFrameName"^^xsd:string) . has(oxml:hasElementDeclaration, ?feRel, fns:FERelation) . has(oxml:hasXMLAttribute, ?feRel, ?supAttr) . values(oxml:nodeValue, ?supAttr, ?supID) . values(oxml:nodeName, ?supAttr, "superFEName"^^xsd:string) . let(?uri, concat( concat( substring( namespace(?feRel), 0, sub(length(namespace(?feRel)),1) ) , "/fe/" ), concat( ?supID, concat( ".", ?superFrameName ) ) ) ) . newNode(?supFE, ?uri) . has(oxsd:subFE, ?subFE, ?feRel) . has(oxsd:subFrameElement, ?feRel, ?subFrameName) . -> is(owl:ObjectProperty, fns:hasFERelation) . has(rdfs:domain, fns:hasFERelation, fns:FrameElement) . has(rdfs:range, fns:hasFERelation, fns:FrameElement) . is(owl:ObjectProperty, fns:hasSuperFE) . is(owl:ObjectProperty, fns:hasSubFE) . has(rdfs:subPropertyOf, fns:hasSuperFE, fns:hasFERelation) . has(rdfs:subPropertyOf, fns:hasSuperFE, fns:hasFERelation) . has(fns:hasSuperFE, ?subFE, ?supFE) . has(fns:hasSubFE, ?supFE, ?subFE) . has(oxsd:supFrameElement, ?feRel, ?superFrameName) . ] . /* * * Forward chaining rule: marked with ! * * Relations between frame elements have information also about relations between frames * (as each FE is associated univocally to a frame). This rule resolves the name of super frame kept as * a xsd:string into the URI that identifies the frame. Finally it relates the super to its sub frame. */ !superFrame[ has(oxsd:supFrameElement, ?feRel, ?superFrameName) . let(?uri, concat( concat( substring( namespace(?feRel), 0, sub(length(namespace(?feRel)),1) ) , "/frame/" ), ?superFrameName ) ) . newNode(?superFrame, ?uri) -> has(oxsd:superFrame, ?feRel, ?superFrame) . ] . /* * * Forward chaining rule: marked with ! * * Relations between frame elements have information also about relations between frames * (as each FE is associated univocally to a frame). This rule resolves the name of sub frame kept as * a xsd:string into the URI that identifies the frame. */ !subFrame[ has(oxsd:subFrameElement, ?feRel, ?subFrameName) . has(oxsd:superFrame, ?feRel, ?superFrame) . let(?uri, concat( concat( substring( namespace(?feRel), 0, sub(length(namespace(?feRel)),1) ) , "/frame/" ), ?subFrameName ) ) . newNode(?subFrame, ?uri) -> is(owl:ObjectProperty, fns:hasSuperFrame) . has(rdfs:supPropertyOf, fns:hasSuperFrame, fns:hasFrameRelation) . is(owl:ObjectProperty, fns:hasSubFrame) . has(rdfs:supPropertyOf, fns:hasSubFrame, fns:hasFrameRelation) . has(fns:hasSuperFrame, ?subFrame, ?superFrame) . has(fns:hasSubFrame, ?superFrame, ?subFrame) . ] . /* * * Delete rule. * With SemionRules it is possible to embed inside a rule SPARQL code. With sparql-d * it is possible to embed a SPARQL Delete. This delete removes oll the triples that * have oxsd:subFrameElement as predicate. We used that predicate as for practical reasons in previous * rules it is not really needed in the output datase. * */ deleteSubFrameElement[ sparql-d( % PREFIX oxsd: <http://ontologydesignpatterns.org/ont/iks/oxsd.owl#> PREFIX oxml: <http://ontologydesignpatterns.org/ont/iks/oxml.owl#> PREFIX owl: <http://www.w3.org/2002/07/owl#> PREFIX rdf: <http://www.w3.org/1999/02/22-rdf-syntax-ns#> PREFIX rdfs: <http://www.w3.org/2000/01/rdf-schema#> PREFIX xsd: <http://www.w3.org/2001/XMLSchema#> PREFIX fns: <http://www.ontologydesignpatterns.org/ont/framenet/tbox/> DELETE {?s1 ?p ?o1} WHERE{?s1 ?p ?o1 . FILTER(?p = oxsd:subFrameElement)} % ) ] . /* * * Delete rule. * With SemionRules it is possible to embed inside a rule SPARQL code. With sparql-d * it is possible to embed a SPARQL Delete. This delete removes oll the triples that * have oxsd:superFrame as predicate. We used that predicate as for practical reasons in previous * rules it is not really needed in the output datase. * */ deleteSuperFrame[ sparql-d( % PREFIX oxsd: <http://ontologydesignpatterns.org/ont/iks/oxsd.owl#> PREFIX oxml: <http://ontologydesignpatterns.org/ont/iks/oxml.owl#> PREFIX owl: <http://www.w3.org/2002/07/owl#> PREFIX rdf: <http://www.w3.org/1999/02/22-rdf-syntax-ns#> PREFIX rdfs: <http://www.w3.org/2000/01/rdf-schema#> PREFIX xsd: <http://www.w3.org/2001/XMLSchema#> PREFIX fns: <http://www.ontologydesignpatterns.org/ont/framenet/tbox/> DELETE {?s1 ?p ?o1} WHERE{?s1 ?p ?o1 . FILTER(?p = oxsd:superFrame)} % ) ] . /* * * Delete rule. * With SemionRules it is possible to embed inside a rule SPARQL code. With sparql-d * it is possible to embed a SPARQL Delete. This delete removes oll the triples that * have oxsd:superFrameElement as predicate. We used that predicate as for practical reasons in previous * rules it is not really needed in the output datase. * */ deleteSuperFrameElement[ sparql-d( % PREFIX oxsd: <http://ontologydesignpatterns.org/ont/iks/oxsd.owl#> PREFIX oxml: <http://ontologydesignpatterns.org/ont/iks/oxml.owl#> PREFIX owl: <http://www.w3.org/2002/07/owl#> PREFIX rdf: <http://www.w3.org/1999/02/22-rdf-syntax-ns#> PREFIX rdfs: <http://www.w3.org/2000/01/rdf-schema#> PREFIX xsd: <http://www.w3.org/2001/XMLSchema#> PREFIX fns: <http://www.ontologydesignpatterns.org/ont/framenet/tbox/> DELETE {?s1 ?p ?o1} WHERE{?s1 ?p ?o1 . FILTER(?p = oxsd:supFrameElement)} % ) ] . /* * * Delete rule. * With SemionRules it is possible to embed inside a rule SPARQL code. With sparql-d * it is possible to embed a SPARQL Delete. This delete removes oll the triples that * have oxsd:subFE as predicate. We used that predicate as for practical reasons in previous * rules it is not really needed in the output datase. * */ deleteSuperFE[ sparql-d( % PREFIX oxsd: <http://ontologydesignpatterns.org/ont/iks/oxsd.owl#> PREFIX oxml: <http://ontologydesignpatterns.org/ont/iks/oxml.owl#> PREFIX owl: <http://www.w3.org/2002/07/owl#> PREFIX rdf: <http://www.w3.org/1999/02/22-rdf-syntax-ns#> PREFIX rdfs: <http://www.w3.org/2000/01/rdf-schema#> PREFIX xsd: <http://www.w3.org/2001/XMLSchema#> PREFIX fns: <http://www.ontologydesignpatterns.org/ont/framenet/tbox/> DELETE {?s1 ?p ?o1} WHERE{?s1 ?p ?o1 . FILTER(?p = oxsd:subFE)} % ) ] . /* * * Forward chaining rule: marked with ! * * This rule renames lexemes' URi. * The URI for lexemes should follow the pattern * http://www.ontologydesignpatterns.org/ont/framenet/lexeme/<lexemeName> * */ lexemeRename[ has(composite:child, ?frame, ?lexeme) . has(oxml:hasElementDeclaration, ?lexeme, fns:lexeme) . has(oxml:hasXMLAttribute, ?lexeme, ?nameAttr) . values(oxml:nodeValue, ?nameAttr, ?name) . values(oxml:nodeName, ?nameAttr, "name"^^xsd:string) . let( ?uri, concat( concat( substring( namespace(?lexeme), 0, sub(length(namespace(?lexeme)),1) ), "/lexeme/" ), str(?name) ) ) . newNode(?node, ?uri) -> is(fns:Lexeme, ?node) . has(oxsd:mappedTo, ?lexeme, ?node) ] . /* * * Forward chaining rule: marked with ! * * This rule rename URis for semantic types. * The URI for semantic types should follow the pattern * http://www.ontologydesignpatterns.org/ont/framenet/semType/<semanticTypeName> * */ !semTypeRename[ has(oxml:hasElementDeclaration, ?semType, fns:semType) . has(oxml:hasXMLAttribute, ?semType, ?nameAttr) . values(oxml:nodeValue, ?nameAttr, ?name) . values(oxml:nodeName, ?nameAttr, "name"^^xsd:string) . let( ?uri, concat( concat( substring( namespace(?semType), 0, sub(length(namespace(?semType)),1) ), "/semType/" ), str(?name) ) ) . newNode(?node, ?uri) -> is(fns:SemType, ?node) . has(oxsd:mappedTo, ?semType, ?node) ] . /* * * Some lexical unit are stored (in frames) in the original source as literals (xsd:string). * This rule transforms each literal representing a lexical unit into a URI reference. * The pattern for renaming this kind of URI is * http://www.ontologydesignpatterns.org/ont/framenet/lu/<lexicalUnitName> */ lexUnitRel[ has(oxml:hasElementDeclaration, ?lexUnit, fns:lexUnit) . has(oxml:hasXMLAttribute, ?lexUnit, ?nameAttr) . values(oxml:nodeValue, ?nameAttr, ?name) . values(oxml:nodeName, ?nameAttr, "name"^^xsd:string) . let( ?uri, concat( concat( substring( namespace(?lexUnit), 0, sub(length(namespace(?lexUnit)),1) ), "/lu/" ), str(?name) ) ) . newNode(?node, ?uri) -> is(fns:LexUnit, ?node) . has(oxsd:mappedTo, ?lexUnit, ?node) ] . /* * * The relation fns:requiresFE should refer to a FrameElement and not to a literal * This rule resolves the URI associated to a frame element from its name stored in the "name" * attribute of "requiresFE" element of the original source. */ requiresFEl[ has(composite:child, ?frame, ?fe1) . has(composite:child, ?fe1, ?fe) . has(oxml:hasElementDeclaration, ?fe, fns:requiresFE) . has(oxml:hasXMLAttribute, ?fe, ?feID) . values(oxml:nodeValue, ?feID, ?id) . values(oxml:nodeName, ?feID, "name"^^xsd:string) . let(?uri, concat( concat( substring( namespace(?memberFE), 0, sub(length(namespace(?memberFE)),1) ) , "/fe/" ), concat( str(?id), concat( ".", substring(localname(?frame), 0, sub(length(localname(?frame)), 6)) ) ) ) ) . newNode(?node, ?uri) . newNode(?requires, "http://www.ontologydesignpatterns.org/ont/framenet/tbox/requires") -> is(fns:FrameElement, ?node) . has(?requires, ?fe1, ?node) . is(owl:ObjectProperty, ?requires) . has(rdfs:subPropertyOf, ?requires, fns:hasFERelation) . ] . /* * * The relation fns:excludesFE should refer to a FrameElement and not to a literal * This rule resolves the URI associated to a frame element from its name stored in the "name" * attribute of "excludesFE" element of the original source. */ excludesFEl[ has(composite:child, ?frame, ?fe1) . has(composite:child, ?fe1, ?fe) . has(oxml:hasElementDeclaration, ?fe, fns:excludesFE) . has(oxml:hasXMLAttribute, ?fe, ?feID) . values(oxml:nodeValue, ?feID, ?id) . values(oxml:nodeName, ?feID, "name"^^xsd:string) . let(?uri, concat( concat( substring( namespace(?memberFE), 0, sub(length(namespace(?memberFE)),1) ) , "/fe/" ), concat( str(?id), concat( ".", substring(localname(?frame), 0, sub(length(localname(?frame)), 6)) ) ) ) ) . newNode(?node, ?uri) . newNode(?excludes, "http://www.ontologydesignpatterns.org/ont/framenet/tbox/excludes") -> is(fns:FrameElement, ?node) . has(?excludes, ?fe1, ?node) . is(owl:ObjectProperty, ?excludes) . has(rdfs:subPropertyOf, ?excludes, fns:hasFERelation) . ] . /* * * Forward chaining rule: marked with ! * * It transforms each attribute of an attribute group to a datatype poperty (it comes from the general * recipe fro XML). */ !attributeGroup2dataproperty[ is(oxsd:AttributeGroup, ?group) . has(oxsd:hasAttribute, ?group, ?attr) . has(oxsd:hasType, ?attr, ?type) . has(oxsd:hasRestriction, ?type, ?restr) . has(oxsd:hasBase, ?restr, ?baseType) . has(oxsd:hasRestriction, ?type, ?restr) . has(oxsd:hasBase, ?restr, ?baseType) -> is(owl:DatatypeProperty, ?attr) . has(rdfs:range, ?attr, ?baseType) ] . !attribute2dataproperty2[ is(oxsd:Attribute, ?attr) . has(oxsd:hasType, ?attr, ?type) . same(namespace(?type), "http://www.w3.org/2001/XMLSchema#") -> is(owl:DatatypeProperty, ?attr) . has(rdfs:range, ?attr, ?type) ] . /* * * Forward chaining rule: marked with ! * * Frame-to-frame relations are stored as reification. They should be resolved. * This is the first step of two in order to associate a frame (from a literal) first to a URI * and then to the frame with which a relation exists. The URI of a frame is built starting from the * name of a frame kept into the node value of the frameRelation element. The type of the realtion * is retrieved from the attribute type of the frameRelation element and resolved to a predicate. */ !frameRelationStep1[ has(composite:child, ?frame, ?xmlElem) . has(oxml:hasElementDeclaration, ?frame, ?frameType) . has(oxml:hasElementDeclaration, ?xmlElem, fns:frameRelation) . has(oxml:hasXMLAttribute, ?xmlElem, ?xmlAttr) . values(oxml:nodeValue, ?xmlAttr, ?value) . values(oxml:nodeName, ?xmlAttr, "type"^^xsd:string) . has(composite:child, ?xmlElem, ?child) . values(oxml:nodeValue, ?child, ?childValue) . let( ?str, prop( namespace(?frameType), str(?value) ) ) . newNode(?rel, ?str) . newNode(?frame2, ?uri) -> is(owl:ObjectProperty, ?rel) . is(owl:ObjectProperty, fns:hasFrameRelation) . has(rdfs:subPropertyOf, ?rel, fns:hasFrameRelation) . values(oxsd:mappingRelation, ?rel, ?value) . has(rdfs:range, fns:hasFrameRelation, <http://www.ontologydesignpatterns.org/ont/framenet/tbox/Frame>) . has(rdfs:domain, fns:hasFrameRelation, <http://www.ontologydesignpatterns.org/ont/framenet/tbox/Frame>) ] . /* * * This is the second step of two in order to associate a frame (from a literal) first to a URI * and then to the frame with which a relation exists. It simply generate the relation through * the triple <?frame ?rel ?frame2> */ frameRelationsStep2[ has(composite:child, ?frame, ?xmlElem) . has(oxml:hasElementDeclaration, ?frame, ?frameType) . has(oxml:hasElementDeclaration, ?xmlElem, fns:frameRelation) . has(oxml:hasXMLAttribute, ?xmlElem, ?xmlAttr) . values(oxml:nodeValue, ?xmlAttr, ?value) . values(oxml:nodeName, ?xmlAttr, "type"^^xsd:string) . values(oxsd:mappingRelation, ?rel, ?value) . has(composite:child, ?xmlElem, ?child) . values(oxml:nodeValue, ?child, ?childValue) . let( ?uri, concat( namespace(?frame), concat( "frame/", ?childValue ) ) ) . newNode(?frame2, ?uri) -> has(?rel, ?frame, ?frame2) . is(owl:ObjectProperty, ?rel) . ] . /* * * It converts a complex type to an owl:Class. We have a filter to some complex type ("different" atoms) * because to transform those types in a different way. */ !complexType2Class[ is(oxsd:ComplexType, ?type) . not(isBlank(?type)) . let(?uri, concat( namespace(?type), concat( substring(upperCase(localname(?type)), 0, 1), substring(localname(?type), 1, sub(length(localname(?type)), 4) ) ) ) ) . newNode(?classNode, ?uri) . different(localname(?classNode), "RelatedFrames") . different(localname(?classNode), "FrameRelations") . different(localname(?classNode), "FrameRelationType") . different(localname(?classNode), "FERelation") . different(localname(?classNode), "SemTypeRef") . different(localname(?classNode), "FrameLU") . different(localname(?classNode), "FE") -> is(owl:Class, ?classNode) . has(oxsd:mappedTo, ?type, ?classNode) ] . /* * * All the omitted classes into the rule "complexType2Class" are now transformed individually. * */ !frameElementClass[ is(oxsd:ComplexType, ?type) . not(isBlank(?type)) . newNode(?classNode, ?uri) . same(localname(?type), "FEType") . let( ?uri, concat( namespace(?type), "FrameElement" ) ) . newNode(?classNode, ?uri) . -> is(owl:Class, ?classNode) . has(oxsd:mappedTo, ?type, ?classNode) ] . !semTypeClass[ is(oxsd:ComplexType, ?type) . not(isBlank(?type)) . newNode(?classNode, ?uri) . same(localname(?type), "semTypeRefType") . let( ?uri, concat( namespace(?type), "SemType" ) ) . newNode(?classNode, ?uri) . -> is(owl:Class, ?classNode) . has(oxsd:mappedTo, ?type, ?classNode) ] . !lexUnitClass[ is(oxsd:ComplexType, ?type) . not(isBlank(?type)) . newNode(?classNode, ?uri) . same(localname(?type), "frameLUType") . let( ?uri, concat( namespace(?type), "LexUnit" ) ) . newNode(?classNode, ?uri) . -> is(owl:Class, ?classNode) . has(oxsd:mappedTo, ?type, ?classNode) ] . /* * * Each blank node that is an individual of the class oxsd:ComplexType is transformed to an * owl:Class. The URI of the node is built starting from the name of the element that uses that complex type. * */ !blankComplexType2Class[ is(oxsd:ComplexType, ?type) . isBlank(?type) . has(oxsd:hasType, ?elem, ?type) . let(?uri, concat( namespace(?elem), concat( substring(upperCase(localname(?elem)), 0, 1), substring(localname(?elem), 1, length(localname(?elem))) ) ) ) . newNode(?classNode, ?uri) . different(localname(?classNode), "RelatedFrames") . different(localname(?classNode), "FrameRelation") . different(localname(?classNode), "FrameRelations") . different(localname(?classNode), "FrameRelationType") . different(localname(?classNode), "FERelation") . different(localname(?classNode), "SemTypeRef") . different(localname(?classNode), "FrameLU") . different(localname(?classNode), "FE") -> is(owl:Class, ?classNode) . has(oxsd:mappedTo, ?type, ?classNode) ] . /* * * Each element is transformed to an object property (general recipe for XML). * */ !elementObjectProperty1[ is(oxsd:Element, ?elem) . has(oxsd:hasType, ?elem, ?type) . is(oxsd:ComplexType, ?type) . has(oxsd:mappedTo, ?type, ?class) . let(?uri, concat(namespace(?elem), concat("has", localname(?class)))) . has(oxsd:hasSequence, ?type2, ?seq) . has(oxsd:hasElement, ?seq, ?elem) . has(oxsd:mappedTo, ?type2, ?class2) . newNode(?objProp, ?uri) -> is(owl:ObjectProperty, ?objProp) . has(rdfs:range, ?objProp, ?class) . has(rdfs:domain, ?objProp, ?class2) . has(oxsd:mappedTo, ?elem, ?objProp) ] . /* * * Each element is transformed to an object property (general recipe for XML). * */ !elementObjectProperty2[ is(oxsd:Element, ?elem) . has(oxsd:mappedTo, ?elem, notex(?objProp)) . has(oxsd:hasComplexType, ?elem, ?type) . has(oxsd:mappedTo, ?type, ?class) . let(?uri, concat(namespace(?elem), concat("has", localname(?class)))) -> is(owl:ObjectProperty, ?objProp) . has(oxsd:hasRange, ?objProp, ?class) . has(oxsd:hasDomain, ?objProp, owl:Thing) . has(oxsd:mappedTo, ?elem, ?objProp) ] . /* * * Each xml element (from data and not from XSD) is transformed to a individual of the class * genearated from the complex type of the element declaration in the XSD if it exists. * */ !individualRule[ is(oxml:XMLElement, ?xml) . has(oxml:hasElementDeclaration, ?xml, ?elem) . has(oxsd:hasType, ?elem, ?type) . is(oxsd:ComplexType, ?type) . has(oxsd:mappedTo, ?type, ?class) . is(owl:Class, ?class) -> is(?class, ?xml) . is(owl:NamedIndividual, ?xml) ] . /* * * Each composite:child that identifies the annidation of two elements is resolved as a relation between two * individual (created with the previous rule). The prepdicate of the relation is the object property generated by * the element declaration of the inner one. * */ !individualRelationRule[ has(composite:child, ?xml, ?child) . is(owl:NamedIndividual, ?xml) . is(owl:NamedIndividual, ?child) . has(oxml:hasElementDeclaration, ?child, ?elem) . has(oxsd:mappedTo, ?elem, ?objProp) -> has(?objProp, ?xml, ?child) ] . /* * * If the type of an element in the XSD is a simple type then an owl:DatatypeProperty is created * instead of an owl:ObjectProperty (general recipe for XML). * */ !elementDataPropertyCreation1[ is(oxsd:Element, ?elem) . has(oxsd:hasType, ?elem, ?type) . is(oxsd:SimpleType, ?type) . newNode(?dtProp, ?uri) . has(oxsd:hasRestriction, ?type, ?restr) . has(oxsd:hasBase, ?restr, ?baseType) -> is(owl:DatatypeProperty, ?elem) . has(oxsd:hasRange, ?elem, ?baseType) ] . /* * * If the type of an element in the XSD is a basic XSD type then an owl:DatatypeProperty is created * instead of an owl:ObjectProperty (general recipe for XML). * */ !elementDataPropertyCreation2[ is(oxsd:Element, ?elem) . has(oxsd:hasType, ?elem, ?type) . same(namespace(?type), "http://www.w3.org/2001/XMLSchema#") -> is(owl:DatatypeProperty, ?elem) . has(oxsd:hasRange, ?elem, ?baseType) ] . /* * * Each attribute is mapped to an owl:DatatypeProperty (genearl recipe for XML). * */ !attribute2dataproperty[ is(oxsd:Attribute, ?attr) . has(oxsd:hasType, ?attr, ?type) . has(oxsd:hasRestriction, ?type, ?restr) . has(oxsd:hasBase, ?restr, ?baseType) . has(oxsd:hasRestriction, ?type, ?restr) . has(oxsd:hasBase, ?restr, ?baseType) -> is(owl:DatatypeProperty, ?attr) . has(rdfs:range, ?attr, ?baseType) ] . /* * * If an inner element an element does not contain other elements but text then a triple where the element * declaration of the inner one is the predicate is created. * */ !individualDTP1[ has(composite:child, ?xml, ?child) . is(owl:NamedIndividual, ?xml) . values(oxml:nodeValue, ?child, ?value) . has(oxml:hasElementDeclaration, ?child, ?elem) -> values(?elem, ?xml, ?value) ] . /* * * If an inner element an element does not contain other elements but text then a triple where the element * declaration of the inner one is the predicate is created. * */ !individualDTP2[ is(owl:NamedIndividual, ?xml) . has(oxml:hasXMLAttribute, ?xml, ?xmlAttr) . has(oxml:hasAttributeDeclaration, ?xmlAttr, ?attr) . values(oxml:nodeValue, ?xmlAttr, ?value) -> values(?attr, ?xml, ?value) ] . /* * * Create ranges if the range is unique. * */ singleOPRangeRule[ sparql-c( % PREFIX oxsd: <http://ontologydesignpatterns.org/ont/iks/oxsd.owl#> PREFIX oxml: <http://ontologydesignpatterns.org/ont/iks/oxml.owl#> PREFIX owl: <http://www.w3.org/2002/07/owl#> PREFIX rdf: <http://www.w3.org/1999/02/22-rdf-syntax-ns#> PREFIX rdfs: <http://www.w3.org/2000/01/rdf-schema#> PREFIX xsd: <http://www.w3.org/2001/XMLSchema#> CONSTRUCT {?objProp rdfs:range ?range} WHERE { SELECT ?objProp ?range (COUNT(?range) AS ?ranges) { ?objProp rdf:type owl:ObjectProperty . ?objProp oxsd:hasRange ?range } GROUP BY ?objProp ?range HAVING (?ranges = 1) } % ) ] . /* * * Create domains if the domain is unique. * */ singleOPDomainRule[ sparql-c( % PREFIX oxsd: <http://ontologydesignpatterns.org/ont/iks/oxsd.owl#> PREFIX oxml: <http://ontologydesignpatterns.org/ont/iks/oxml.owl#> PREFIX owl: <http://www.w3.org/2002/07/owl#> PREFIX rdf: <http://www.w3.org/1999/02/22-rdf-syntax-ns#> PREFIX rdfs: <http://www.w3.org/2000/01/rdf-schema#> PREFIX xsd: <http://www.w3.org/2001/XMLSchema#> CONSTRUCT {?objProp rdfs:domain ?domain} WHERE { SELECT ?objProp ?domain (COUNT(?domain) AS ?domains) { ?objProp rdf:type owl:ObjectProperty . ?objProp oxsd:hasDomain ?domain } GROUP BY ?objProp HAVING (?domains = 1) } % ) ] . /* * * Reflexive rule (marked with +). It means the both the body and the head of the rule are evaluated on the target graph. * * Change the any occurrence of the property fns:frameLUType_ID with fns:basicLUAttributes_ID * */ +normalizeFrameLUType_ID[ values(fns:frameLUType_ID, ?x, ?y) -> values(fns:basicLUAttributes_ID, ?x, ?y) ] . /* * * Delete any occurrence of the property fns:frameLUType_ID * */ deletFrameLUType_ID[ sparql-d( % PREFIX fns: <http://www.ontologydesignpatterns.org/ont/framenet/tbox/> DELETE {?s fns:frameLUType_ID ?o} WHERE { ?s fns:frameLUType_ID ?o } % ) ] . /* * * Reflexive rule (marked with +). It means the both the body and the head of the rule are evaluated on the target graph. * * Change the any occurrence of the property fns:frameLUType_incorporatedFE with fns:basicLUAttributes_incorporatedFE * */ +normalizeFrameLUType_incorporatedFE[ values(fns:frameLUType_incorporatedFE, ?x, ?y) -> values(fns:basicLUAttributes_incorporatedFE, ?x, ?y) ] . /* * * Delete any occurrence of the property fns:frameLUType_incorporatedFE * */ deletFrameLUType_incorporatedFE[ sparql-d( % PREFIX fns: <http://www.ontologydesignpatterns.org/ont/framenet/tbox/> DELETE {?s fns:frameLUType_incorporatedFE ?o} WHERE { ?s fns:frameLUType_incorporatedFE ?o } % ) ] . /* * * Reflexive rule (marked with +). It means the both the body and the head of the rule are evaluated on the target graph. * * Change the any occurrence of the property fns:frameLUType_name with fns:basicLUAttributes_name * */ +normalizeFrameLUType_name[ values(fns:frameLUType_name, ?x, ?y) -> values(fns:basicLUAttributes_name, ?x, ?y) ] . /* * * Delete any occurrence of the property fns:frameLUType_name * */ deletFrameLUType_name[ sparql-d( % PREFIX fns: <http://www.ontologydesignpatterns.org/ont/framenet/tbox/> DELETE {?s fns:frameLUType_name ?o} WHERE { ?s fns:frameLUType_name ?o } % ) ] . /* * * Reflexive rule (marked with +). It means the both the body and the head of the rule are evaluated on the target graph. * * Change the any occurrence of the property fns:frameLUType_POS with fns:basicLUAttributes_POS * */ +normalizeFrameLUType_POS[ values(fns:frameLUType_POS, ?x, ?y) -> values(fns:basicLUAttributes_POS, ?y, ?y) ] . /* * * Delete any occurrence of the property fns:frameLUType_POS * */ deletFrameLUType_POS[ sparql-d( % PREFIX fns: <http://www.ontologydesignpatterns.org/ont/framenet/tbox/> DELETE {?s fns:frameLUType_POS ?o} WHERE { ?s fns:frameLUType_POS ?o } % ) ] . /* * * Reflexive rule (marked with +). It means the both the body and the head of the rule are evaluated on the target graph. * * Change the any occurrence of the property fns:frameLUType_status with fns:basicLUAttributes_status * */ +normalizeFrameLUType_status[ values(fns:frameLUType_status, ?x, ?y) -> values(fns:basicLUAttributes_status, ?x, ?y) ] . /* * * Delete any occurrence of the property fns:frameLUType_status * */ deletFrameLUType_status[ sparql-d( % PREFIX fns: <http://www.ontologydesignpatterns.org/ont/framenet/tbox/> DELETE {?s fns:frameLUType_status ?o} WHERE { ?s fns:frameLUType_status ?o } % ) ] . /* * * Reflexive rule (marked with +). It means the both the body and the head of the rule are evaluated on the target graph. * * The mappedTo property means that the subject of the triple has been renamed to the object. So that any trilpe that had the subject as subject * should be true also having as subject the object. * */ +semanticClosureSingleOne[ has(oxsd:mappedTo, ?old, ?new) . has(?anyP1, ?old, ?anyO) . different(str(?new), str(?anyO)) -> has(?anyP1, ?new, ?anyO) ] . /* * * Reflexive rule (marked with +). It means the both the body and the head of the rule are evaluated on the target graph. * * The mappedTo property means that the subject of the triple has been renamed to the object. So that any trilpe that had the subject as object * should be true also having as object the object. * */ +semanticClosureSingleTwo[ has(oxsd:mappedTo, ?old, ?new) . has(?anyP2, ?anyS, ?old) -> has(?anyP2, ?anyS, ?new) ] . /* * * Next rules clear the dataset from everything is not needed or created during previous inferencing. * */ deleteMappedToSingleTwo[ sparql-d( % PREFIX oxsd: <http://ontologydesignpatterns.org/ont/iks/oxsd.owl#> PREFIX oxml: <http://ontologydesignpatterns.org/ont/iks/oxml.owl#> PREFIX owl: <http://www.w3.org/2002/07/owl#> PREFIX rdf: <http://www.w3.org/1999/02/22-rdf-syntax-ns#> PREFIX rdfs: <http://www.w3.org/2000/01/rdf-schema#> PREFIX xsd: <http://www.w3.org/2001/XMLSchema#> DELETE {?s1 ?p1 ?s} WHERE { ?s oxsd:mappedTo ?o . ?s1 ?p1 ?s } % ) ] . deleteMappedToSingleOne[ sparql-d( % PREFIX oxsd: <http://ontologydesignpatterns.org/ont/iks/oxsd.owl#> PREFIX oxml: <http://ontologydesignpatterns.org/ont/iks/oxml.owl#> PREFIX owl: <http://www.w3.org/2002/07/owl#> PREFIX rdf: <http://www.w3.org/1999/02/22-rdf-syntax-ns#> PREFIX rdfs: <http://www.w3.org/2000/01/rdf-schema#> PREFIX xsd: <http://www.w3.org/2001/XMLSchema#> DELETE {?s ?p1 ?o1} WHERE { ?s oxsd:mappedTo ?o . ?s ?p1 ?o1 } % ) ] . deleteMappedLastMappingTo[ sparql-d( % PREFIX oxsd: <http://ontologydesignpatterns.org/ont/iks/oxsd.owl#> PREFIX oxml: <http://ontologydesignpatterns.org/ont/iks/oxml.owl#> PREFIX owl: <http://www.w3.org/2002/07/owl#> PREFIX rdf: <http://www.w3.org/1999/02/22-rdf-syntax-ns#> PREFIX rdfs: <http://www.w3.org/2000/01/rdf-schema#> PREFIX xsd: <http://www.w3.org/2001/XMLSchema#> DELETE {?s ?p ?o} WHERE { ?s ?p ?o . FILTER(?p = oxsd:mappedTo) } % ) ] . deleteHasRange[ sparql-d( % PREFIX oxsd: <http://ontologydesignpatterns.org/ont/iks/oxsd.owl#> PREFIX oxml: <http://ontologydesignpatterns.org/ont/iks/oxml.owl#> PREFIX owl: <http://www.w3.org/2002/07/owl#> PREFIX rdf: <http://www.w3.org/1999/02/22-rdf-syntax-ns#> PREFIX rdfs: <http://www.w3.org/2000/01/rdf-schema#> PREFIX xsd: <http://www.w3.org/2001/XMLSchema#> PREFIX fns: <http://www.ontologydesignpatterns.org/ont/framenet/tbox/> DELETE {?s ?p ?o} WHERE{?s ?p ?o . FILTER(?p = oxsd:hasRange)} % ) ] . deleteMappingRelation[ sparql-d( % PREFIX oxsd: <http://ontologydesignpatterns.org/ont/iks/oxsd.owl#> PREFIX oxml: <http://ontologydesignpatterns.org/ont/iks/oxml.owl#> PREFIX owl: <http://www.w3.org/2002/07/owl#> PREFIX rdf: <http://www.w3.org/1999/02/22-rdf-syntax-ns#> PREFIX rdfs: <http://www.w3.org/2000/01/rdf-schema#> PREFIX xsd: <http://www.w3.org/2001/XMLSchema#> PREFIX fns: <http://www.ontologydesignpatterns.org/ont/framenet/tbox/> DELETE {?s ?p ?o} WHERE{?s ?p ?o . FILTER(?p = oxsd:mappingRelation)} % ) ] . +feCoreSet[ is(fns:hasFEcoreSet, ?coreSet) . newNode(?feCoreSet, "FECoreSet") . -> is(owl:Class, fns:FECoreSet) . is(fns:FECoreSet, ?coreSet) ] . deletEHasFECoreSetAsClass1[ sparql-d( % PREFIX fns: <http://www.ontologydesignpatterns.org/ont/framenet/tbox/> PREFIX rdf: <http://www.w3.org/1999/02/22-rdf-syntax-ns#> PREFIX owl: <http://www.w3.org/2002/07/owl#> DELETE { ?s rdf:type fns:hasFEcoreSet . fns:hasFEcoreSet rdf:type owl:Class } WHERE { ?s rdf:type fns:hasFEcoreSet } % ) ] . +semTypeRelations[ is(fns:SemType, ?semType) . has(fns:hasSuperType, ?semType, ?supTypeRef) . values(fns:superType_superTypeName, ?supTypeRef, ?semTypeRelatedName) . let( ?relatedSuperTypeURI, concat( namespace(?semType), ?semTypeRelatedName ) ) . newNode(?relatedSuperType, ?relatedSuperTypeURI) -> has(fns:hasSuperType, ?semType, ?relatedSuperType) ] . deleteSemTypeRelations2[ sparql-d( % PREFIX fns: <http://www.ontologydesignpatterns.org/ont/framenet/tbox/> PREFIX rdf: <http://www.w3.org/1999/02/22-rdf-syntax-ns#> PREFIX owl: <http://www.w3.org/2002/07/owl#> DELETE { ?s ?p ?superType } WHERE { ?superType rdf:type fns:SuperType . ?s ?p ?superType } % ) ] . deleteSemTypeRelations1[ sparql-d( % PREFIX fns: <http://www.ontologydesignpatterns.org/ont/framenet/tbox/> PREFIX rdf: <http://www.w3.org/1999/02/22-rdf-syntax-ns#> PREFIX owl: <http://www.w3.org/2002/07/owl#> DELETE { ?superType ?p ?o } WHERE { ?superType rdf:type fns:SuperType . ?superType ?p ?o } % ) ] . deleteSuperTypeClass[ sparql-d( % PREFIX fns: <http://www.ontologydesignpatterns.org/ont/framenet/tbox/> PREFIX rdf: <http://www.w3.org/1999/02/22-rdf-syntax-ns#> PREFIX owl: <http://www.w3.org/2002/07/owl#> DELETE { fns:SuperType ?p ?o } WHERE { fns:SuperType ?p ?o } % ) ] . +subFramesNameNormalization[ has(?s, <http://www.ontologydesignpatterns.org/ont/framenet/tbox/hasSubframe(s)>, ?y) -> has(?s, fns:hasSubframe, ?y) ] . deletesubFramesNameWithPar[ sparql-d( % PREFIX fns: <http://www.ontologydesignpatterns.org/ont/framenet/tbox/> DELETE { ?s <http://www.ontologydesignpatterns.org/ont/framenet/tbox/hasSubframe(s)> ?o } WHERE { ?s <http://www.ontologydesignpatterns.org/ont/framenet/tbox/hasSubframe(s)> ?o } % ) ]