Warning: file_get_contents(/data/phpspider/zhask/data//catemap/4/powerbi/2.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Function 如何在剪辑中平等使用“或”?_Function_Clips - Fatal编程技术网

Function 如何在剪辑中平等使用“或”?

Function 如何在剪辑中平等使用“或”?,function,clips,Function,Clips,我必须使用此库并删除重复项 (deffacts MAIN::requirements "Expert Commitee" (softgoalElement (sgId gen104) (sgQualityAttribute "quality") (sgSujectObject "review") (sgGoalId gen98) (sgActorName "reviewer") (sgBhId gen2)) (softgoalElement (sgId gen107) (sgQualit

我必须使用此库并删除重复项

(deffacts MAIN::requirements "Expert Commitee"  (softgoalElement (sgId gen104) (sgQualityAttribute "quality") (sgSujectObject "review") (sgGoalId gen98) (sgActorName "reviewer") (sgBhId gen2))    (softgoalElement (sgId gen107) (sgQualityAttribute "quality") (sgSujectObject "review") (sgGoalId gen96) (sgActorName "chair") (sgBhId gen20))    (softgoalElement (sgId gen109) (sgQualityAttribute "quality") (sgSujectObject "review") (sgGoalId gen97) (sgActorName "committe") (sgBhId gen26))    (softgoalElement (sgId gen110) (sgQualityAttribute "quality") (sgSujectObject "review") (sgGoalId gen98) (sgActorName "reviewer") (sgBhId gen34))    (softgoalElement (sgId gen113) (sgQualityAttribute "quality") (sgSujectObject "article") (sgGoalId gen96) (sgActorName "chair") (sgBhId gen50)))
以下是提取的数据副本:

 (gen113)quality [article] 
 (gen111)honest [review] 
 (gen110)quality[review] 
 (gen109)quality [review] 
 (gen108)acknowledge [committee]
 (gen107)quality [review] 
 (gen105)punctuality [plubication]
 (gen104)quality [review]
我使用这个规则:

(defrule Deleting::ruleDeleteSoftgoal  "This rule deletes duplicate softagoal found in the facts base." 

    (declare (salience 58))
    ?fact <- (softgoalElement 
    (sgId ?sgId1)
    (sgSujectObject ?SubjectObjectSg1)      
    (sgQualityAttribute ?QualityAttributeSg1)
    (sgGoalId             ?GoalIdSg1         )
    (sgActorName          ?ActorNameSg1      )
    )
    ?fact2 <- (softgoalElement  
    (sgId ?sgId2)
    (sgSujectObject ?SubjectObjectSg2)      
    (sgQualityAttribute ?QualityAttributeSg2)
    (sgGoalId             ?GoalIdSg2         )  
    (sgActorName          ?ActorNameSg2      ) 
    )

    (test (and (neq ?sgId1 ?sgId2)(eq ?SubjectObjectSg2 ?SubjectObjectSg1)(eq ?QualityAttributeSg2 ?QualityAttributeSg1) 
               (neq ?GoalIdSg2  ?GoalIdSg1 )(neq ?ActorNameSg2  ?ActorNameSg1 )))
    =>
    (retract ?fact2) )
我能帮忙吗

加里

我一直在努力消除重复,在此基础上,规则删除了一些重复的组合,而其他没有,我检查了规则,没有发现任何阻止排除的东西。你能再帮我一次吗

数据:

排除规则:

(defrule ruleDeleteSoftgoal  ""
    (declare (salience 50))
    (synSoftgoal 
       (ttId ?ttId1)
       (synTopic ?syntopic1)      
       (synType ?syntype1))

    ?fact2 <- (synSoftgoal 
                 (ttId ?ttId2)
                 (synTopic ?syntopic2)      
                 (synType ?syntype2))

    (test (and (neq ?ttId1 ?ttId2)
               (eq ?syntopic2 ?syntopic1)
               (eq ?syntype2 ?syntype1)))
    =>
    (retract ?fact2))
结果:

(gen42)accept   [appraisal]
(gen41)trustworthy   [appraisal] - DEVERIA TER UMA SÓ
(gen40)true   [appraisal] - DEVERIA TER UMA SÓ
(gen39)straightforward   [appraisal] - DEVERIA TER UMA SÓ
(gen38)sincere   [appraisal] - DEVERIA TER UMA SÓ
(gen37)trustworthy   [appraisal]
(gen36)straightforward    [appraisal]
(gen35)sincere   [appraisal]
(gen34)legitimate   [appraisal] - DEVERIA TER UMA SÓ
(gen33)equitable   [appraisal] -DEVERIA TER UMA SÓ
(gen32)true    [appraisal]
(gen31)proper    [appraisal]
(gen30)legitimate    [appraisal]
(gen29)equitable    [appraisal]
(gen28)accept   [analysis]
(gen27)trustworthy   [analysis
(gen42)accept   [appraisal]
(gen41)trustworthy   [appraisal] - DEVERIA TER UMA SÓ
(gen40)true   [appraisal] - DEVERIA TER UMA SÓ
(gen39)straightforward   [appraisal] - DEVERIA TER UMA SÓ
(gen38)sincere   [appraisal] - DEVERIA TER UMA SÓ
(gen37)trustworthy   [appraisal]
(gen36)straightforward    [appraisal]
(gen35)sincere   [appraisal]
(gen34)legitimate   [appraisal] - DEVERIA TER UMA SÓ
(gen33)equitable   [appraisal] -DEVERIA TER UMA SÓ
(gen32)true    [appraisal]
(gen31)proper    [appraisal]
(gen30)legitimate    [appraisal]
(gen29)equitable    [appraisal]
(gen28)accept   [analysis]
(gen27)trustworthy   [analysis

再次感谢。

您删除重复项的标准不清楚。一种可能的解决方案是检查sgGoalId、sgActorName或sgBhId是否不同:

(defrule ruleDeleteSoftgoal  

    (softgoalElement 
       (sgId ?sgId1)
       (sgSujectObject ?SubjectObjectSg1)      
       (sgQualityAttribute ?QualityAttributeSg1)
       (sgGoalId ?GoalIdSg1)
       (sgActorName ?ActorNameSg1)
       (sgBhId ?sgBhId1))

    ?fact2 <- (softgoalElement
                 (sgId ?sgId2)
                 (sgSujectObject ?SubjectObjectSg2)      
                 (sgQualityAttribute ?QualityAttributeSg2)
                 (sgGoalId ?GoalIdSg2)  
                 (sgActorName ?ActorNameSg2)
                 (sgBhId ?sgBhId2))

    (test (and (neq ?sgId1 ?sgId2)
               (eq ?SubjectObjectSg2 ?SubjectObjectSg1)
               (eq ?QualityAttributeSg2 ?QualityAttributeSg1) 
               (or (neq ?GoalIdSg2 ?GoalIdSg1 )
                   (neq ?ActorNameSg2 ?ActorNameSg1)
                   (neq ?sgBhId2 ?sgBhId1))))
    =>
    (retract ?fact2))
携带底座:

(deffacts synonymtype  
  (synonymoustype (type  "correct") (syntype "equitable ") ) 
  (synonymoustype (type  "correct") (syntype "legitimate ") ) 
  (synonymoustype (type  "correct") (syntype "proper ") ) 
  (synonymoustype (type  "correct") (syntype "true ") ) 
  (synonymoustype (type  "fair") (syntype "equitable") )
  (synonymoustype (type  "fair") (syntype "legitimate") ) 
  (synonymoustype (type  "fair") (syntype "sincere") ) 
  (synonymoustype (type  "fair") (syntype "straightforward ") ) 
  (synonymoustype (type  "fair") (syntype "trustworthy") ) 
  (synonymoustype (type  "honest") (syntype "sincere") )
  (synonymoustype (type  "honest") (syntype "straightforward") )
  (synonymoustype (type  "honest") (syntype "true") )
  (synonymoustype (type  "honest") (syntype "trustworthy") )
  (synonymoustype (type  "acknowledge") (syntype "accept") ))

 (deffacts synonymtopic
 (synonymoustopic (topic "evaluation") (syntopic "appraisal") ) 
 (synonymoustopic (topic "review") (syntopic "analysis") )
 (synonymoustopic (topic "review") (syntopic "audit") ) )
运行以下树规则:

(defrule ruleAssertSynsoftgoal "extracts the data from the base and inserts in synSoftgoal"

    (synonymoustype
    (type            ?type    )
    (syntype         ?syntype ))

    (synonymoustopic
    (topic           ?topic   )
    (syntopic        ?syntopic))
     =>
    (assert (synSoftgoal (ttId(gensym)) (synType ?syntype)(synTopic ?syntopic) ))



)

(defrule ruleDeleteSoftgoal  "delete duplicate"

    (synSoftgoal 
       (ttId ?ttId1)
       (synTopic ?syntopic1)      
       (synType ?syntype1))

    ?fact2 <- (synSoftgoal 
                 (ttId ?ttId2)
                 (synTopic ?syntopic2)      
                 (synType ?syntype2))

    (test (and (neq ?ttId1 ?ttId2)
               (eq ?syntopic2 ?syntopic1)
               (eq ?syntype2 ?syntype1)))
    =>
    (retract ?fact2))




   (defrule rulePrintsTypeTopic "prints the base synSoftgoal"

         (declare (salience 65))
         (synSoftgoal 
         (ttId ?tId )
         (synType ?Type)
         (synTopic ?Topic)      

         )
        =>
         (printout t  "Id:(" ?tId ") SynSoftgoal: "?Type" [" ?Topic "]" crlf) 
    )

当你只包含代码片段而不是一个完整的例子来重现你看到的结果时,很难找出如何修复你的程序。最近的编辑仍然无法产生。您列出的结果格式甚至与您代码中的打印输出语句不匹配,如下所示:Id:gen4 SynSoftgoal:property[audit]Gary,她将每种类型与所有主题结合在一起,并且只需将部分结果放入其中,即可获得非常好的响应。她将所有类型与每个主题结合起来,并在过程结束时引出目标42,其中包括您引用的主题。如果你可以发送电子邮件,为你发送所有完整的信息。谢谢
(defrule ruleDeleteSoftgoal  

    (softgoalElement 
       (sgId ?sgId1)
       (sgSujectObject ?SubjectObjectSg1)      
       (sgQualityAttribute ?QualityAttributeSg1))

    ?fact2 <- (softgoalElement
                 (sgId ?sgId2)
                 (sgSujectObject ?SubjectObjectSg2)      
                 (sgQualityAttribute ?QualityAttributeSg2))

    (test (and (neq ?sgId1 ?sgId2)
               (eq ?SubjectObjectSg2 ?SubjectObjectSg1)
               (eq ?QualityAttributeSg2 ?QualityAttributeSg1)))
    =>
    (retract ?fact2))
(deftemplate synonymoustype "Gets the Type of softgoal"
    (slot type        (type STRING) )
    (slot syntype     (type STRING) )  

)


(deftemplate synonymoustopic "Gets the topic of softgoal"
    (slot topic       (type STRING) )
    (slot syntopic    (type STRING) )
)

(deftemplate synSoftgoal "synsoftgoal receives synonyms for softgoals extracted from the base facts of (Cunha, 2014)"
    (slot ttId        (type SYMBOL) )
    (slot synTopic    (type STRING) )
    (slot synType     (type STRING) )
)
(deffacts synonymtype  
  (synonymoustype (type  "correct") (syntype "equitable ") ) 
  (synonymoustype (type  "correct") (syntype "legitimate ") ) 
  (synonymoustype (type  "correct") (syntype "proper ") ) 
  (synonymoustype (type  "correct") (syntype "true ") ) 
  (synonymoustype (type  "fair") (syntype "equitable") )
  (synonymoustype (type  "fair") (syntype "legitimate") ) 
  (synonymoustype (type  "fair") (syntype "sincere") ) 
  (synonymoustype (type  "fair") (syntype "straightforward ") ) 
  (synonymoustype (type  "fair") (syntype "trustworthy") ) 
  (synonymoustype (type  "honest") (syntype "sincere") )
  (synonymoustype (type  "honest") (syntype "straightforward") )
  (synonymoustype (type  "honest") (syntype "true") )
  (synonymoustype (type  "honest") (syntype "trustworthy") )
  (synonymoustype (type  "acknowledge") (syntype "accept") ))

 (deffacts synonymtopic
 (synonymoustopic (topic "evaluation") (syntopic "appraisal") ) 
 (synonymoustopic (topic "review") (syntopic "analysis") )
 (synonymoustopic (topic "review") (syntopic "audit") ) )
(defrule ruleAssertSynsoftgoal "extracts the data from the base and inserts in synSoftgoal"

    (synonymoustype
    (type            ?type    )
    (syntype         ?syntype ))

    (synonymoustopic
    (topic           ?topic   )
    (syntopic        ?syntopic))
     =>
    (assert (synSoftgoal (ttId(gensym)) (synType ?syntype)(synTopic ?syntopic) ))



)

(defrule ruleDeleteSoftgoal  "delete duplicate"

    (synSoftgoal 
       (ttId ?ttId1)
       (synTopic ?syntopic1)      
       (synType ?syntype1))

    ?fact2 <- (synSoftgoal 
                 (ttId ?ttId2)
                 (synTopic ?syntopic2)      
                 (synType ?syntype2))

    (test (and (neq ?ttId1 ?ttId2)
               (eq ?syntopic2 ?syntopic1)
               (eq ?syntype2 ?syntype1)))
    =>
    (retract ?fact2))




   (defrule rulePrintsTypeTopic "prints the base synSoftgoal"

         (declare (salience 65))
         (synSoftgoal 
         (ttId ?tId )
         (synType ?Type)
         (synTopic ?Topic)      

         )
        =>
         (printout t  "Id:(" ?tId ") SynSoftgoal: "?Type" [" ?Topic "]" crlf) 
    )
(gen42)accept   [appraisal]
(gen41)trustworthy   [appraisal] - DEVERIA TER UMA SÓ
(gen40)true   [appraisal] - DEVERIA TER UMA SÓ
(gen39)straightforward   [appraisal] - DEVERIA TER UMA SÓ
(gen38)sincere   [appraisal] - DEVERIA TER UMA SÓ
(gen37)trustworthy   [appraisal]
(gen36)straightforward    [appraisal]
(gen35)sincere   [appraisal]
(gen34)legitimate   [appraisal] - DEVERIA TER UMA SÓ
(gen33)equitable   [appraisal] -DEVERIA TER UMA SÓ
(gen32)true    [appraisal]
(gen31)proper    [appraisal]
(gen30)legitimate    [appraisal]
(gen29)equitable    [appraisal]
(gen28)accept   [analysis]
(gen27)trustworthy   [analysis