Overview# Notes on how to register and delete RDF files in Virtuoso RDF store using curl and Python.
The following was used as a reference.
https://vos.openlinksw.com/owiki/wiki/VOS/VirtRDFInsert#HTTP PUT
curl# As described on the above page. First, create myfoaf.rdf as sample data for registration.
< r / d r f d : < f R f / : D o f R F a o D f < a F x : f f > m P o : l e a P n r f e s s : r : o n s f n a o o m n a r e > f d > = f 中 " : 村 h a 覚 t b < t o / p u f : t o / = a / " f x h : m t n l t a n p m s : e . / > c w m w / w f . o e a x f a / m 0 p . l 1 e / . " c > o m / p e o p l e / 中 村 覚 " > Next, execute the following command.
c u r l - T $ { f i l e n a m e 1 } $ { e n d p o i n t } / D A V / h o m e / $ { u s e r } / r d f _ s i n k / $ { f i l e n a m e 2 } - u $ { u s e r } : $ { p a s s w d }
A specific example is as follows.
c u r l - T m y f o a f . r d f h t t p : / / l o c a l h o s t : 8 8 9 0 / D A V / h o m e / d b a / r d f _ s i n k / m y f o a f . r d f - u d b a : d b a
Python# Here is an execution example. The following uses rdflib to create the RDF file from scratch. Also, by setting the action to delete, you can perform deletion.
i f f f e u p a # # # g s n g # g d d # u i e p m r r i n s a c # a . . a a r f l r p o o l d e s t a # C = = m a S s t t R l i i o m m e p r s i c # r e d a e a a e a f n r n o w o t # e G U d v r g = c r r t t r r a i = d n i a r R = ( e i = = i t e a e ( d d m n o t a I ( a s f i s c s r r f f e t " = = n e p R L s t l o d t " o p t p e e l l d h e i , o i p a r { n o i o s q i i = = b " " = R ( f t z e t a e n o n p u b b a d c D ) ( e F f e n a t n = s n s o e . " " " b r " F " r O i ( ( . i d = e e n s i n m h a e d h a A l d f r o p = s t m a y t " a e d t l F e e i e n o " = = = e s p m f t t l a t ( . s l a i c . o e o p e e t p " n t e d n r r " r s r s a : " t a : 中 a i n ( t e e d e t t p f e / 村 m n a ) } a q e q a a . / " / 覚 e a m . / t u l u t G c r l e " , t e e D e e e e u r e d o x ) i , n A " s t s s a f c a n o ' c V : t e t _ p i " a m a n r o / s " s c h m h p m = ' d h . : . o , p o l e f , e o p d d o s e ) i ( m u e e U r t . ) l e ) e t l ) R t : o e n / ( e I 8 r n c { u t R F 8 g a o u r e e O 9 / m d s l ( f A 0 p e i e , u , F " e , n r r o g } d l L p f = / a , i l o ' r t t e r u d a a e / m t f = u r 中 a f _ d t a 村 t - s a h l 覚 = 8 i t = " " ' n a ( ) x ) k , u m / s l { a e " f u r ) i t , l h e = p n ( a a u s m s s e e w } r d " , ) ) p a s s w d ) ) Summary# There may be other methods, but I hope this serves as a useful reference.