Return-Path: X-Original-To: apmail-incubator-stanbol-dev-archive@minotaur.apache.org Delivered-To: apmail-incubator-stanbol-dev-archive@minotaur.apache.org Received: from mail.apache.org (hermes.apache.org [140.211.11.3]) by minotaur.apache.org (Postfix) with SMTP id 207BF85C6 for ; Mon, 8 Aug 2011 08:18:18 +0000 (UTC) Received: (qmail 11158 invoked by uid 500); 8 Aug 2011 08:18:17 -0000 Delivered-To: apmail-incubator-stanbol-dev-archive@incubator.apache.org Received: (qmail 11033 invoked by uid 500); 8 Aug 2011 08:18:11 -0000 Mailing-List: contact stanbol-dev-help@incubator.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: stanbol-dev@incubator.apache.org Delivered-To: mailing list stanbol-dev@incubator.apache.org Received: (qmail 10923 invoked by uid 99); 8 Aug 2011 08:18:06 -0000 Received: from nike.apache.org (HELO nike.apache.org) (192.87.106.230) by apache.org (qpsmtpd/0.29) with ESMTP; Mon, 08 Aug 2011 08:18:06 +0000 X-ASF-Spam-Status: No, hits=-0.7 required=5.0 tests=FREEMAIL_FROM,RCVD_IN_DNSWL_LOW,SPF_PASS,T_TO_NO_BRKTS_FREEMAIL X-Spam-Check-By: apache.org Received-SPF: pass (nike.apache.org: domain of rupert.westenthaler@gmail.com designates 74.125.82.43 as permitted sender) Received: from [74.125.82.43] (HELO mail-ww0-f43.google.com) (74.125.82.43) by apache.org (qpsmtpd/0.29) with ESMTP; Mon, 08 Aug 2011 08:17:58 +0000 Received: by wwe32 with SMTP id 32so3959044wwe.0 for ; Mon, 08 Aug 2011 01:17:38 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=mime-version:in-reply-to:references:date:message-id:subject:from:to :content-type:content-transfer-encoding; bh=vCbV75sTkDVNpJ274/vmL6bAxFnIiqsowGbFR5+XmNs=; b=NAAar61j0gHcpo0YmwrlbX+5bKqc4n9R3ZITlEunEg5m3M3bZytLcCGh63tKZKwEHG CVA0MuJ8g2GYASCwHSIXSTSJSHb+grJVFk+MEPCnUoe1m4JD2SM9fuh5/b03+cGno93d UEPUeKbxlUeQb6HjrVXZHIOnwJbHVsbnrE2Qg= MIME-Version: 1.0 Received: by 10.216.80.96 with SMTP id j74mr193660wee.72.1312791458087; Mon, 08 Aug 2011 01:17:38 -0700 (PDT) Received: by 10.216.70.78 with HTTP; Mon, 8 Aug 2011 01:17:38 -0700 (PDT) In-Reply-To: <798CB1570E93D245815FC1545D41FBA2053B8566@Paperboy.lan.gossinteractive.com> References: <798CB1570E93D245815FC1545D41FBA2053B7FF3@Paperboy.lan.gossinteractive.com> <798CB1570E93D245815FC1545D41FBA2053B8094@Paperboy.lan.gossinteractive.com> <798CB1570E93D245815FC1545D41FBA2053B80DB@Paperboy.lan.gossinteractive.com> <798CB1570E93D245815FC1545D41FBA2053B8123@Paperboy.lan.gossinteractive.com> <798CB1570E93D245815FC1545D41FBA2053B8566@Paperboy.lan.gossinteractive.com> Date: Mon, 8 Aug 2011 10:17:38 +0200 Message-ID: Subject: Re: Delete, Update locally cached entities From: Rupert Westenthaler To: stanbol-dev@incubator.apache.org Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: quoted-printable X-Virus-Checked: Checked by ClamAV on apache.org Hi On Fri, Aug 5, 2011 at 5:52 PM, Rohana Rajapakse wrote: > > Hi, > > Thanks to Rupert, I can now add entities from an RDF file. > > However, neither the POST nor the PUT requests add entities that are new = among other existing ones. =C2=A0The updateOrCreateEntity(...) method needs= all the entities being added not to present in the index (during adding en= tities). Also it does not add any new entities in the update mode. > Exactly, this is how it is implemented right now. > I think we need another method that updates existing entities AND adds ne= w entities. > Would you prefer to 1. allow also the addition of new entities in "update mode" (PUT requests) as default or 2. the usage of an additional switch that tells the Entityhub to also allow the creation/update of Entities. POST http://localhost:8080/entityhub/entity?update=3Dtrue/false (to enable/disable update of existing entities for POST requests; default=3Dfalse) PUT http://localhost:8080/entityhub/entity?create=3Dture/false (to enable/disable the creation of new entities for PUT requests; default=3Dfalse) best Rupert > > Regards > > Rohana > > -----Original Message----- > From: Rupert Westenthaler [mailto:rupert.westenthaler@gmail.com] > Sent: 02 August 2011 16:59 > To: stanbol-dev@incubator.apache.org > Subject: Re: Delete, Update locally cached entities > > Hi > > On Tue, Aug 2, 2011 at 5:06 PM, Rohana Rajapakse > wrote: >> Thanks, I think understand it now. I will think of a user case for delet= ing cache of referenced site entities. At the moment I am playing with enti= tyhub to see what it can de. >> >> >> By the way, I tried creating all entities from the rdf file available he= re =C2=A0 http://openlylocal.com/councils.rdf =C2=A0(I have downloaded the = file into my local disk in the name "councils.rdf") >> >> Here is the curl I used: >> >> curl -X POST -H "Content-Type: application/rdf+xml" --data "@councils.rd= f" http://localhost:8080/entityhub/entity >> >> I don't know if it worked (no error messages). > > It had not worked, because in the RepresentationReader (the component > that reads the Entities from the parsed RDF data) there was a > restriction to only create Entities if a rdf:type property where > present for a Resource. I removed this restriction in revision 1153171 > [1]. > >> >> Then I tried to retrieve the entity with id/uri http://openlylocal.com/i= d/councils/180 =C2=A0which is present in the source rdf file. >> >> The curl I used is: >> >> curl http://localhost:8080/entityhub/entity?id=3Dhttp://openlylocal.com/= id/councils/180 >> > > After this fix this should work as expected. > > best > Rupert Westenthaler > > [1] http://svn.apache.org/viewvc?view=3Drevision&revision=3D1153171 > >> >> >> -----Original Message----- >> From: Rupert Westenthaler [mailto:rupert.westenthaler@gmail.com] >> Sent: 02 August 2011 15:12 >> To: stanbol-dev@incubator.apache.org >> Subject: Re: Delete, Update locally cached entities >> >> On Tue, Aug 2, 2011 at 3:07 PM, Rohana Rajapakse >> wrote: >>> Thanks a lot Rupert. >>> >>> I am interested in deleting an entity locally cached for a referenced s= ite too. Aren't they (locally managed entities and referenced site entities= cached locally) stored in the same way (in a Solr/Clerrezza Yard)? Aren't = they treated the same/similar (as symbols) once you store them locally? I t= hought they were, because you can work with (referenced entities) off-line = once you have locally cached/stored them. >>> >> By directly using the Java API of the Yard it would be possible but >> via the RESTful interface there is currently no way to delete a >> locally cached version. >> >> The idea behind this is that >> >> * entities of the "/entityhub/entity" are considered as locally >> managed. Therefore you can create/update and delete them. >> * entities of "/entityhub/site/{siteId}/entity" are considered as >> governed by this site and therefore read only. >> >> However as mentioned in my first replay deleting a locally cached >> version (e.g. to force the update to a current remote version) is >> absolutely something that should be supported. >> >> If you have a usage scenario that would require a ReferencedSite that >> also allows full CRUD access please let me know. I would be very >> interested! >> >> >> If you want to try to directly use the Java API I would suggest to use >> something like this >> >> @Reference >> org.apache.stanbol.entityhub.servicesapi.yard.YardManager yardManager; >> >> @Reference >> org.apache.stanbol.entityhub.servicesapi.site.ReferencedSiteManager site= Manager; >> >> //the entity we want to remove from the local cache >> Siring entityToRemoveTheLocallyCacheVersion =3D "urn:demo" >> >> //1. get the referenced site >> >> //a) first possibility to use the ReferencedSiteManager: >> >> String siteId =3D "mySite"; //the site in question >> ReferencedSite site =3D siteManager.getReferencedSite(siteId); >> >> // b) Second possibility would be to directly inject the Referenced >> // site or use a ServiceTracker by filtering on the >> // "org.apache.stanbol.entityhub.site.id" property with the siteId >> // value >> >> //2. get the ID of the Yard used to cache local entities >> >> //first check if the site uses a local cache >> CacheStrategy cacheStrategy =3D site.getConfiguration().getCacheStrategy >> if(cacheStrategy =3D=3D CacheStrategy.none){ >> =C2=A0 =C2=A0throw new IllegalStateException("Site does not use a local = Cache!") >> } >> >> //Note that the cacheID is also used as ID for the Yard >> String yardId =3D site.getConfiguration().getCacheId(); >> if(yardId =3D=3D null) { >> =C2=A0 =C2=A0//this should not be the case if "cacheStrategy !=3D CacheS= trategy.none" >> =C2=A0 =C2=A0throw new IllegalStateException("Yard ID of ReferencedSite = "+siteId+ >> =C2=A0 =C2=A0 =C2=A0 =C2=A0" is NULL even that CacheStrategy is set to "= +cacheStrategy); >> } >> >> //3. get the Yard with that ID >> // here again you can use the YardManager or optionally also a >> // ServiceTracker with a filter on the >> // "org.apache.stanbol.entityhub.yard.id" property with the value >> // of yardId >> >> Yard localCache =3D yardManager.getYard(yardId) >> if(localCache !=3D null=3D{ >> =C2=A0 =C2=A0localCache.remove(entityToRemoveTheLocallyCacheVersion); >> } //else local cache is currently not available >> >> >> BTW: there is no direct way to get the Yard from the ReferencedSite >> interface. This is the reason why you need to lookup the Yard via the >> YardManager. >> >> best >> Rupert Westenthaler >> >>> Please point me to any detailed documentation on the web (if any). >>> >>> Rohana >>> >>> >>> -----Original Message----- >>> From: Rupert Westenthaler [mailto:rupert.westenthaler@gmail.com] >>> Sent: 02 August 2011 12:49 >>> To: stanbol-dev@incubator.apache.org >>> Subject: Re: Delete, Update locally cached entities >>> >>> On Tue, Aug 2, 2011 at 1:20 PM, Rohana Rajapakse >>> wrote: >>>> Hi, >>>> >>>> I was under the impression that the entityhub/entity can be used for m= anaging local (cached) entities. I am confused with what this page/endpoint= http://localhost:8080/entityhub/entity says (page to get/create/update/del= ete Entities Managed by the entity hub). Am I missing something here? >>>> >>> >>> Yeas the entityhub/entity endpoint supports full CRUD. I was thinking >>> you talk about updating an entity locally cached for a referenced site >>> ... >>> >>> Here are some examples for the "entityhub/entity" service endpoint: >>> >>> create all entities within the parsed RDF graph >>> >>> curl -X POST -H "Content-Type: application/rdf+xml" --data >>> "@{rdfXmlFile}" http://localhost:8080/entityhub/entity >>> >>> Note that Entities are created for all subjects used in triples of the >>> parsed RDF data. E.g. parsing a RDF file containing a SKOS thesaurus >>> should create Entities for all skos:Concept's and the >>> skos:ConcpetScheme. >>> >>> If one only want to create a specific Entity (and ignore all other >>> triples) one needs to specify the ID of the Entity to create as >>> additional parameter. >>> >>> curl -X POST -H "Content-Type: application/rdf+xml" --data >>> "@{rdfXmlFile}" http://localhost:8080/entityhub/entity?id=3D{entity-uri= } >>> >>> This will only create the Entity with the id {entity-uri} and ignore >>> all triples within the parsed {rdfXmlFile} that use an other URI as >>> subject. >>> >>> >>> >>> Retrieval works the same as for referenced sites >>> >>> curl http://localhost:8080/entityhub/entity?id=3D{entity-uri} >>> >>> >>> >>> Update works the same way. Only use -X PUT instead of -X POST >>> >>> >>> To delete an Entity use >>> >>> curl -X DELETE http://localhost:8080/entityhub/entity?id=3D{entity-id} >>> >>> >>> best >>> Rupert Westenthaler >>> >>>> >>>> Rohana >>>> >>>> -----Original Message----- >>>> From: Rupert Westenthaler [mailto:rupert.westenthaler@gmail.com] >>>> Sent: 02 August 2011 11:06 >>>> To: stanbol-dev@incubator.apache.org >>>> Subject: Re: Delete, Update locally cached entities >>>> >>>> Hi >>>> >>>> On Tue, Aug 2, 2011 at 10:42 AM, Rohana Rajapakse >>>> wrote: >>>>> How do you delete/update locally cached entities in Entityhub? Which >>>>> endpoint(s) can I use? Can someone pass me a sample CURL instructions >>>>> please. >>>>> >>>> ReferencedSites are read only. Via the RESTful interface there is no >>>> possibility to delete/update entities. >>>> Currently there is also no possibility to control the behavior of the >>>> local cache. >>>> >>>> The preferred way to provide this feature would be to use the HTTP >>>> Cache-Control headers [1] as described by [2]. >>>> This would allow to update the local cache by adding the >>>> "Cache-Control: max-age=3D0" to a request. >>>> >>>> To support this one would also need to extend the interface of the >>>> ReferencedSite to allow to parse CacheControl parameters along with >>>> requests. >>>> >>>> If this would solve your issue I can create an JIRA issue for this new= feature. >>>> >>>> best >>>> Rupert Westenthaler >>>> >>>> [1] http://www.w3.org/Protocols/rfc2616/rfc2616-sec14.html#sec14.9 >>>> [2] http://incubator.apache.org/stanbol/docs/trunk/entityhub/entityhub= andlinkeddata.html#cache-controlhttpwwww3orgprotocolsrfc2616rfc2616-sec14ht= mlsec149 >>>> >>>>> >>>>> >>>>> Thanks >>>>> >>>>> >>>>> >>>>> Rohana >>>>> >>>>> >>>>> >>>>> >>>>> Sign-up for our monthly newsletter www.gossinteractive.com/newsletter >>>>> >>>>> Registered Office: c/o Bishop Fleming, Cobourg House, Mayflower Stree= t, Plymouth, PL1 1LG. Company Registration No: 3553908 >>>>> >>>>> This email contains proprietary information, some or all of which may= be legally privileged. It is for the intended recipient only. If an addres= sing or transmission error has misdirected this email, please notify the au= thor by replying to this email. If you are not the intended recipient you m= ay not use, disclose, distribute, copy, print or rely on this email. >>>>> >>>>> Email transmission cannot be guaranteed to be secure or error free, a= s information may be intercepted, corrupted, lost, destroyed, arrive late o= r incomplete or contain viruses. This email and any files attached to it ha= ve been checked with virus detection software before transmission. You shou= ld nonetheless carry out your own virus check before opening any attachment= . GOSS Interactive Ltd accepts no liability for any loss or damage that may= be caused by software viruses. >>>>> >>>>> wn virus check before opening any attachment. GOSS Interactive Ltd ac= cepts no liability for any loss or damage that may be caused by software vi= ruses. >>>>> >>>>> >>>>> >>>>> >>>> >>>> >>>> >>>> -- >>>> | Rupert Westenthaler=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0=C2=A0 r= upert.westenthaler@gmail.com >>>> | Bodenlehenstra=C3=9Fe 11=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 = =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0=C2=A0 ++43-699-1110= 8907 >>>> | A-5500 Bischofshofen >>>> >>> >>> >>> >>> -- >>> | Rupert Westenthaler=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0=C2=A0 ru= pert.westenthaler@gmail.com >>> | Bodenlehenstra=C3=9Fe 11=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2= =A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0=C2=A0 ++43-699-1110890= 7 >>> | A-5500 Bischofshofen >>> >>> >>> >>> >>> Sign-up for our free client webinar: http://www.gossinteractive.com/web= inar >>> >>> Registered Office: c/o Bishop Fleming, Cobourg House, Mayflower Street,= Plymouth, PL1 1LG. Company Registration No: 3553908 >>> >>> This email contains proprietary information, some or all of which may b= e legally privileged. It is for the intended recipient only. If an addressi= ng or transmission error has misdirected this email, please notify the auth= or by replying to this email. If you are not the intended recipient you may= not use, disclose, distribute, copy, print or rely on this email. >>> >>> Email transmission cannot be guaranteed to be secure or error free, as = information may be intercepted, corrupted, lost, destroyed, arrive late or = incomplete or contain viruses. This email and any files attached to it have= been checked with virus detection software before transmission. You should= nonetheless carry out your own virus check before opening any attachment. = GOSS Interactive Ltd accepts no liability for any loss or damage that may b= e caused by software viruses. >>> >>> >>> >>> >> >> >> >> -- >> | Rupert Westenthaler=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0=C2=A0 rup= ert.westenthaler@gmail.com >> | Bodenlehenstra=C3=9Fe 11=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2= =A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0=C2=A0 ++43-699-1110890= 7 >> | A-5500 Bischofshofen >> > > > > -- > | Rupert Westenthaler=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0=C2=A0 rupe= rt.westenthaler@gmail.com > | Bodenlehenstra=C3=9Fe 11=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2= =A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0=C2=A0 ++43-699-1110890= 7 > | A-5500 Bischofshofen > --=20 | Rupert Westenthaler=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0=C2=A0 rupert= .westenthaler@gmail.com | Bodenlehenstra=C3=9Fe 11=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 = =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0=C2=A0 ++43-699-11108907 | A-5500 Bischofshofen