AKSW / jekyll-rdf

📃 A Jekyll plugin to include RDF data in your static site or build a complete site for your RDF graph
http://aksw.org/Projects/JekyllRDF
Other
57 stars 10 forks source link

Filter for container collection #69

Closed Simaris closed 7 years ago

Simaris commented 7 years ago

Fix #66, fix #10

coveralls commented 7 years ago

Coverage Status

Coverage remained the same at 100.0% when pulling 5bc9c50e56e0141bf759be325c662b906c2a083a on Simaris:filter_container_collection into c82d47cb03eac39dc77b96ca77ff9d34bacff98d on white-gecko:develop.

coveralls commented 7 years ago

Coverage Status

Coverage remained the same at 100.0% when pulling 5bc9c50e56e0141bf759be325c662b906c2a083a on Simaris:filter_container_collection into c82d47cb03eac39dc77b96ca77ff9d34bacff98d on white-gecko:develop.

coveralls commented 7 years ago

Coverage Status

Coverage remained the same at 100.0% when pulling 31826e676c4cfd29f607a3f83d824e1cf64ce318 on Simaris:filter_container_collection into c82d47cb03eac39dc77b96ca77ff9d34bacff98d on white-gecko:develop.

coveralls commented 7 years ago

Coverage Status

Coverage remained the same at 100.0% when pulling 4a3675635cf07620f0cb35c16e81fab170197744 on Simaris:filter_container_collection into c82d47cb03eac39dc77b96ca77ff9d34bacff98d on white-gecko:develop.

white-gecko commented 7 years ago

The branch needs to be rebased.

white-gecko commented 7 years ago

This feature currently fails with:

n-triple:
 <http://example.org/knows> 
  Liquid Exception: undefined method `f' for #<RDF::Query::Solution:0x2b053aafa4b4({})> in Sebastian/index.html
jekyll 3.3.0 | Error:  undefined method `f' for #<RDF::Query::Solution:0x2b053aafa4b4({})>

with this graph:

@prefix rdf: <http://www.w3.org/1999/02/22-rdf-syntax-ns#> .

<http://example.org/Sebastian>
    a <http://xmlns.com/foaf/0.1/Agent>, <http://xmlns.com/foaf/0.1/Person> ;
    <http://xmlns.com/foaf/0.1/firstName> "Sebastian" .

_:genid4 <http://www.w3.org/1999/02/22-rdf-syntax-ns#first> "somebody" .
_:genid4 <http://www.w3.org/1999/02/22-rdf-syntax-ns#rest> <http://www.w3.org/1999/02/22-rdf-syntax-ns#nil> .
_:genid5 <http://www.w3.org/1999/02/22-rdf-syntax-ns#first> "Ruby" .
_:genid5 <http://www.w3.org/1999/02/22-rdf-syntax-ns#rest> _:genid4 .
_:genid6 <http://www.w3.org/1999/02/22-rdf-syntax-ns#first> "Jekyll-RDF" .
_:genid6 <http://www.w3.org/1999/02/22-rdf-syntax-ns#rest> _:genid5 .
_:genid7 <http://www.w3.org/1999/02/22-rdf-syntax-ns#first> "Informatik" .
_:genid7 <http://www.w3.org/1999/02/22-rdf-syntax-ns#rest> _:genid6 .
<http://example.org/knows> <http://www.w3.org/1999/02/22-rdf-syntax-ns#first> "something" .
<http://example.org/knows> <http://www.w3.org/1999/02/22-rdf-syntax-ns#rest> _:genid7 .
<http://example.org/Sebastian> <http://xmlns.com/foaf/0.1/knows> <http://example.org/knows> .

and this default_layout:

---
---
<h1 class="page-heading">{{ page.rdf | rdf_property: '<http://xmlns.com/foaf/0.1/name>' }}</h1>

<dl>
    {% assign firstname = page.rdf | rdf_property: '<http://xmlns.com/foaf/0.1/firstName>' %}
    {% assign lastname = page.rdf | rdf_property: '<http://xmlns.com/foaf/0.1/lastName>' %}
    {% assign gender = page.rdf | rdf_property: '<http://xmlns.com/foaf/0.1/gender>' %}
    {% if firstname %}
    <dt>Vorname:</dt>
    <dd>{{ firstname }}</dd>
    {% endif %}
    {% if lastname %}
    <dt>Nachname:</dt>
    <dd>{{ lastname }}</dd>
    {% endif %}
    {% if lastname %}
    <dt>Geschlecht:</dt>
    <dd>{{ gender }}</dd>
    {% endif %}
</dl>

<ul>
    {% assign coll = page.rdf | rdf_property: '<http://xmlns.com/foaf/0.1/knows>'  %}
    {% if coll %}
    <span>{{ coll }}</span>
    {% assign array = coll | rdf_collection %}
    {% for know in array %}
    <li>{{ know }}</li>
    {% endfor %}
    {% endif %}
</ul>
white-gecko commented 7 years ago

Ok, the issue with undefined methodf' for #<RDF::Query::Solution:0x2b053aafa4b4({})>` is solved with sparql lib 2.2.1

white-gecko commented 7 years ago

@Simaris looks good, will you also remove the dependency to the git repository and set sparql to 2.2.1 in the gemspec?

Simaris commented 7 years ago

Already done that, just pushed prematurely

coveralls commented 7 years ago

Coverage Status

Coverage remained the same at 100.0% when pulling 2354a08803617b5952767e0d13f668da54cf765b on Simaris:filter_container_collection into 616ba14cf4659d43558aef276732ed5d37e63eb4 on white-gecko:develop.

coveralls commented 7 years ago

Coverage Status

Coverage remained the same at 100.0% when pulling 3e1a6ae82318bd8dfdd842797929be797572dd94 on Simaris:filter_container_collection into 616ba14cf4659d43558aef276732ed5d37e63eb4 on white-gecko:develop.

white-gecko commented 7 years ago

@Simaris I've done some history rewriting to make the changes more compact. Further I've also made the sparql version constraint less restrictive (cf. https://ruby-doc.org/stdlib-2.0.0/libdoc/rubygems/rdoc/Gem/Version.html#class-Gem::Version-label-Preventing+Version+Catastrophe-3A). Is this ok?

coveralls commented 7 years ago

Coverage Status

Coverage remained the same at 100.0% when pulling 66fd77b6b81d8f807533f16168fad3993a9a3ffe on Simaris:filter_container_collection into 616ba14cf4659d43558aef276732ed5d37e63eb4 on white-gecko:develop.

Simaris commented 7 years ago

It seems correct to me