You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@marmotta.apache.org by Dileepa Jayakody <di...@gmail.com> on 2016/04/12 14:30:13 UTC
LDPath equivalent for SPARQL negation
Hi All,
I'm Dileepa, a software developer currently working in a project involving
semantic web and linked data technologies. We are using Marmotta for linked
data publishing and querying purposes in the project.
In the client side, to query linked data we are using anno4j
<https://github.com/anno4j/anno4j> a Java RDF library conforming to open
annotation data model which supports LDPath to do data querying.
Following is a sample SPARQL query I'm trying to wrap with anno4j using
LDPath.
PREFIX skos: <http://www.w3.org/2004/02/skos/core#>
PREFIX mico: <http://www.mico-project.eu/ns/platform/1.0/schema#>
PREFIX rdf: <http://www.w3.org/1999/02/22-rdf-syntax-ns#>
PREFIX oa: <http://www.w3.org/ns/oa#>
PREFIX dc: <http://purl.org/dc/elements/1.1/>
PREFIX dct: <http://purl.org/dc/terms/>
PREFIX fam: <http://vocab.fusepool.info/fam#>
PREFIX dbo: <http://dbpedia.org/ontology/>
SELECT ?id ?body ?p ?o WHERE {
<http://localhost:8080/43s5-3356-53fd-e338f4653aad> mico:hasContentPart
?cp .
?cp mico:hasContent ?annot .
?annot oa:hasBody ?body .
?body ?p ?o
FILTER EXISTS {?body rdf:type fam:LinkedEntity}
FILTER NOT EXISTS {?body fam:entity-type skos:Concept }
I can map FILTER EXISTS using: oa:hasBody[is-a fam:LinkedEntity] or
oa:hasBody[rdf:type is fam:LinkedEntity]
But I'm having difficulty with the negation filter.
Any tips on how to map with SPARQL negation using LDPath?
Thanks,
Dileepa
Re: LDPath equivalent for SPARQL negation
Posted by Dileepa Jayakody <di...@gmail.com>.
Thanks a lot Jakob for your help
On Apr 13, 2016 12:09 PM, "Jakob Frank" <ja...@apache.org> wrote:
> Hi Dileepa,
>
> thanks for stopping by and welcome on the list!
>
> Your approach for the FILTER EXISTS looks perfectly fine ([rdf:type is $1]
> and [is-a $1] are equivallent).
>
> For the negation use the NotFilter := '!(' Filter ')'
> in your example that would be
>
> oa:hasBody[ ! (fam:entity-type is skos:Concept) ]
>
> When using negation, please keep in mind that the result of such query
> might evaluate incorrectly with respect to the open-world assumption. In
> your concrete example, however, I don't see any problem.
>
> Best,
> Jakob
>
> Dileepa Jayakody <di...@gmail.com> schrieb am Di., 12. Apr. 2016
> um 14:30 Uhr:
>
> > Hi All,
> >
> > I'm Dileepa, a software developer currently working in a project
> involving
> > semantic web and linked data technologies. We are using Marmotta for
> linked
> > data publishing and querying purposes in the project.
> > In the client side, to query linked data we are using anno4j
> > <https://github.com/anno4j/anno4j> a Java RDF library conforming to open
> > annotation data model which supports LDPath to do data querying.
> >
> > Following is a sample SPARQL query I'm trying to wrap with anno4j using
> > LDPath.
> >
> >
> > PREFIX skos: <http://www.w3.org/2004/02/skos/core#>
> > PREFIX mico: <http://www.mico-project.eu/ns/platform/1.0/schema#>
> > PREFIX rdf: <http://www.w3.org/1999/02/22-rdf-syntax-ns#>
> > PREFIX oa: <http://www.w3.org/ns/oa#>
> > PREFIX dc: <http://purl.org/dc/elements/1.1/>
> > PREFIX dct: <http://purl.org/dc/terms/>
> > PREFIX fam: <http://vocab.fusepool.info/fam#>
> > PREFIX dbo: <http://dbpedia.org/ontology/>
> > SELECT ?id ?body ?p ?o WHERE {
> > <http://localhost:8080/43s5-3356-53fd-e338f4653aad> mico:hasContentPart
> > ?cp .
> > ?cp mico:hasContent ?annot .
> > ?annot oa:hasBody ?body .
> > ?body ?p ?o
> > FILTER EXISTS {?body rdf:type fam:LinkedEntity}
> > FILTER NOT EXISTS {?body fam:entity-type skos:Concept }
> >
> > I can map FILTER EXISTS using: oa:hasBody[is-a fam:LinkedEntity] or
> > oa:hasBody[rdf:type is fam:LinkedEntity]
> > But I'm having difficulty with the negation filter.
> > Any tips on how to map with SPARQL negation using LDPath?
> >
> > Thanks,
> > Dileepa
> >
>
Re: LDPath equivalent for SPARQL negation
Posted by Jakob Frank <ja...@apache.org>.
Hi Dileepa,
thanks for stopping by and welcome on the list!
Your approach for the FILTER EXISTS looks perfectly fine ([rdf:type is $1]
and [is-a $1] are equivallent).
For the negation use the NotFilter := '!(' Filter ')'
in your example that would be
oa:hasBody[ ! (fam:entity-type is skos:Concept) ]
When using negation, please keep in mind that the result of such query
might evaluate incorrectly with respect to the open-world assumption. In
your concrete example, however, I don't see any problem.
Best,
Jakob
Dileepa Jayakody <di...@gmail.com> schrieb am Di., 12. Apr. 2016
um 14:30 Uhr:
> Hi All,
>
> I'm Dileepa, a software developer currently working in a project involving
> semantic web and linked data technologies. We are using Marmotta for linked
> data publishing and querying purposes in the project.
> In the client side, to query linked data we are using anno4j
> <https://github.com/anno4j/anno4j> a Java RDF library conforming to open
> annotation data model which supports LDPath to do data querying.
>
> Following is a sample SPARQL query I'm trying to wrap with anno4j using
> LDPath.
>
>
> PREFIX skos: <http://www.w3.org/2004/02/skos/core#>
> PREFIX mico: <http://www.mico-project.eu/ns/platform/1.0/schema#>
> PREFIX rdf: <http://www.w3.org/1999/02/22-rdf-syntax-ns#>
> PREFIX oa: <http://www.w3.org/ns/oa#>
> PREFIX dc: <http://purl.org/dc/elements/1.1/>
> PREFIX dct: <http://purl.org/dc/terms/>
> PREFIX fam: <http://vocab.fusepool.info/fam#>
> PREFIX dbo: <http://dbpedia.org/ontology/>
> SELECT ?id ?body ?p ?o WHERE {
> <http://localhost:8080/43s5-3356-53fd-e338f4653aad> mico:hasContentPart
> ?cp .
> ?cp mico:hasContent ?annot .
> ?annot oa:hasBody ?body .
> ?body ?p ?o
> FILTER EXISTS {?body rdf:type fam:LinkedEntity}
> FILTER NOT EXISTS {?body fam:entity-type skos:Concept }
>
> I can map FILTER EXISTS using: oa:hasBody[is-a fam:LinkedEntity] or
> oa:hasBody[rdf:type is fam:LinkedEntity]
> But I'm having difficulty with the negation filter.
> Any tips on how to map with SPARQL negation using LDPath?
>
> Thanks,
> Dileepa
>