# ---------------------------------------------------- # TPL Use Case 1: RDF Data Integration Policy Suite # ---------------------------------------------------- @prefix rdf: . @prefix rdfs: . @prefix xsd: . @prefix swp: . @prefix dc: . @prefix ex: . @prefix tpl: . @prefix gb: . @prefix tprefsl: . @prefix exdata: . @prefix : <#> . # ---------------------------------------------------- # Policy Suite Definition # ---------------------------------------------------- <> rdf:type tpl:TrustPolicySuite; tpl:suiteName "Example Trust Policy Suite" ; rdfs:comment "Example Policies for TPL 0.1" ; dc:creator "Chris Bizer" ; dc:creator "Richard Cyganiak" ; dc:date "2004-12-08" ; dc:format "application/n3" ; tpl:includesPolicy :Policy1 ; tpl:includesPolicy :Policy2 ; tpl:includesPolicy :Policy3 ; tpl:includesPolicy :Policy5 ; tpl:includesPolicy :Policy6 . # ---------------------------------------------------- # Policy 1: # Use only data from sources that are trusted by the current user # ---------------------------------------------------- # # TriQL query: # ?graph1 (?GRAPH swp:assertedBy ?y . # ?y swp:authorithy ?z ) # ?graph2 (?a tprefsl:about ?z . # ?a tprefsl:trustee ?USER ) # ?graph3 (?graph2 swp:assertedBy ?graph3 . # ?graph3 swp:assertedBy ?graph3 . # ?graph3 swp:authorithy ?USER ) :Policy1 rdf:type tpl:TrustPolicy ; tpl:policyName "Use only my trusted sources" ; tpl:policyDescription "Uses only data from my trusted sources. The trusted sources have to be definded before using TPrefL." ; tpl:textExplanation "The information is believed because it was stated in the information object @@?GRAPH@@, " ; tpl:graphPattern [ tpl:textExplanation "which was asserted by @@?z@@ and you are trusting @@?z@@." ; tpl:graphExplanation "?GRAPH swp:assertedBy ?y" ; tpl:pattern """?graph1 (?GRAPH swp:assertedBy ?y . ?y swp:authorithy ?z )""" ; ] ; tpl:graphPattern [ tpl:graphExplanation "?a tprefsl:about ?z" ; tpl:graphExplanation "?a tprefsl:trustee ?USER" ; tpl:pattern """?graph2 (?a tprefsl:about ?z . ?a tprefsl:trustee ?USER )""" ; ] ; tpl:graphPattern [ tpl:pattern """?graph3 (?graph2 swp:assertedBy ?graph3 . ?graph3 swp:assertedBy ?graph3 . ?graph3 swp:authorithy ?USER )""" ; ] . # ---------------------------------------------------- # Policy 2: # Use only data which is newer than a certain date # ---------------------------------------------------- # # TriQL query: # ?graph1 (?GRAPH swp:assertedBy ?x . # ?x dc:date ?y ) # ?graph2 (?graph1 swp:assertedBy ?graph2 . # ?graph2 swp:assertedBy ?graph2 . # ?graph2 swp:authorithy exdata:Crawler ) # AND ?y > '2004/1/1'^^xsd:date :Policy2 rdf:type tpl:TrustPolicy ; tpl:policyName "Data should be newer than X" ; tpl:policyDescription "Uses only data which is newer than a date, defined by the browser." ; tpl:textExplanation "The information is beliefed because it was stated at @@?y@@, which is after 2004/1/1." ; tpl:graphPattern [ tpl:pattern """?graph1 (?GRAPH swp:assertedBy ?x . ?x dc:date ?y )""" ; ] ; tpl:graphPattern [ tpl:pattern """?graph2 (?graph1 swp:assertedBy ?graph2 . ?graph2 swp:assertedBy ?graph2 . ?graph2 swp:authorithy exdata:Crawler )""" ; ] ; tpl:condition "?y > '2004/1/1'^^xsd:date" . # ---------------------------------------------------- # Policy 3: # Use only data from ReseachInstitutes. # The information that something is a ResearchInstitue should come from a trusted source. # ---------------------------------------------------- # # TriQL query: # ?graph1 (?GRAPH swp:assertedBy ?y . # ?y swp:authorithy ?z ) # ?graph2 (?z rdf:type gb:ResearchInstitute ) # ?graph3 (?graph2 swp:assertedBy ?a . # ?a swp:authorithy ?b ) # ?graph4 (?c tprefsl:about ?b . # ?c tprefsl:trustee ?USER ) # ?graph5 (?graph4 swp:assertedBy ?d . # ?graph5 swp:assertedBy ?d . # ?d swp:authorithy ?USER ) :Policy3 rdf:type tpl:TrustPolicy ; tpl:policyName "Use only data from Research Institutes." ; tpl:policyDescription "Use only data from ReseachInstitutes. The information that something is a ResearchInstitue should come from a trusted source." ; tpl:graphPattern [ # The information is asserted by ?z tpl:pattern """?graph1 (?GRAPH swp:assertedBy ?y . ?y swp:authorithy ?z )""" ; tpl:textExplanation "The information is beliefed because it was stated in the information object @@?GRAPH@@, which was asserted by the Resarch Institute @@?z@@." ; ] ; tpl:graphPattern [ # ?z is a research institute tpl:pattern "graph2 (?z rdf:type gb:ResearchInstitute )" ; tpl:textExplanation "The information that @@?z@@ is a Research Institute is beliefed because it was stated in the information object @@?graph2@@, which was asserted by @@?b@@ and you are trusting @@?b@@." ; ] ; tpl:graphPattern [ # ?graph2 asserted by authority ?b tpl:pattern """?graph3 (?graph2 swp:assertedBy ?a . ?a swp:authorithy ?b )""" ; ] ; tpl:graphPattern [ # ?b is a trusted information source. tpl:pattern """graph4 (?c tprefsl:about ?b . ?c tprefsl:trustee ?USER )""" ; ] ; tpl:graphPattern [ # Chris has asserted his trust preferences by himself tpl:pattern """graph5 (graph4 swp:assertedBy ?d . graph5 swp:assertedBy ?d . ?d swp:authorithy ?USER )""" ; ] . # ---------------------------------------------------- # Policy 5: # Use only data from graphs which have more positive than negative ratings by people I trust. # ---------------------------------------------------- # # TriQL query: # AND ?GRAPH IN METRIC(tpl:MorePositiveThanNegative) # # The final explanation is build from the policy's explanation together with # the explanation produced by the metric plugin. :Policy5 rdf:type tpl:TrustPolicy ; tpl:policyName "Only grpahs with more positive than negative ratings." ; tpl:policyDescription "Only grpahs with more positive than negative ratings." ; tpl:textExplanation "The information has been stated in @@?GRAPH@@. And @@?GRAPH@@ got more positive than negative ratings:" ; tpl:condition "METRIC(tpl:MorePositiveThanNegative, ?GRAPH)" . # ---------------------------------------------------- # Policy 6: # Use only data from authors who work for at least 2 projects involving programming # ---------------------------------------------------- # # TriQL query: # ?graph1 (?GRAPH swp:assertedBy ?graph1 . # ?graph1 swp:authorithy ?z ) # ?graph2 (?z ex:worksFor ?project ) # ?graph3 (?project ex:topic ex:programming ) # AND COUNT(?project) >= 2; :Policy6 rdf:type tpl:TrustPolicy ; tpl:policyName "Author works for 2 projects involving programming" ; tpl:policyDescription "Use only data from sources who work for at least 2 projects involving programming" ; tpl:textExplanation "The information is beliefed because it was stated in the information object @@?GRAPH@@" ; tpl:graphPattern [ # The information is asserted by ?z tpl:pattern """?graph1 ( ?GRAPH swp:assertedBy ?graph1 . ?graph1 swp:authorithy ?z )""" ; tpl:textExplanation " which was asserted by @@?z@@ who is working for the following projects involving programming: " ; ] ; tpl:graphPattern [ # ?z works for project tpl:pattern "?graph2 (?z ex:worksFor ?project )" ; tpl:textExplanation "@@?project@@" ; ] ; tpl:graphPattern [ # Project involves programming tpl:pattern "?graph3 (?project ex:topic ex:programming )" ; ] ; tpl:condition "COUNT(?project) >= 2" .