Last active
May 24, 2017 01:46
-
-
Save jwestgard/8bdfc61899f94127d373ee3540617df2 to your computer and use it in GitHub Desktop.
Revisions
-
jwestgard revised this gist
May 24, 2017 . 1 changed file with 3 additions and 2 deletions.There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -14,7 +14,8 @@ g.parse('/path/to/your/file.ttl', format='turtle') len(g) for (s,p,o) in g: print(s,p,o) # if you create a second graph object, you can compare the two like this: g1 == g2 not_g2 = g1 - g2 not_g1 = g2 - g1 etc. -
jwestgard created this gist
May 23, 2017 .There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -0,0 +1,20 @@ # launch the interactive prompt python3 # import the module import rdflib # create an empty graph object g = rdflib.Graph() # parse a turtle file g.parse('/path/to/your/file.ttl', format='turtle') # now you have an RDF graph to work with, for example: len(g) for (s,p,o) in g: print(s,p,o) # if you create a second graph object, you can compare the two like g1 == g2 g3 = g1 - g2 etc.