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

Make uri mapping neat #99

Merged
merged 6 commits into from
Nov 6, 2017
Merged

Conversation

Simaris
Copy link
Collaborator

@Simaris Simaris commented Jul 31, 2017

Fix #94, #78, #82
it does not throw the error described at the end of #94

@Simaris Simaris added this to the 3.0.0 milestone Jul 31, 2017
@coveralls
Copy link

coveralls commented Jul 31, 2017

Coverage Status

Coverage decreased (-0.4%) to 99.572% when pulling 4e31ca4 on Simaris:make_URI_mapping_neat into 600cf61 on white-gecko:develop.

@coveralls
Copy link

coveralls commented Jul 31, 2017

Coverage Status

Coverage remained the same at 100.0% when pulling 6c20443 on Simaris:make_URI_mapping_neat into 600cf61 on white-gecko:develop.

# opaque jekyll produces static pages, so we do not dereferencing
# query queries do not address resources
# file_name << "#/#{uri[:fragment]}" unless uri[:fragment].nil? fragments are not evaluated by browsers, only by clients
rescue Addressable::URI::InvalidURIError => x #unclean coding: blanknodes are recognized through errors
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please remove this comment, if this is not true anymore

file_name += '/'
end
rescue URI::InvalidURIError => x #unclean coding: blanknodes are recognized through errors
#key_field = [:scheme, :userinfo, :host, :port, :registry, :path, :opaque, :query, :fragment]
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please make a more verbose note, that these are the parameters of uri

@coveralls
Copy link

coveralls commented Aug 1, 2017

Coverage Status

Coverage remained the same at 100.0% when pulling bc32cc8 on Simaris:make_URI_mapping_neat into 273336b on white-gecko:develop.

@coveralls
Copy link

coveralls commented Aug 18, 2017

Coverage Status

Coverage remained the same at 100.0% when pulling d7c16bd on Simaris:make_URI_mapping_neat into 3e62c08 on white-gecko:develop.

Copy link
Member

@white-gecko white-gecko left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please also add dedicated tests for the new behavior please use the example given in https://github.com/white-gecko/jekyll-rdf/issues/94 for this.

@coveralls
Copy link

coveralls commented Sep 6, 2017

Coverage Status

Coverage decreased (-0.4%) to 99.61% when pulling 14652dd on Simaris:make_URI_mapping_neat into 3e0c41f on white-gecko:develop.

@coveralls
Copy link

coveralls commented Sep 7, 2017

Coverage Status

Coverage decreased (-0.3%) to 99.653% when pulling 088b02d on Simaris:make_URI_mapping_neat into 6da9634 on white-gecko:develop.

file_name = "invalids/#{term.to_s}"
Jekyll.logger.error("Invalid resource found: #{term.to_s} is not a proper uri")
Jekyll.logger.error("URI parser exited with message: #{x.message}")
end
end
# windows compatibility
file_name = file_name.gsub('_','_u')
file_name = file_name.gsub('//','/') # needs a better regex to include /// ////...
file_name = file_name.gsub(':','_D')
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think this should have been removed

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please also check if the // -> / replacement is still needed.

assert_equal "/b/x", Jekyll::Drops::RdfResource.new(RDF::URI("http://ex.org/b/x"), sparql, @site).page_url
assert_equal "/b/y/index.html", Jekyll::Drops::RdfResource.new(RDF::URI("http://ex.org/b/y/"), sparql, @site).render_path
assert_equal "/b/y/", Jekyll::Drops::RdfResource.new(RDF::URI("http://ex.org/b/y/"), sparql, @site).page_url
assert_equal "/a.html", Jekyll::Drops::RdfResource.new(RDF::URI("http://ex.org/a.html"), sparql, @site).render_path
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This line should be duplicated for page_url = "/a.html"

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

because the .html is already contained in the URI


should "let fragment-identifier default to super resource" do
assert_equal "/c.html", Jekyll::Drops::RdfResource.new(RDF::URI("http://ex.org/c#alpha"), sparql, @site).render_path
assert_equal "/c.html", Jekyll::Drops::RdfResource.new(RDF::URI("http://ex.org/c#beta"), sparql, @site).render_path
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

What is the page_url here?

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think the page_url should be "/c#alpha" resp. "/c#beta"

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

considering #94 we should only have another value for page_url if our subresource does not have a super resource.
The problem is that, checking if a superresource exist might be to complex for what we want to achieve


context "Jekyll::Drops::RdfResource.render_path"do
setup do
@config = Jekyll.configuration({'url' => "http://ex.org", 'baseurl' => "" })
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please duplicate this test for baseurl => "/", where the page_url for "http://ex.org/a" would be "a" and the render path would be "a.html"

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

maybe also do the same for baseurl => "/blog" with http://ex.org/blog/a
for http://ex.org/a in this case the page_url would be "/rdfsites/http/ex.org/a" (or "/rdfsites/http/ex/org/a") and the render_path: "/rdfsites/http/ex.org/a.html"

@coveralls
Copy link

coveralls commented Oct 4, 2017

Coverage Status

Coverage remained the same at 100.0% when pulling 368d73a on Simaris:make_URI_mapping_neat into 6da9634 on white-gecko:develop.

@Simaris Simaris force-pushed the make_URI_mapping_neat branch 2 times, most recently from 5969ee9 to 8a9771e Compare October 4, 2017 18:51
@coveralls
Copy link

coveralls commented Oct 4, 2017

Coverage Status

Coverage remained the same at 100.0% when pulling 5969ee9 on Simaris:make_URI_mapping_neat into 6da9634 on white-gecko:develop.

@coveralls
Copy link

coveralls commented Oct 4, 2017

Coverage Status

Coverage remained the same at 100.0% when pulling 8a9771e on Simaris:make_URI_mapping_neat into 6da9634 on white-gecko:develop.

@coveralls
Copy link

coveralls commented Oct 23, 2017

Coverage Status

Coverage remained the same at 100.0% when pulling d260859 on Simaris:make_URI_mapping_neat into 0770fae on white-gecko:develop.

@coveralls
Copy link

coveralls commented Oct 24, 2017

Coverage Status

Coverage decreased (-4.3%) to 95.745% when pulling 93ce9aa on Simaris:make_URI_mapping_neat into 0770fae on white-gecko:develop.

@coveralls
Copy link

coveralls commented Oct 24, 2017

Coverage Status

Coverage decreased (-6.6%) to 93.393% when pulling eb63217 on Simaris:make_URI_mapping_neat into 0770fae on white-gecko:develop.

@coveralls
Copy link

coveralls commented Oct 24, 2017

Coverage Status

Coverage remained the same at 100.0% when pulling a700943 on Simaris:make_URI_mapping_neat into 0770fae on white-gecko:develop.

assert_equal "/b/y/", Jekyll::Drops::RdfResource.new(RDF::URI("http://ex.org/b/y/"), @site).page_url
assert_equal "/a.html", Jekyll::Drops::RdfResource.new(RDF::URI("http://ex.org/a.html"), @site).render_path
assert_equal "/a.html", Jekyll::Drops::RdfResource.new(RDF::URI("http://ex.org/a.html"), @site).page_url
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Tab

should "let fragment-identifier default to super resource" do
assert_equal "/c.html", Jekyll::Drops::RdfResource.new(RDF::URI("http://ex.org/c#alpha"), @site).render_path
assert_equal "/c", Jekyll::Drops::RdfResource.new(RDF::URI("http://ex.org/c#alpha"), @site).page_url
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Tab

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The page_url here should be /c#alpha.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

assert_equal "/rdfsites/http/ex.org/a", Jekyll::Drops::RdfResource.new(RDF::URI("http://ex.org/a"), @site).page_url
assert_equal "/bla/blog/a.html", Jekyll::Drops::RdfResource.new(RDF::URI("http://ex.org/bla/blog/a"), @site).render_path
assert_equal "/a.html", Jekyll::Drops::RdfResource.new(RDF::URI("http://ex.org/a"), @site).render_path
assert_equal "/a", Jekyll::Drops::RdfResource.new(RDF::URI("http://ex.org/a"), @site).page_url
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

If 'url' => "http://ex.org", 'baseurl' => "/blog" is configured the correct renderpath for "http://ex.org/bla/blog/a" should be "/rdfsites/http/ex.org/bla/blog/a.html" not "/bla/blog/a.html". My test were already testing the right things as we have discussed.

assert_equal "rdfsites/http/ex.org/a", Jekyll::Drops::RdfResource.new(RDF::URI("http://ex.org/a"), @site).page_url
assert_equal "/bla/blog/a.html", Jekyll::Drops::RdfResource.new(RDF::URI("http://ex.org/bla/blog/a"), @site).render_path
assert_equal "/a.html", Jekyll::Drops::RdfResource.new(RDF::URI("http://ex.org/a"), @site).render_path
assert_equal "/a", Jekyll::Drops::RdfResource.new(RDF::URI("http://ex.org/a"), @site).page_url
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Same here

assert_equal "/bla/blog/a.html", Jekyll::Drops::RdfResource.new(RDF::URI("http://ex.org/bla/blog/a"), @site).render_path
assert_equal "/a.html", Jekyll::Drops::RdfResource.new(RDF::URI("http://ex.org/a"), @site).render_path
assert_equal "/a", Jekyll::Drops::RdfResource.new(RDF::URI("http://ex.org/a"), @site).page_url
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The last three lines are not correct.
If 'url' => "http://ex.org", 'baseurl' => "/blog" is configured the correct renderpath for "http://ex.org/bla/blog/a" should be "/rdfsites/http/ex.org/bla/blog/a.html" not "/bla/blog/a.html". My test were already testing the right things as we have discussed before.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You can also have a look at white-gecko@a700943#r146799188

assert_equal "/bla/blog/a.html", Jekyll::Drops::RdfResource.new(RDF::URI("http://ex.org/bla/blog/a"), @site).render_path
assert_equal "/a.html", Jekyll::Drops::RdfResource.new(RDF::URI("http://ex.org/a"), @site).render_path
assert_equal "/a", Jekyll::Drops::RdfResource.new(RDF::URI("http://ex.org/a"), @site).page_url
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The same problem as above.

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

My bad, thought we said baseurl and url have to be considered separately.

@coveralls
Copy link

coveralls commented Oct 29, 2017

Coverage Status

Coverage remained the same at 100.0% when pulling 9b68f2f on Simaris:make_URI_mapping_neat into 0770fae on white-gecko:develop.

assert_equal "rdfsites/http/ex.org/bla/blog/a.html", Jekyll::Drops::RdfResource.new(RDF::URI("http://ex.org/bla/blog/a"), @site).render_path
assert_equal "rdfsites/http/ex.org/a.html", Jekyll::Drops::RdfResource.new(RDF::URI("http://ex.org/a"), @site).render_path
assert_equal "rdfsites/http/ex.org/a", Jekyll::Drops::RdfResource.new(RDF::URI("http://ex.org/a"), @site).page_url
Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

rdfsites never has a leading / because it describes the same position independent of url and baseurl

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

no, there has to be a leading / as well.

@coveralls
Copy link

coveralls commented Nov 2, 2017

Coverage Status

Coverage remained the same at 100.0% when pulling c72b3e2 on Simaris:make_URI_mapping_neat into 0770fae on white-gecko:develop.

@classResources["http://xmlns.com/foaf/0.1/Person"].subClasses.any?{|class_res| class_res.to_s.eql? "http://pcai042.informatik.uni-leipzig.de/~dtp16/#AnotherSpecialPerson"}), "http://xmlns.com/foaf/0.1/Person should have http://pcai042.informatik.uni-leipzig.de/~dtp16/#SpecialPerson and http://pcai042.informatik.uni-leipzig.de/~dtp16/#AnotherSpecialPerson as subclass"
assert @classResources["http://pcai042.informatik.uni-leipzig.de/~dtp16/#AnotherSpecialPerson"].subClasses.any?{|class_res| class_res.to_s.eql? "http://pcai042.informatik.uni-leipzig.de/~dtp16/#SpecialPerson"},"http://pcai042.informatik.uni-leipzig.de/~dtp16/#AnotherSpecialPerson should have http://pcai042.informatik.uni-leipzig.de/~dtp16/#SpecialPerson as subclass"
assert (@classResources["http://xmlns.com/foaf/0.1/Person"].subClasses.any?{|class_res| class_res.to_s.eql? "http://pcai042.informatik.uni-leipzig.de/~dtp16#SpecialPerson"}&&
@classResources["http://xmlns.com/foaf/0.1/Person"].subClasses.any?{|class_res| class_res.to_s.eql? "http://pcai042.informatik.uni-leipzig.de/~dtp16#AnotherSpecialPerson"}), "http://xmlns.com/foaf/0.1/Person should have http://pcai042.informatik.uni-leipzig.de/~dtp16#SpecialPerson and http://pcai042.informatik.uni-leipzig.de/~dtp16#AnotherSpecialPerson as subclass"
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

is there an assert missing?

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

ok the previous line ends with &&

assert_equal "rdfsites/http/ex.org/bla/blog/a.html", Jekyll::Drops::RdfResource.new(RDF::URI("http://ex.org/bla/blog/a"), @site).render_path
assert_equal "rdfsites/http/ex.org/a.html", Jekyll::Drops::RdfResource.new(RDF::URI("http://ex.org/a"), @site).render_path
assert_equal "rdfsites/http/ex.org/a", Jekyll::Drops::RdfResource.new(RDF::URI("http://ex.org/a"), @site).page_url
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

no, there has to be a leading / as well.

@coveralls
Copy link

coveralls commented Nov 3, 2017

Coverage Status

Coverage remained the same at 100.0% when pulling 20c0327 on Simaris:make_URI_mapping_neat into 4da1758 on white-gecko:develop.

@white-gecko white-gecko merged commit 3af2a28 into AKSW:develop Nov 6, 2017
@Simaris Simaris deleted the make_URI_mapping_neat branch November 17, 2017 15:17
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

Successfully merging this pull request may close these issues.

3 participants