MarcOnt/RDFTranslator/SampleTransformationRules

From Corrib Clan Wiki

Jump to: navigation, search
<?xml version="1.0" encoding="UTF-8"?>
<TranslationRules xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#">
	<namespace name="rdf" uri="http://www.w3.org/1999/02/22-rdf-syntax-ns#"/>
	<namespace name="rdfs" uri="http://www.w3.org/2000/01/rdf-schema#"/> 
	<namespace name="marcont" uri="http://www.marcont.org/ontology#"/>
	<namespace name="foaf" uri="http://xmlns.com/foaf/0.1/"/>
	<namespace name="marcrdf" uri="http://www.marcont.org/marcrdf#"/>

	
	
	<rule name="r1">
               <premise>	 		
                       <subject value=""/>
			<predicate value="rdf:type"/>
			<object value="http://www.marcont.org/ontology/Material"/>
		</premise>
               <premise>
			<subject value="{$PS0}"/>
			<predicate value="marcrdf:hasLeader"/>
                       <object value=""/>
		</premise>
		<premise>
			<subject value="{$PO1}"/>
			<predicate value="rdf:_7"/>
			<object regexp="[at]"/>
		</premise>

		
		<consequent>
			<subject value="{marcont:clone($PS0, 'marcont:')}"/>
			<predicate value="rdf:type"/>
			<object value="marcont:Book"/>
		</consequent>
               <call rule_name="r2">
			<with-param name="IDmarcrdf" value="{$PS0}"/>
			<with-param name="IDmarcont" value="{$CS0}"/>
		</call>
		<call rule_name="r4">
			<with-param name="IDmarcrdf" value="{$PS0}"/>
			<with-param name="IDmarcont" value="{$CS0}"/>
               </call>
		
		<terminate/>
	</rule>

	
	<rule name="r2">
		<param name="IDmarcrdf"/>
		<param name="IDmarcont"/>
	
		<premise>
			<subject value="{$IDmarcrdf}"/>
			<predicate value="marcrdf:hasDatafield"/>
			<object value=""/>
		</premise>
		<premise>
			<subject value="{$PO0}"/>
			<predicate value="marcrdf:tag"/>
			<object value="100" rdf:datatype="http://www.w3.org/2001/XMLSchema#string"/>
		</premise>

		
		<consequent>
			<subject value="{$IDmarcont}"/>
			<predicate value="marcont:hasCreator"/>
			<object value="{marcont:generateId('marcont:')}"/>
		</consequent>
		<consequent>
			<subject value="{$CO0}"/>
			<predicate value="rdf:type"/>
			<object value="foaf:Person"/>
		</consequent>

		<call rule_name="r3">
			<with-param name="datafieldId" value="{$PO0}"/>
			<with-param name="personId" value="{$CO0}"/>
		</call>
		
		<terminate/>
	</rule>

	
	<rule name="r3">
		<param name="datafieldId"/>
		<param name="personId" />
		
		<premise>
			<subject value="{$datafieldId}"/>
			<predicate value="marcrdf:hasSubfield"/>
			<object value=""/>
		</premise>
		<premise>
			<subject value="{$PO0}"/>
			<predicate value="marcrdf:code"/>
                       <object value="a" rdf:datatype="http://www.w3.org/2001/XMLSchema#string"/>
		</premise>
		<premise>
			<subject value="{$PO0}"/>
			<predicate value="marcrdf:value"/>
			<object value=""/>
		</premise>
		<premise>
			<subject value="{$datafieldId}"/>
			<predicate value="marcrdf:ind1"/>
			<object value="1" rdf:datatype="http://www.w3.org/2001/XMLSchema#string"/>
		</premise>

		<consequent>
			<subject value="{$personId}"/>
			<predicate value="foaf:surname"/>
			<object value="{$PO2}"/>
               </consequent>
           <terminate/>
	</rule>

	
	<rule name="r4">
		<param name="IDmarcrdf"/>
		<param name="IDmarcont"/>
	
		<premise>
			<subject value="{$IDmarcrdf}"/>
                       <predicate value="marcrdf:hasDatafield"/>
                       <object value=""/>
		</premise>
		<premise>
			<subject value="{$PO0}"/>
			<predicate value="marcrdf:tag"/>
			<object value="245" rdf:datatype="http://www.w3.org/2001/XMLSchema#string"/>
		</premise>

		<consequent>
			<subject value="{$IDmarcont}"/>
			<predicate value="marcont:hasTitle"/>
			<object value="{marcont:generateId('marcont:')}"/>
		</consequent>
		<consequent>
			<subject value="{$CO0}"/>
			<predicate value="rdf:type"/>
			<object value="marcont:TitleStatement"/>
		</consequent>

		<call rule_name="r5">
			<with-param name="titleStatementId" value="{$CO0}"/>
			<with-param name="datafieldId" value="{$PO0}"/>
		</call>

		<terminate/>
	</rule>

	
	<rule name="r5">
		<param name="titleStatementId" />
		<param name="datafieldId"/>
	
		<premise>
			<subject value="{$datafieldId}"/>
			<predicate value="marcrdf:hasSubfield"/>
			<object value=""/>
		</premise>
		<premise>
			<subject value="{$PO0}"/>
			<predicate value="marcrdf:code"/>
			<object value="a" rdf:datatype="http://www.w3.org/2001/XMLSchema#string"/>
		</premise>
		<premise>
			<subject value="{$PO0}"/>
			<predicate value="marcrdf:value"/>
			<object value=""/>
		</premise>

		<consequent>
			<subject value="{$titleStatementId}"/>
			<predicate value="marcont:titleValue"/>
			<object value="{$PO2}"/>
		</consequent>
	</rule>
 </TranslationRules>
Facts about MarcOnt/RDFTranslator/SampleTransformationRules — Click + to find similar pages.RDF feed
Personal tools

Corrib cluster project is supported by Enterprise Ireland under Grant No. ILP/05/203, Science Foundation Ireland under Grant No. SFI/02/CE1/I131.
Hosted at DERI, NUI Galway.