-
Notifications
You must be signed in to change notification settings - Fork 25
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Store::SPARQL reads and writes to Virtuoso (>=6.1.7) #113
Open
doriantaylor
wants to merge
12
commits into
kasei:master
Choose a base branch
from
doriantaylor:sparql-auth
base: master
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Changes from all commits
Commits
Show all changes
12 commits
Select commit
Hold shift + click to select a range
c4d964b
working on sparql
doriantaylor 47ea916
adding handler for json results
doriantaylor c0c1d35
butchering this thing to get virtuoso to work
doriantaylor cc79538
i totally cheated around the nil identifier but all tests pass
doriantaylor 2db40bb
fixing formatting
doriantaylor ff6f666
sparql endpoint speaks json
doriantaylor 388f7b2
fixing whitespace uhgain
doriantaylor 0cf8159
getting this bastard to work
doriantaylor 2fe3526
fixing whitespace for @kasei again
doriantaylor d0a8d2c
making tests pass
doriantaylor 36c49e6
adding notice to multiplicity block
doriantaylor 9e1ba4b
oh ffs more whitespace issues
doriantaylor File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains 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 characters
This file contains 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 characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -34,11 +34,11 @@ This document describes RDF::Trine version 1.001 | |
# Now print the results | ||
print "Names of things:\n"; | ||
while (my $st = $iter->next) { | ||
my $s = $st->subject; | ||
my $name = $st->object; | ||
# $s and $name have string overloading, so will print correctly | ||
print "The name of $s is $name\n"; | ||
my $s = $st->subject; | ||
my $name = $st->object; | ||
# $s and $name have string overloading, so will print correctly | ||
print "The name of $s is $name\n"; | ||
} | ||
|
||
=head1 DESCRIPTION | ||
|
@@ -96,7 +96,7 @@ use constant NIL_GRAPH => 'tag:[email protected],2010-01-01:RT:NIL'; | |
|
||
use Log::Log4perl qw(:easy); | ||
if (! Log::Log4perl::initialized() ) { | ||
Log::Log4perl->easy_init($ERROR); | ||
Log::Log4perl->easy_init($ERROR); | ||
} | ||
|
||
use RDF::Trine::Graph; | ||
|
@@ -199,6 +199,31 @@ sub store { | |
return RDF::Trine::Store->new_with_string( $config ); | ||
} | ||
|
||
=item C<< default_useragent ( [ $ua ] ) >> | ||
|
||
Returns the L<LWP::UserAgent> object used by default for any operation requiring network | ||
requests. Ordinarily, the calling code will obtain the default user agent, and clone it | ||
before further configuring it for a specific request, thus leaving the default object | ||
untouched. | ||
|
||
If C<< $ua >> is passed as an argument, sets the global default user agent to this object. | ||
|
||
=cut | ||
|
||
{ my $_useragent; | ||
sub default_useragent { | ||
my $class = shift; | ||
my $ua = shift || $_useragent; | ||
unless (defined($ua)) { | ||
$ua = LWP::UserAgent->new( | ||
agent => "RDF::Trine/$RDF::Trine::VERSION", | ||
#keep_alive => 1, # this is actually meaningless | ||
); | ||
} | ||
$_useragent = $ua; | ||
return $ua; | ||
}} | ||
|
||
1; # Magic true value required at end of module | ||
__END__ | ||
|
||
|
This file contains 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 characters
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'd much prefer we didn't hard-code this, and instead found some way to modularize the code so that the SPARQL store could apply this fix only when it thinks necessary (or have it be applied to all results, but only when called from the SPARQL store or when explicitly requested). I'll try to think about what sort of API would work well for that.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The problem here is that bnodes come through the sparql-results+xml format as nodeID://… The net effect is that without that line, the SPARQL results XML parser crashes when it tries to create a malformed bnode.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yeah, understood. I'd just like to fix this by updating the API instead of hard-coding the fix into the XML parser.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'm not really sure how to do this, other than making some kind of callback you can pass into the constructor (ugly), or otherwise a Virtuoso-specific subclass (worse).
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Actually, the ::Iterator::SAXHandler constructor could already take optional configuration arguments, it just wasn't documented. I've updated the code to allow passing in a custom handler to generate the bnode IDs. Have a look at commit eea4393.