메뉴 건너뛰기

Bigdata, Semantic IoT, Hadoop, NoSQL

Bigdata, Hadoop ecosystem, Semantic IoT등의 프로젝트를 진행중에 습득한 내용을 정리하는 곳입니다.
필요한 분을 위해서 공개하고 있습니다. 문의사항은 gooper@gooper.com로 메일을 보내주세요.


rdf:type이 b:Device이고 b:Device의 위치가 o:techno인 경우에 DeviceType을 여러개 가지는(hasDeviceType)는 경우는 아래와 같이 sparql을 만들어서 or 기능을 구현할 수도 있다.(DeviceType이 o:motion-sensor_33 이거나 o:motion-sensor_32 경우)


-------------union으로 or을 구현한 예제

select  distinct  ?uri  where { 
 ?uri rdf:type b:Device.

 ?uri dul:hasLocation o:techno.
  { ?uri o:hasDeviceType o:motion-sensor_33 .}
   union 

  { ?uri o:hasDeviceType o:motion-sensor_32 .}

}



*참고 : sparql에서는 아래와 같이 각 ?s ?p ?o중의 하나에 직접 ||, &&, or , and등을 이용한 형태를 지원하지 않지 않으므로 filter문을 이용하여 처리해야 함


----지원하지 않는 형태----

select * where {

  ?s ?p ('a' or 'b')

}


----filter문을 이용해서 or을 구현한 형태

select *
where {
  ?uri rdf:type b:Device.
  ?uri dul:hasLocation o:techno . 
  ?uri o:hasDeviceType ?devType .
  filter (?devType = o:/motion-sensor_32 || ?devType = o:/motion-sensor_33) .
}


A personal place to organize information learned during the development of such Hadoop, Hive, Hbase, Semantic IoT, etc.
We are open to the required minutes. Please send inquiries to gooper@gooper.com.

위로