0

我有这个 RDF 描述:

<rdf:RDF
    xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"
    xmlns:perSys="http://localhost:8080/NetworkContextWS/onto/NetworkContextDescription#">
  <rdf:Description rdf:about="http://localhost:8080/NetworkContextWS/onto/NetworkContextDescription#PervasiveContext">
      <perSys:HasNetworkContext>
      <rdf:Description rdf:about="http://localhost:8080/NetworkContextWS/onto/NetworkContextDescription#NetworkContext">
        <perSys:Rules>
          <rdf:Description rdf:about="http://localhost:8080/NetworkContextWS/onto/NetworkContextDescription#NetworkSecurity">
            <perSys:NetworkSecurityState rdf:datatype="http://www.w3.org/2001/XMLSchema#string"
            >Open Network</perSys:NetworkSecurityState>
            <perSys:NetworkKey rdf:datatype="http://www.w3.org/2001/XMLSchema#string"
            >No Key</perSys:NetworkKey>
          </rdf:Description>
        </perSys:Rules>
        <perSys:Network>
          <rdf:Description rdf:about="http://localhost:8080/NetworkContextWS/onto/NetworkContextDescription#NetworkCharacteristics">
            <perSys:SubNetworkType rdf:datatype="http://www.w3.org/2001/XMLSchema#string"
            >HSDPA</perSys:SubNetworkType>
            <perSys:NetworkState rdf:datatype="http://www.w3.org/2001/XMLSchema#string"
            >CONNECTED</perSys:NetworkState>
            <perSys:Bandwidth rdf:datatype="http://www.w3.org/2001/XMLSchema#float"
            >450</perSys:Bandwidth>
            <perSys:LinkSpeed rdf:datatype="http://www.w3.org/2001/XMLSchema#float"
            >65</perSys:LinkSpeed>
            <perSys:NetworkAvailability rdf:datatype="http://www.w3.org/2001/XMLSchema#string"
            >Available</perSys:NetworkAvailability>
            <perSys:NetworkName rdf:datatype="http://www.w3.org/2001/XMLSchema#string"
            >AF23_WI-FI_9F1B</perSys:NetworkName>
          </rdf:Description>
        </perSys:Network>
        <perSys:Network>
          <rdf:Description rdf:about="http://localhost:8080/NetworkContextWS/onto/NetworkContextDescription#NetworkTraficStats">
            <perSys:NumberBytesReceived rdf:datatype="http://www.w3.org/2001/XMLSchema#string"
            >15599522</perSys:NumberBytesReceived>
            <perSys:NumberPacketsReceived rdf:datatype="http://www.w3.org/2001/XMLSchema#int"
            >24922</perSys:NumberPacketsReceived>
            <perSys:NumberBytesTransmited rdf:datatype="http://www.w3.org/2001/XMLSchema#int"
            >4111415</perSys:NumberBytesTransmited>
            <perSys:NumberPacketsTransmited rdf:datatype="http://www.w3.org/2001/XMLSchema#int"
            >26455</perSys:NumberPacketsTransmited>
            <perSys:NetworkUpload rdf:datatype="http://www.w3.org/2001/XMLSchema#float"
            >0</perSys:NetworkUpload>
            <perSys:NetworkType rdf:datatype="http://www.w3.org/2001/XMLSchema#string"
            >Connected</perSys:NetworkType>
            <perSys:NetworkDownload rdf:datatype="http://www.w3.org/2001/XMLSchema#float"
            >1</perSys:NetworkDownload>
            <perSys:TotalData rdf:datatype="http://www.w3.org/2001/XMLSchema#float"
            >1</perSys:TotalData>
          </rdf:Description>
        </perSys:Network>
        <perSys:Time>
          <rdf:Description rdf:about="http://localhost:8080/NetworkContextWS/onto/NetworkContextDescription#TimeCharacteristics">
            <perSys:ConnexionTime rdf:datatype="http://www.w3.org/2001/XMLSchema#time"
            >15:00:00</perSys:ConnexionTime>
            <perSys:ConnexionDate rdf:datatype="http://www.w3.org/2001/XMLSchema#date"
            >2015-02-06</perSys:ConnexionDate>
          </rdf:Description>
        </perSys:Time>
        <perSys:Preferences>
          <rdf:Description rdf:about="http://localhost:8080/NetworkContextWS/onto/NetworkContextDescription#PreferencesCharacteristics">
            <perSys:PreferencesName rdf:datatype="http://www.w3.org/2001/XMLSchema#string"
            >preferencesName</perSys:PreferencesName>
            <perSys:PreferencesType rdf:datatype="http://www.w3.org/2001/XMLSchema#string"
            >preferencesValue</perSys:PreferencesType>
          </rdf:Description>
        </perSys:Preferences>
        <perSys:Device>
          <rdf:Description rdf:about="http://localhost:8080/NetworkContextWS/onto/NetworkContextDescription#DeviceCharacteristics">
            <perSys:DeviceName rdf:datatype="http://www.w3.org/2001/XMLSchema#string"
            >Bekri-Laptop</perSys:DeviceName>
            <perSys:DeviceType rdf:datatype="http://www.w3.org/2001/XMLSchema#string"
            >Laptop</perSys:DeviceType>
          </rdf:Description>
        </perSys:Device>
        <perSys:Location>
          <rdf:Description rdf:about="http://localhost:8080/NetworkContextWS/onto/NetworkContextDescription#LocationCharacteristics">
            <perSys:SpecificLocation rdf:datatype="http://www.w3.org/2001/XMLSchema#string"
            >Gate 23</perSys:SpecificLocation>
            <perSys:FeatureName rdf:datatype="http://www.w3.org/2001/XMLSchema#string"
            >Pittsburgh International Airport</perSys:FeatureName>
          </rdf:Description>
        </perSys:Location>
      </rdf:Description>
  </perSys:HasNetworkContext>

      <perSys:HasNetworkContext>
      <rdf:Description rdf:about="http://localhost:8080/NetworkContextWS/onto/NetworkContextDescription#NetworkContext">
        <perSys:Rules>
          <rdf:Description rdf:about="http://localhost:8080/NetworkContextWS/onto/NetworkContextDescription#NetworkSecurity">
            <perSys:NetworkSecurityState rdf:datatype="http://www.w3.org/2001/XMLSchema#string"
            >Open Network</perSys:NetworkSecurityState>
            <perSys:NetworkKey rdf:datatype="http://www.w3.org/2001/XMLSchema#string"
            >No Key</perSys:NetworkKey>
          </rdf:Description>
        </perSys:Rules>
        <perSys:Network>
          <rdf:Description rdf:about="http://localhost:8080/NetworkContextWS/onto/NetworkContextDescription#NetworkCharacteristics">
            <perSys:SubNetworkType rdf:datatype="http://www.w3.org/2001/XMLSchema#string"
            >HSDPA</perSys:SubNetworkType>
            <perSys:NetworkState rdf:datatype="http://www.w3.org/2001/XMLSchema#string"
            >CONNECTED</perSys:NetworkState>
            <perSys:Bandwidth rdf:datatype="http://www.w3.org/2001/XMLSchema#float"
            >256</perSys:Bandwidth>
            <perSys:LinkSpeed rdf:datatype="http://www.w3.org/2001/XMLSchema#float"
            >65</perSys:LinkSpeed>
            <perSys:NetworkAvailability rdf:datatype="http://www.w3.org/2001/XMLSchema#string"
            >Available</perSys:NetworkAvailability>
            <perSys:NetworkName rdf:datatype="http://www.w3.org/2001/XMLSchema#string"
            >AF23_WI-FI_9F1B</perSys:NetworkName>
          </rdf:Description>
        </perSys:Network>
        <perSys:Network>
          <rdf:Description rdf:about="http://localhost:8080/NetworkContextWS/onto/NetworkContextDescription#NetworkTraficStats">
            <perSys:NumberBytesReceived rdf:datatype="http://www.w3.org/2001/XMLSchema#string"
            >15599522</perSys:NumberBytesReceived>
            <perSys:NumberPacketsReceived rdf:datatype="http://www.w3.org/2001/XMLSchema#int"
            >24922</perSys:NumberPacketsReceived>
            <perSys:NumberBytesTransmited rdf:datatype="http://www.w3.org/2001/XMLSchema#int"
            >4111415</perSys:NumberBytesTransmited>
            <perSys:NumberPacketsTransmited rdf:datatype="http://www.w3.org/2001/XMLSchema#int"
            >26455</perSys:NumberPacketsTransmited>
            <perSys:NetworkUpload rdf:datatype="http://www.w3.org/2001/XMLSchema#float"
            >0</perSys:NetworkUpload>
            <perSys:NetworkType rdf:datatype="http://www.w3.org/2001/XMLSchema#string"
            >Connected</perSys:NetworkType>
            <perSys:NetworkDownload rdf:datatype="http://www.w3.org/2001/XMLSchema#float"
            >1</perSys:NetworkDownload>
            <perSys:TotalData rdf:datatype="http://www.w3.org/2001/XMLSchema#float"
            >1</perSys:TotalData>
          </rdf:Description>
        </perSys:Network>
        <perSys:Time>
          <rdf:Description rdf:about="http://localhost:8080/NetworkContextWS/onto/NetworkContextDescription#TimeCharacteristics">
            <perSys:ConnexionTime rdf:datatype="http://www.w3.org/2001/XMLSchema#time"
            >15:00:00</perSys:ConnexionTime>
            <perSys:ConnexionDate rdf:datatype="http://www.w3.org/2001/XMLSchema#date"
            >2015-02-06</perSys:ConnexionDate>
          </rdf:Description>
        </perSys:Time>
        <perSys:Preferences>
          <rdf:Description rdf:about="http://localhost:8080/NetworkContextWS/onto/NetworkContextDescription#PreferencesCharacteristics">
            <perSys:PreferencesName rdf:datatype="http://www.w3.org/2001/XMLSchema#string"
            >preferencesName</perSys:PreferencesName>
            <perSys:PreferencesType rdf:datatype="http://www.w3.org/2001/XMLSchema#string"
            >preferencesValue</perSys:PreferencesType>
          </rdf:Description>
        </perSys:Preferences>
        <perSys:Device>
          <rdf:Description rdf:about="http://localhost:8080/NetworkContextWS/onto/NetworkContextDescription#DeviceCharacteristics">
            <perSys:DeviceName rdf:datatype="http://www.w3.org/2001/XMLSchema#string"
            >Bekri-Laptop</perSys:DeviceName>
            <perSys:DeviceType rdf:datatype="http://www.w3.org/2001/XMLSchema#string"
            >Laptop</perSys:DeviceType>
          </rdf:Description>
        </perSys:Device>
        <perSys:Location>
          <rdf:Description rdf:about="http://localhost:8080/NetworkContextWS/onto/NetworkContextDescription#LocationCharacteristics">
            <perSys:SpecificLocation rdf:datatype="http://www.w3.org/2001/XMLSchema#string"
            >Gate 15</perSys:SpecificLocation>
            <perSys:FeatureName rdf:datatype="http://www.w3.org/2001/XMLSchema#string"
            >Pittsburgh International Airport</perSys:FeatureName>
          </rdf:Description>
        </perSys:Location>
      </rdf:Description>
  </perSys:HasNetworkContext>
   </rdf:Description>
</rdf:RDF>

我想应用 Jena 规则来选择带宽值等于 450 的位置。我创建了这个规则:

@prefix rdf: http://www.w3.org/1999/02/22-rdf-syntax-ns#
@prefix xs: http://www.w3.org/2001/XMLSchema#
@prefix perSys http://localhost:8080/NetworkContextWS/onto/NetworkContextDescription#


[AdaptedModel: 
(?a ?rdf:type ?t2), 
(?b ?rdf:type ?t3), 
(?c ?rdf:type ?t4), 
(?gh perSys:Bandwidth '450'^^xsd:float)
(?klx perSys:SpecificLocation ?jkl)
->
(?klx perSys:AdaptedSpecificLocation ?jkl)]

响应通常是:

 <perSys:AdaptedSpecificLocation rdf:datatype="http://www.w3.org/2001/XMLSchema#string">Gate 15</perSys:AdaptedSpecificLocation>

但引擎响应是:

 <perSys:AdaptedSpecificLocation rdf:datatype="http://www.w3.org/2001/XMLSchema#string">Gate 15</perSys:AdaptedSpecificLocation>
    <perSys:AdaptedSpecificLocation rdf:datatype="http://www.w3.org/2001/XMLSchema#string">Gate 23</perSys:AdaptedSpecificLocation> 

引擎java源是:

    public void runEngine(String ruleFile, String rdfFile) {

        String net = "http://localhost:8080/NetworkContextWS/onto/NetworkContextDescription#";
   model = ModelFactory.createDefaultModel();           
      java.io.InputStream inschema =FileManager.get().open(rdfFile);    
      model.read(inschema, net);
      java.util.List rules1 = Rule.rulesFromURL(ruleFile);
      System.out.println(rules1);
      Reasoner reasoner = new GenericRuleReasoner(rules1);
      reasoner = reasoner.bindSchema(model);
      InfModel infmodel = ModelFactory.createInfModel(reasoner,model);
      Resource children = infmodel.getResource(net+"SpecificLocation");
      infmodel.write(System.out, "RDF/XML-ABBREV");
  }

谢谢你回复我。

4

2 回答 2

0

我更改了描述并使用了:

<rdf:RDF
    xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"
    xmlns:perSys="http://localhost:8080/NetworkContextWS/onto/NetworkContextDescription#">
  <perSys:PervasiveContext>
      <perSys:HasNetworkContext>
      <perSys:NetworkContext rdf:about="n1111">
        <perSys:Rules>
          <perSys:NetworkSecurity>
            <perSys:NetworkSecurityState rdf:datatype="http://www.w3.org/2001/XMLSchema#string"
            >Open Network</perSys:NetworkSecurityState>
            <perSys:NetworkKey rdf:datatype="http://www.w3.org/2001/XMLSchema#string"
            >No Key</perSys:NetworkKey>
            </perSys:NetworkSecurity>
        </perSys:Rules>
        <perSys:Network>
          <perSys:NetworkCharacteristics>
            <perSys:SubNetworkType rdf:datatype="http://www.w3.org/2001/XMLSchema#string"
            >HSDPA</perSys:SubNetworkType>
            <perSys:NetworkState rdf:datatype="http://www.w3.org/2001/XMLSchema#string"
            >CONNECTED</perSys:NetworkState>
            <perSys:Bandwidth rdf:datatype="http://www.w3.org/2001/XMLSchema#float"
            >450</perSys:Bandwidth>
            <perSys:LinkSpeed rdf:datatype="http://www.w3.org/2001/XMLSchema#float"
            >65</perSys:LinkSpeed>
            <perSys:NetworkAvailability rdf:datatype="http://www.w3.org/2001/XMLSchema#string"
            >Available</perSys:NetworkAvailability>
            <perSys:NetworkName rdf:datatype="http://www.w3.org/2001/XMLSchema#string"
            >AF23_WI-FI_9F1B</perSys:NetworkName>
          </perSys:NetworkCharacteristics>
        </perSys:Network>
        <perSys:Network>
          <perSys:NetworkTraficStats>
            <perSys:NumberBytesReceived rdf:datatype="http://www.w3.org/2001/XMLSchema#string"
            >15599522</perSys:NumberBytesReceived>
            <perSys:NumberPacketsReceived rdf:datatype="http://www.w3.org/2001/XMLSchema#int"
            >24922</perSys:NumberPacketsReceived>
            <perSys:NumberBytesTransmited rdf:datatype="http://www.w3.org/2001/XMLSchema#int"
            >4111415</perSys:NumberBytesTransmited>
            <perSys:NumberPacketsTransmited rdf:datatype="http://www.w3.org/2001/XMLSchema#int"
            >26455</perSys:NumberPacketsTransmited>
            <perSys:NetworkUpload rdf:datatype="http://www.w3.org/2001/XMLSchema#float"
            >0</perSys:NetworkUpload>
            <perSys:NetworkType rdf:datatype="http://www.w3.org/2001/XMLSchema#string"
            >Connected</perSys:NetworkType>
            <perSys:NetworkDownload rdf:datatype="http://www.w3.org/2001/XMLSchema#float"
            >1</perSys:NetworkDownload>
            <perSys:TotalData rdf:datatype="http://www.w3.org/2001/XMLSchema#float"
            >1</perSys:TotalData>
          </perSys:NetworkTraficStats>
        </perSys:Network>
        <perSys:Time>
          <perSys:TimeCharacteristics>
            <perSys:ConnexionTime rdf:datatype="http://www.w3.org/2001/XMLSchema#time"
            >15:00:00</perSys:ConnexionTime>
            <perSys:ConnexionDate rdf:datatype="http://www.w3.org/2001/XMLSchema#date"
            >2015-02-06</perSys:ConnexionDate>
          </perSys:TimeCharacteristics>
        </perSys:Time>
        <perSys:Preferences>
          <perSys:PreferencesCharacteristics>
            <perSys:PreferencesName rdf:datatype="http://www.w3.org/2001/XMLSchema#string"
            >preferencesName</perSys:PreferencesName>
            <perSys:PreferencesType rdf:datatype="http://www.w3.org/2001/XMLSchema#string"
            >preferencesValue</perSys:PreferencesType>
          </perSys:PreferencesCharacteristics>
        </perSys:Preferences>
        <perSys:Device>
          <perSys:DeviceCharacteristics>
            <perSys:DeviceName rdf:datatype="http://www.w3.org/2001/XMLSchema#string"
            >Bekri-Laptop</perSys:DeviceName>
            <perSys:DeviceType rdf:datatype="http://www.w3.org/2001/XMLSchema#string"
            >Laptop</perSys:DeviceType>
          </perSys:DeviceCharacteristics>
        </perSys:Device>
        <perSys:Location>
          <perSys:LocationCharacteristics>
            <perSys:SpecificLocation rdf:datatype="http://www.w3.org/2001/XMLSchema#string"
            >Gate 23</perSys:SpecificLocation>
            <perSys:FeatureName rdf:datatype="http://www.w3.org/2001/XMLSchema#string"
            >Pittsburgh International Airport</perSys:FeatureName>
           </perSys:LocationCharacteristics>
        </perSys:Location>
      </perSys:NetworkContext>
  </perSys:HasNetworkContext>

      <perSys:HasNetworkContext>
      <perSys:NetworkContext rdf:about="lm333">
        <perSys:Rules>
          <perSys:NetworkSecurity>
            <perSys:NetworkSecurityState rdf:datatype="http://www.w3.org/2001/XMLSchema#string"
            >Open Network</perSys:NetworkSecurityState>
            <perSys:NetworkKey rdf:datatype="http://www.w3.org/2001/XMLSchema#string"
            >No Key</perSys:NetworkKey>
         </perSys:NetworkSecurity>
        </perSys:Rules>
        <perSys:Network>
          <perSys:NetworkCharacteristics>
            <perSys:SubNetworkType rdf:datatype="http://www.w3.org/2001/XMLSchema#string"
            >HSDPA</perSys:SubNetworkType>
            <perSys:NetworkState rdf:datatype="http://www.w3.org/2001/XMLSchema#string"
            >CONNECTED</perSys:NetworkState>
            <perSys:Bandwidth rdf:datatype="http://www.w3.org/2001/XMLSchema#float"
            >256</perSys:Bandwidth>
            <perSys:LinkSpeed rdf:datatype="http://www.w3.org/2001/XMLSchema#float"
            >65</perSys:LinkSpeed>
            <perSys:NetworkAvailability rdf:datatype="http://www.w3.org/2001/XMLSchema#string"
            >Available</perSys:NetworkAvailability>
            <perSys:NetworkName rdf:datatype="http://www.w3.org/2001/XMLSchema#string"
            >AF23_WI-FI_9F1B</perSys:NetworkName>
</perSys:NetworkCharacteristics>
        </perSys:Network>
        <perSys:Network>
          <perSys:NetworkTraficStats>
            <perSys:NumberBytesReceived rdf:datatype="http://www.w3.org/2001/XMLSchema#string"
            >15599522</perSys:NumberBytesReceived>
            <perSys:NumberPacketsReceived rdf:datatype="http://www.w3.org/2001/XMLSchema#int"
            >24922</perSys:NumberPacketsReceived>
            <perSys:NumberBytesTransmited rdf:datatype="http://www.w3.org/2001/XMLSchema#int"
            >4111415</perSys:NumberBytesTransmited>
            <perSys:NumberPacketsTransmited rdf:datatype="http://www.w3.org/2001/XMLSchema#int"
            >26455</perSys:NumberPacketsTransmited>
            <perSys:NetworkUpload rdf:datatype="http://www.w3.org/2001/XMLSchema#float"
            >0</perSys:NetworkUpload>
            <perSys:NetworkType rdf:datatype="http://www.w3.org/2001/XMLSchema#string"
            >Connected</perSys:NetworkType>
            <perSys:NetworkDownload rdf:datatype="http://www.w3.org/2001/XMLSchema#float"
            >1</perSys:NetworkDownload>
            <perSys:TotalData rdf:datatype="http://www.w3.org/2001/XMLSchema#float"
            >1</perSys:TotalData>
           </perSys:NetworkTraficStats>
        </perSys:Network>
        <perSys:Time>
          <perSys:TimeCharacteristics>
            <perSys:ConnexionTime rdf:datatype="http://www.w3.org/2001/XMLSchema#time"
            >15:00:00</perSys:ConnexionTime>
            <perSys:ConnexionDate rdf:datatype="http://www.w3.org/2001/XMLSchema#date"
            >2015-02-06</perSys:ConnexionDate>
          </perSys:TimeCharacteristics>
        </perSys:Time>
        <perSys:Preferences>
          <perSys:PreferencesCharacteristics>
            <perSys:PreferencesName rdf:datatype="http://www.w3.org/2001/XMLSchema#string"
            >preferencesName</perSys:PreferencesName>
            <perSys:PreferencesType rdf:datatype="http://www.w3.org/2001/XMLSchema#string"
            >preferencesValue</perSys:PreferencesType>
          </perSys:PreferencesCharacteristics>
        </perSys:Preferences>
        <perSys:Device>
          <perSys:DeviceCharacteristics>
            <perSys:DeviceName rdf:datatype="http://www.w3.org/2001/XMLSchema#string"
            >Bekri-Laptop</perSys:DeviceName>
            <perSys:DeviceType rdf:datatype="http://www.w3.org/2001/XMLSchema#string"
            >Laptop</perSys:DeviceType>
          </perSys:DeviceCharacteristics>
        </perSys:Device>
        <perSys:Location>
          <perSys:LocationCharacteristics>
            <perSys:SpecificLocation rdf:datatype="http://www.w3.org/2001/XMLSchema#string"
            >Gate 15</perSys:SpecificLocation>
            <perSys:FeatureName rdf:datatype="http://www.w3.org/2001/XMLSchema#string"
            >Pittsburgh International Airport</perSys:FeatureName>
          </perSys:LocationCharacteristics>
        </perSys:Location>
      </perSys:NetworkContext>
  </perSys:HasNetworkContext>
 </perSys:PervasiveContext>
</rdf:RDF>

我使用了这个规则:

[AdaptedModel: 
(?d1 rdf:type perSys:NetworkContext),
(?d2 rdf:type perSys:NetworkCharacteristics),
(?d2 perSys:Bandwidth '450'^^xsd:float)
(?d5 rdf:type perSys:LocationCharacteristics)
(?d5 perSys:SpecificLocation ?l)
->
(?d2 perSys:AdaptedContext ?l)]

但我有同样的问题。

<perSys:AdaptedContext rdf:datatype="http://www.w3.org/2001/XMLSchema#string"
            >Gate 15</perSys:AdaptedContext>
            <perSys:AdaptedContext rdf:datatype="http://www.w3.org/2001/XMLSchema#string"
            >Gate 23</perSys:AdaptedContext>

请您知道如何使用 Jena 规则选择带宽等于 450 的特定位置???

于 2015-02-11T14:51:22.457 回答
0

我认为您的规则中有语法错误,但我认为它们是复制和粘贴问题。您的规则中有两个更大的问题。首先,你有一堆无用的三元组:

[AdaptedModel: 
(?a ?rdf:type ?t2), 
(?b ?rdf:type ?t3), 
(?c ?rdf:type ?t4), 
(?gh perSys:Bandwidth '450'^^xsd:float)
(?klx perSys:SpecificLocation ?jkl)
->
(?klx perSys:AdaptedSpecificLocation ?jkl)]

a、b、c、t2、t3 和 t4 变量有什么意义?它们不在其他任何地方使用,因此它们实际上并没有用于任何事情。您的规则本质上是:

[AdaptedModel: 
(?gh perSys:Bandwidth '450'^^xsd:float)
(?klx perSys:SpecificLocation ?jkl)
->
(?klx perSys:AdaptedSpecificLocation ?jkl)]

但是请注意,有一个三元组?gh,但?gh没有用于任何其他三元组模式。所以规则基本上如下(只要有带宽 450)

[AdaptedModel: 
(?klx perSys:SpecificLocation ?jkl)
->
(?klx perSys:AdaptedSpecificLocation ?jkl)]

这只是说,如果某物具有特定位置,那么它与适应的特定位置具有相同的东西。由于输入中有两个,因此输出中有两个。

我不确定你的数据应该是什么样子,所以我不确定你应该如何重写你的规则,但如果你想说

如果某物具有 450 带宽和特定位置 x ,则它已适应特定位置 x。

你会写得更像:

[AdaptedModel: 
(?a perSys:SpecificLocation ?b)
(?a perSys:Bandwidth '450'^^xsd:float)
->
(?a perSys:AdaptedSpecificLocation ?b)]

当您引用同一事物时,您需要使用相同的变量。

于 2015-02-10T22:15:16.677 回答