简体   繁体   English

耶拿规则示例

[英]Jena rule example

I have this RDF description : 我有这个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>

I want to apply a Jena rule to select the location where the bandwidth value is equal to 450. I created this rule : 我想应用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)]

The response normally is : 响应通常是:

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

But the engine response is : 但是引擎的响应是:

 <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> 

The engine java source is : 引擎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");
  }

Thank you to respond me. 谢谢你回应我。

There are syntax errors in your rules, I think, but I'll assume that they're a copy and paste problem. 我认为你的规则中存在语法错误,但我认为它们是复制和粘贴问题。 There are two bigger issues in your rule. 您的规则中有两个更大的问题。 First, you're got a bunch of useless triples in it: 首先,其中包含许多无用的三元组:

[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)]

What's the point of the a, b, c, t2, t3, and t4 variables? a,b,c,t2,t3和t4变量有什么意义? They aren't used in the anywhere else, so they're not actually used for anything. 它们并没有在其他任何地方使用,所以它们实际上并没有被用于任何东西。 Your rule is essentially: 你的规则基本上是:

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

But then notice that there's a triple with ?gh , but ?gh isn't used in any of the other triple patterns. 但是后来注意到有一个三重奏?gh ,但是?gh没有用于任何其他三重模式。 So the rule is essentially the following (as long as something has bandwidth 450): 所以规则基本上是以下(只要有一些带宽450):

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

That just says that if something has a specific location, then it has the same thing as an adapted specific location. 这只是说,如果某个东西有特定的位置,那么它与改编的特定位置具有相同的功能。 Since you've got two in the input, you have two in the output. 由于输入中有两个输入,因此输出中有两个输入。

I'm not sure what your data is supposed to look like, so I'm not sure how you should rewrite your rule, but if you're trying to say that 我不确定你的数据应该是什么样的,所以我不确定你应该怎么重写你的规则,但如果你想说的话

If something has bandwidth 450 and specific location x then it has adapted specific location x. 如果某些东西具有带宽450和特定位置x, 那么它已经调整了特定位置x。

you'd write it more like: 你会写得更像:

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

You need to use the same variable when you're referring to the same thing. 当你指的是同一个东西时,你需要使用相同的变量。

I change the description and I used : 我更改了描述,并使用了:

<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>

And I used this rule : 我用这个规则:

[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)]

But I have the same problem. 但我有同样的问题。

<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>

Please have you an idea how to select the specific location where the bandwidth is equal to 450 using Jena rule??? 请您知道如何使用Jena规则选择带宽等于450的特定位置???

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM