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

Property paths #274

Closed mikel-egana-aranguren closed 2 years ago

mikel-egana-aranguren commented 5 years ago

Is it possible to use property paths? Say we have this graph:

ex:hand ex:part-of ex:arm
ex:arm rdfs:label "arm"

What would be the filter for the path ex:part-of/rdfs:label? The following filter does not work:

Name: {{ page.rdf | rdf_property: 'ex:part-of/rdfs:label' }}

Thanks

white-gecko commented 5 years ago

That should be:

Name: {{ page.rdf | rdf_property: 'ex:part-of' | rdf_property: 'rdfs:label' }}

So this would work, if a hand belongs to one arm. As soon as it might belong to multiple arms youl'd need to split the expression and have a loop e.g.:

{% assign arms = page.rdf | rdf_property: 'ex:part-of', nil, true %}
{% for arm in arms %}
Name:  {{ arm | rdf_property: 'rdfs:label' }}
{% endfor %}

Which becomes complicated if there might be one arm with label and another one without a label. In such cases the property paths might make the syntax more concise.

For now I would consider this as a feature request and put it on the wish list. Future posters please post examples that can be improved with property paths. (BTW pull-requests are welcome.)

mikel-egana-aranguren commented 5 years ago

It works, thanks