耶拿统治的例子

时间:2015-02-10 16:45:16

标签: rdf jena jena-rules

我有这个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");
  }

谢谢你回复我。

2 个答案:

答案 0 :(得分: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)]

当你指的是同一个东西时,你需要使用相同的变量。

答案 1 :(得分: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的具体位置???