1

I am using jena-fuseki server. Suppose for example my default graph has the following triples.

@prefix bprefix: <http://raghav/Rathi#> 

bprefix:title71  a              bprefix:Title ;
        bprefix:fromCountry     bprefix:UnitedStates ;
        bprefix:hasCast         bprefix:BobbyMoynihan , bprefix:DemetriMartin , bprefix:EricEdelstein ;
        bprefix:hasDateAdded    "September 30, 2018" ;
        bprefix:hasDescription  "Grizzly, Panda and Ice Bear are three adopted bear brothers struggling against their animal instincts to fit into the civilized, modern human world." ;
        bprefix:hasDuration     "1 Season" ;
        bprefix:hasID           "80116921"^^xsd:int ;
        bprefix:hasRating       bprefix:TV-Y7 ;
        bprefix:hasReleaseyear  "2017"^^xsd:int ;
        bprefix:hasTitle        "We Bare Bears" ;
        bprefix:hasType         bprefix:TVShow ;
        bprefix:isListedin      bprefix:TVComedies , <http://raghav/Rathi#Kids'TV> .

bprefix:title84  a              bprefix:Title ;
        bprefix:fromCountry     bprefix:UnitedKingdom ;
        bprefix:hasCast         bprefix:PaulHollywood ;
        bprefix:hasDateAdded    "September 29, 2017" ;
        bprefix:hasDescription  "Gear up for a fast-paced journey as celebrity chef and avid auto enthusiast Paul Hollywood takes in the cars and culture of France, Italy and Germany." ;
        bprefix:hasDuration     "1 Season" ;
        bprefix:hasID           "80199032"^^xsd:int ;
        bprefix:hasRating       bprefix:TV-14 ;
        bprefix:hasReleaseyear  "2014"^^xsd:int ;
        bprefix:hasTitle        "Paul Hollywood's Big Continental Road Trip" ;
        bprefix:hasType         bprefix:TVShow ;
        bprefix:isListedin      bprefix:BritishTVShows , bprefix:Docuseries , bprefix:InternationalTVShows .

bprefix:title28  a              bprefix:Title ;
        bprefix:fromCountry     bprefix:UnitedStates ;
        bprefix:hasDateAdded    "September 7, 2018" ;
        bprefix:hasDescription  "Women whO ve been sexually brutalized in war-torn Congo begin to heal at City of Joy, a center that helps them regain a sense of self and empowerment." ;
        bprefix:hasDirector     bprefix:MadeleineGavin ;
        bprefix:hasDuration     "77 min" ;
        bprefix:hasID           "80203094"^^xsd:int ;
        bprefix:hasRating       bprefix:TV-MA ;
        bprefix:hasReleaseyear  "2018"^^xsd:int ;
        bprefix:hasTitle        "City of Joy" ;
        bprefix:hasType         bprefix:Movie ;
        bprefix:isListedin      bprefix:Documentaries .

Now I want to move the triples where title hasReleaseyear>2015 from this default graph to a named graph http://example.org/mynamedgraph.

I can construct the triples that I want to move using

CONSTRUCT {?title ?predicate ?object} WHERE{
  ?title ?predicate ?object.
  ?title bprefix:hasReleaseyear ?year FILTER(?year>2015)
}

What I could look online was that MOVE operation will move "all" the triples from default to this named graph. How can I filter the triples before moving them from default graph to named graph.

Stanislav Kralin
  • 11,070
  • 4
  • 35
  • 58
Raghav Rathi
  • 95
  • 10
  • 3
    "MOVE" in SPARQL is basically just `DELETE ... INSERT ... WHERE ...`: `DELETE {?title ?predicate ?object.} INSERT {graph {?title ?predicate ?object.} } WHERE {?title ?predicate ?object. ?title bprefix:hasReleaseyear ?year FILTER(?year>2015)}` – UninformedUser May 10 '20 at 10:32
  • yeah right, I was thinking the same. – Raghav Rathi May 10 '20 at 10:37

0 Answers0