#!/usr/bin/env python3 from rdflib import URIRef, BNode, Literal, Graph, Namespace from rdflib.namespace import RDF, NamespaceManager from urllib.parse import urlparse import sys from itertools import chain, groupby from jinja2 import Environment from formatRefs import first from rdf import RDFWalker if __name__ == '__main__': env = Environment () env.filters['urlparse'] = urlparse template = env.from_string (""" {% macro schemaval(n, name, tag='span') -%} <{{ tag }} property="{{ name }}">{{ n|attr(name) }}{{ tag }}> {%- endmacro %} {%- for companyname, software in items %} {% set company = companyname._ %}
{% if addr.streetAddress %}{{ schemaval(addr, 'streetAddress') }}
{% elif addr.postOfficeBoxNumber %}PO box {{ schemaval(addr, 'postOfficeBoxNumber') }}
{% endif %}
{{ schemaval(addr, 'postalCode') }} {{ schemaval(addr, 'addressLocality') }}
{% if s.dateCreated %}{{ schemaval(s, 'dateCreated') }} {% if s.datePublished %}/{{ schemaval(s, 'datePublished') }}{% endif %} {% elif s.datePublished %}{{ schemaval(s, 'datePublished') }} {% endif %}
{% if s.description %}{{ schemaval(s, 'description', 'p') }}{% endif %}