Skip to content
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

Add support for saving base URI declarations in RDF::Trine::NamespaceMap and parsers/serializers #131

Open
kasei opened this issue Aug 31, 2015 · 2 comments
Assignees

Comments

@kasei
Copy link
Owner

kasei commented Aug 31, 2015

Discussed in the comments of #130.

@VladimirAlexiev
Copy link

Not just to save @base but also to use in abbreviate. Eg

 my $map     = RDF::Trine::NamespaceMap->new();
 my $parser  = RDF::Trine::Parser->new('turtle', namespaces => $map);
 $parser->parse_file_into_model( $base, \*DATA, $model, namespaces => $map );
    # can it feed from filehandle?

 use feature 'say';
 say $map->abbreviate('http://museum1.org/object/BCR187052');    # <object/BCR187052> # uses base
 say $map->abbreviate('http://museum2.org/object/BCR187052');    # :object/BCR187052  # uses empty prefix. Slash in CURIE. THIS IS NOT VALID Turtle but nice for printing examples
 say $map->abbreviate('http://museum3.org/object/BCR187052');    # <http://museum3.org/object/BCR187052> # neither base nor prefix
 say $map->abbreviate('http://vocab.getty.edu/aat/');            # aat:              # empty local name
 say $map->abbreviate('http://vocab.getty.edu/aat/1234');        # aat:1234          # starting digit in CURIE. This is valid Turtle 1.1
 say $map->abbreviate('http://vocab.getty.edu/aat/contrib/456'); # aat_contrib:456   # longest prefix match

 __DATA__
 @base     <http://museum1.org/>.
 @prefix : <http://museum2.org/>.                    # Another Museum
 @prefix aat:         <http://vocab.getty.edu/aat/>. # Getty AAT
 @prefix aat_contrib: <http://vocab.getty.edu/aat/contrib/>.

@VladimirAlexiev
Copy link

Hi @kasei when could you fix this?

@kasei kasei self-assigned this Jan 9, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants