I'm attempting to use SPIN to perform some inferencing about sensor 
observations.

Observations are represented using RDF as follows...

<rdf:RDF

    xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#";

    xmlns:j.0="http://www.w3.org/2005/Incubator/ssn/ssnx/ssn#";

    xmlns:owl="http://www.w3.org/2002/07/owl#";

    xmlns:j.2="http:// ... /"

    xmlns:j.1="http:// ... /Quality#"

    xmlns:xsd="http://www.w3.org/2001/XMLSchema#";

    xmlns:rdfs="http://www.w3.org/2000/01/rdf-schema#";

    xmlns:j.3="http://www.w3.org/2003/01/geo/wgs84_pos#"; > 

  <rdf:Description rdf:about="http:// ... 
/5f875a0b-9814-4f93-bc60-c5b7255d7094">

    <rdf:type rdf:resource="http:// ... /LocationDeviceValue"/>

    <j.3:lat>57.125</j.3:lat>

    <j.3:long>-2.10776</j.3:long>

    <j.2:accuracy>5.0</j.2:accuracy>

  </rdf:Description>

  <rdf:Description rdf:about="http:// ... 
/24268b0d-e933-4af2-9b6a-a8a8d7c2aeab">

    <rdf:type rdf:resource="http:// ... /LocationDeviceObservation"/>

    <j.0:observationResultTime>1314195157000</j.0:observationResultTime>

    <j.0:observationSamplingTime>1314195157000</j.0:observationSamplingTime>

    <j.2:serverTime>1347544030791</j.2:serverTime>

    <j.1:dataAge>33348885</j.1:dataAge>

    <j.0:featureOfInterest>http:// ... 
/6e11eeeb-57ca-4ef5-b75b-a3b7eb599713</j.0:featureOfInterest>

    <j.0:observedBy>http:// ... 
/ecf477a9-8c37-4986-a538-9cc7b6faf9ef</j.0:observedBy>

    <j.0:sensingMethodUsed>http:// ... /sensing/1</j.0:sensingMethodUsed>

  </rdf:Description>

</rdf:RDF>

To test, I have authored the following SPIN rule...

# Test rule...

*CONSTRUCT* {

    *?this* sensors:testProperty "It works..." .

}

*WHERE* {

    *?this* a sensors:LocationDeviceObservation .

    *NOT* *EXISTS* {

        *?this* sensors:testProperty ?o .

    } .

}

Please note that the j.2 and sensors: namespace both point to same location.

I'm trying to execute the rule programmatically in Java:

 rules = ModelFactory.createOntologyModel(OntModelSpec.OWL_MEM);

 try

 {

    rules = FileManager.get().loadModel(QUALITY_RULE_PATH, "N3");

 }

 catch(Exception ex)

 {

    System.out.println("QualityAssessment: Failed getting rules: " + ex);

 }

 SPINModuleRegistry.get().init();

OntModel assessment = ModelFactory.createOntologyModel(OntModelSpec.OWL_MEM
);

 OntModel nTriples = ModelFactory.createOntologyModel(OntModelSpec.OWL_MEM);

//Add observation, rules, and nTriple models to assessment

 assessment.add(observation);

 assessment.add(rules);

 assessment.add(nTriples);

  try

 {

    SPINModuleRegistry.get().registerAll(assessment, null);

    SPINInferences.run(assessment, nTriples, null, null, false, null);

 }

 catch (Exception ex)

 {

    ex.printStackTrace();

 }

 System.out.println("QualityAssessment: " + nTriples.size() + " Inferred 
triples");

This is continually returning 0 inferred triples and I can't work out why. 
It's highly likely that I have a problem with my RDF but if it's an easy 
fix then I can see it for looking.

Thanks,

Chris

-- 
-- You received this message because you are subscribed to the Google
Group "TopBraid Suite Users", the topics of which include Enterprise Vocabulary 
Network (EVN), TopBraid Composer, TopBraid Live,
TopBraid Ensemble, SPARQLMotion, SPARQL Web Pages and SPIN.
To post to this group, send email to
topbraid-users@googlegroups.com
To unsubscribe from this group, send email to
topbraid-users+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/topbraid-users?hl=en


Reply via email to