-
Notifications
You must be signed in to change notification settings - Fork 11
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
Attean::IRI not compatible with "URI" #151
Comments
Yes, that's right! I have worried a bout about it too, but the way I've approached it is through coercions in the type system, which has recently entered Attean. There's the I'm not sure the code in URI/NamespaceMap.pm#L201 is relevant, IIRC, that is about turning an argument into a string, and in that case, I'd love to see your use case $model->subjects ($map->rdf->type, $map->owl->Ontology) supported, because I do that all the time myself. I'm not sure how, but I tend to think it should be supported through the typing system and their coercions somehow. Would be happy to hear suggestions, I am certain open to change |
|
No, and there's where the actual disconnect is, and where I think we need to see if we can fix things.
You should be able to use |
I use conversions like this: sub iri ($) {
# convert string or URI (returned by URI::NamespaceMap $MAP) to Attean::IRI
my $uri = shift;
Attean::IRI->new (value => ref($uri) ? $uri->as_string : $uri, lazy => 1)
}
sub uri ($) {
my $iri = shift;
URI->new (ref($iri) ? $iri->as_string : $iri);
}
But:
|
Yes, it can convert from a string too (not sure I understood the last part of the question).
No, but I consider that the natural next step: I think the main tension is between the Note that I did some experiments, and @kasei did actually merge them, so there is code in I ran out of time to explore this in the depth it needs. Not only do we need to pass the components back and forth, we also need to test it properly and benchmark it, but I haven't got the time.
No, I don't think so.
No, but I exploited that you can pass the components to |
@kjetilk :
I mean whether it can take a URI argument, and use
If I use a stock
I understand. But in some applications (eg semweb) you don't need to parse IRIs/URIs into components at all, so a |
Note that |
I'm still not sure I understand, could you provide a complete code example?
No, there's a coercion for that in All these use
It isn't always that unproblematic, as a pure string comparison might not be sufficient. RFC3986 has a section on comparison and often these issues jump out to bite us in semweb applications. Often, you need to parse and normalize the URI at some point in the process. It shouldn't be when you most need performance, but it requires an elaborate design at times. |
I guess
URI::NamespaceMap
is the preferred way to make URIs from pnames of well-known namespaces, or namespaces harvested from an ingested RDF file.At least
bin/attean_query
uses that class.However,
URI::NamespaceMap
returnsURI
which is not compatible withAttean::IRI
.Eg if you try to use:
Attean returns an error like this:
In
URI::NamespaceMap::_scrub_uri()
https://metacpan.org/release/URI-NamespaceMap/source/lib/URI/NamespaceMap.pm#L201I see some code for compatibility with Trine, but not with Attean.
@kasei or @kjetilk, could you take care of this?
The text was updated successfully, but these errors were encountered: