fulinyun / swqp

Automatically exported from code.google.com/p/swqp
0 stars 0 forks source link

determine where constraining characteristics should be handled in the module. #25

Closed GoogleCodeExporter closed 9 years ago

GoogleCodeExporter commented 9 years ago
determine where constraining characteristics should be handled in the module 
and get this functional

Original issue reported on code.google.com by apse...@gmail.com on 28 Nov 2012 at 2:51

GoogleCodeExporter commented 9 years ago
this was handled by checking if the variable for element appears in the graph:

if(!query.hasVariable(VAR_NS+"element")) {

        return;
        }

this way the pattern is added only if it is appropriate. this looks to be 
successfully done in the debug query (below), but need to test this in the 
interface. will be easier to test once we have all the characteristics 
completed.

PREFIX xsd: <http://www.w3.org/2001/XMLSchema#>
PREFIX owl: <http://www.w3.org/2002/07/owl#>
PREFIX rdf: <http://www.w3.org/1999/02/22-rdf-syntax-ns#>
CONSTRUCT {
?s <http://www.w3.org/1999/02/22-rdf-syntax-ns#type> 
<http://escience.rpi.edu/ontology/semanteco/2/0/water.owl#WaterSite> . 
?s <http://www.w3.org/2000/01/rdf-schema#label> ?label . 
?s 
<http://escience.rpi.edu/ontology/semanteco/2/0/pollution.owl#hasMeasurement> 
?measurement . 
?s <http://escience.rpi.edu/ontology/semanteco/2/0/pollution.owl#hasCountyCode> 
"001"^^xsd:int . 
?s <http://escience.rpi.edu/ontology/semanteco/2/0/pollution.owl#hasStateCode> 
?state . 
?s <http://www.w3.org/2003/01/geo/wgs84_pos#lat> ?lat . 
?s <http://www.w3.org/2003/01/geo/wgs84_pos#long> ?long . 
?measurement <http://www.w3.org/1999/02/22-rdf-syntax-ns#type> 
<http://escience.rpi.edu/ontology/semanteco/2/0/water.owl#WaterMeasurement> . 
?measurement 
<http://escience.rpi.edu/ontology/semanteco/2/0/pollution.owl#hasCharacteristic>
 ?element . 
?measurement 
<http://escience.rpi.edu/ontology/semanteco/2/0/pollution.owl#hasValue> ?value 
. 
?measurement <http://sweet.jpl.nasa.gov/2.1/reprSciUnits.owl#hasUnit> ?unit . 
?measurement <http://www.w3.org/2006/time#inXSDDateTime> ?time . 
}
WHERE 
{
graph 
<http://sparql.tw.rpi.edu/source/usgs-gov/dataset/nwis-sites-ri/version/2011-Mar
-20> {
?s <http://www.w3.org/1999/02/22-rdf-syntax-ns#type> 
<http://escience.rpi.edu/ontology/semanteco/2/0/water.owl#WaterSite> . 
FILTER(?s IN 
(<http://escience.rpi.edu/ontology/semanteco/2/0/water.owl#WaterSite-USGS-011091
50>,<http://escience.rpi.edu/ontology/semanteco/2/0/water.owl#WaterSite-USGS-414
358071192000>))
?s <http://escience.rpi.edu/ontology/semanteco/2/0/pollution.owl#hasCountyCode> 
"001"^^xsd:int . 
?s <http://escience.rpi.edu/ontology/semanteco/2/0/pollution.owl#hasStateCode> 
?state . 
?s <http://www.w3.org/2003/01/geo/wgs84_pos#lat> ?lat . 
?s <http://www.w3.org/2003/01/geo/wgs84_pos#long> ?long . 
OPTIONAL {
?s <http://www.w3.org/2000/01/rdf-schema#label> ?label . 
}
}
graph 
<http://sparql.tw.rpi.edu/source/usgs-gov/dataset/nwis-measurements-ri/version/2
011-Mar-20> {
?measurement 
<http://escience.rpi.edu/ontology/semanteco/2/0/pollution.owl#hasSite> ?s . 
?measurement 
<http://escience.rpi.edu/ontology/semanteco/2/0/pollution.owl#hasCharacteristic>
 ?element . 
?measurement 
<http://escience.rpi.edu/ontology/semanteco/2/0/pollution.owl#hasValue> ?value 
. 
?measurement <http://sweet.jpl.nasa.gov/2.1/repr.owl#hasUnit> ?unit . 
{
?measurement <http://www.w3.org/2006/time#inXSDDateTime> ?time . 
} UNION {
?measurement <http://purl.org/dc/terms/date> ?time . 
}
}
graph <http://was.tw.rpi.edu/characteristics-cuahsi-ontology> {
?element <http://www.w3.org/2000/01/rdf-schema#subClassOf> 
<http://cuahsi.org#Chemical> . 
}
}

Original comment by apse...@gmail.com on 28 Nov 2012 at 7:15

GoogleCodeExporter commented 9 years ago
note that this is appearing in debug with pattern:

   PREFIX xsd: <http://www.w3.org/2001/XMLSchema#>
    PREFIX owl: <http://www.w3.org/2002/07/owl#>
    PREFIX rdf: <http://www.w3.org/1999/02/22-rdf-syntax-ns#>
    SELECT *
    WHERE 
    {
    graph <http://was.tw.rpi.edu/characteristics-cuahsi-ontology> {
    ?characteristic <http://www.w3.org/2000/01/rdf-schema#subClassOf> <http://cuahsi.org#Chemical> . 
    }
    }

Original comment by apse...@gmail.com on 28 Nov 2012 at 7:17

GoogleCodeExporter commented 9 years ago

Original comment by apse...@gmail.com on 29 Nov 2012 at 1:21

GoogleCodeExporter commented 9 years ago
this has been addressed in the visitor code of characteristics module, and a 
conditional is used to check to see if a specific variable exists in the query 
object being passed in.

Original comment by apse...@gmail.com on 1 Dec 2012 at 5:21