Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 6 additions & 4 deletions src/main/resources/com/atomgraph/linkeddatahub/app/admin/adm.ttl
Original file line number Diff line number Diff line change
Expand Up @@ -65,9 +65,10 @@ owl:Ontology spin:constructor [
owl:versionInfo "1.0-SNAPSHOT" .
}
WHERE {}"""
] ;
] .
# spin:constraint :MissingRDFSLabel .
ldh:template :OntologyClassView .

rdfs:isDefinedBy ldh:inverseBlock :OntologyClassView .

:OntologyClassView a ldh:View ;
dct:title "Ontology classes" ;
Expand Down Expand Up @@ -215,8 +216,9 @@ acl:Authorization spin:constructor [
[
a ldh:MissingPropertyValue ;
sp:arg1 acl:mode
] ;
ldh:template :AuthorizationAgentView .
] .

acl:agent ldh:block :AuthorizationAgentView .

:AuthorizationAgentView a ldh:View ;
dct:title "Authorization agents" ;
Expand Down
15 changes: 12 additions & 3 deletions src/main/resources/com/atomgraph/linkeddatahub/ldh.ttl
Original file line number Diff line number Diff line change
Expand Up @@ -91,9 +91,18 @@
rdfs:label "Series variable name" ;
rdfs:isDefinedBy : .

:template a owl:ObjectProperty ;
rdfs:domain rdfs:Class ;
rdfs:label "Class-level content block" ;
:block a owl:ObjectProperty ;
rdfs:domain rdf:Property ;
rdfs:range :View ;
rdfs:label "Property block" ;
rdfs:comment "Attaches a view block to a property for forward relationships ($about property ?value)" ;
rdfs:isDefinedBy : .

:inverseBlock a owl:ObjectProperty ;
rdfs:domain rdf:Property ;
rdfs:range :View ;
rdfs:label "Inverse property block" ;
rdfs:comment "Attaches a view block to a property for inverse relationships (?value property $about)" ;
rdfs:isDefinedBy : .

# CLASSES
Expand Down
17 changes: 10 additions & 7 deletions src/main/resources/com/linkeddatahub/packages/skos/ns.ttl
Original file line number Diff line number Diff line change
Expand Up @@ -14,8 +14,7 @@
# Concept

skos:Concept spin:constructor :ConceptConstructor ;
spin:constraint :MissingPrefLabel ;
ldh:template :NarrowerConcepts .
spin:constraint :MissingPrefLabel .

:ConceptConstructor a ldh:Constructor ;
rdfs:label "Concept constructor" ;
Expand All @@ -37,6 +36,8 @@ skos:Concept spin:constructor :ConceptConstructor ;

# narrower

skos:narrower ldh:block :NarrowerConcepts .

:NarrowerConcepts a ldh:View ;
dct:title "Narrower concepts" ;
spin:query :SelectNarrowerConcepts ;
Expand Down Expand Up @@ -64,7 +65,7 @@ ORDER BY ?prefLabel

# broader

skos:Concept ldh:template :BroaderConcepts.
skos:broader ldh:block :BroaderConcepts .

:BroaderConcepts a ldh:View ;
dct:title "Broader concepts" ;
Expand Down Expand Up @@ -94,8 +95,7 @@ ORDER BY ?prefLabel
# Collection

skos:Collection spin:constructor :CollectionConstructor ;
spin:constraint :MissingPrefLabel ;
ldh:template :CollectionMembers.
spin:constraint :MissingPrefLabel .

:CollectionConstructor a ldh:Constructor ;
rdfs:label "Collection constructor" ;
Expand All @@ -111,6 +111,8 @@ skos:Collection spin:constructor :CollectionConstructor ;
WHERE {}""" ;
rdfs:isDefinedBy : .

skos:member ldh:block :CollectionMembers .

:CollectionMembers a ldh:View ;
dct:title "Collection members" ;
spin:query :SelectCollectionMembers ;
Expand Down Expand Up @@ -138,8 +140,7 @@ ORDER BY ?prefLabel

# ConceptScheme

skos:ConceptScheme spin:constructor :ConceptSchemeConstructor ;
ldh:template :ConceptsInScheme.
skos:ConceptScheme spin:constructor :ConceptSchemeConstructor .

:ConceptSchemeConstructor a ldh:Constructor ;
rdfs:label "Concept scheme constructor" ;
Expand All @@ -156,6 +157,8 @@ skos:ConceptScheme spin:constructor :ConceptSchemeConstructor ;
WHERE {}""" ;
rdfs:isDefinedBy : .

skos:inScheme ldh:inverseBlock :ConceptsInScheme .

:ConceptsInScheme a ldh:View ;
dct:title "Concepts in scheme" ;
spin:query :SelectConceptsInScheme ;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -161,7 +161,7 @@ exclude-result-prefixes="#all"
<xsl:variable name="offset-x-treshold" select="120" as="xs:double"/>
<xsl:variable name="offset-y-treshold" select="20" as="xs:double"/>

<!-- there might be multiple .row-block-controls in a block if the main block is followed by blocks rendered from ldh:template -->
<!-- there might be multiple .row-block-controls in a block if the main block is followed by blocks rendered from ldh:block -->
<xsl:variable name="row-block-controls" select="key('elements-by-class', 'row-block-controls', .)[1]" as="element()"/>
<xsl:variable name="btn-edit" select="key('elements-by-class', 'btn-edit', $row-block-controls)" as="element()"/>
<!-- check that the mouse is on the top edge and show the block controls if they're not already shown -->
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -119,11 +119,9 @@ exclude-result-prefixes="#all">
<xsl:param name="google:clientID" as="xs:string?"/>
<xsl:param name="orcid:clientID" as="xs:string?"/>
<xsl:param name="doc-types" select="key('resources', ac:absolute-path(ldh:base-uri(.)))/rdf:type/@rdf:resource[ . = ('&def;Root', '&dh;Container', '&dh;Item')]" as="xs:anyURI*"/>
<!-- take care not to load unnecessary documents over HTTP when $doc-types is empty -->
<xsl:param name="template-block-uris" select="if (exists($doc-types)) then (if (doc-available(resolve-uri('ns?query=ASK%20%7B%7D', $ldt:base))) then (ldh:query-result(resolve-uri('ns', $ldt:base), $template-query || ' VALUES $Type { ' || string-join(for $type in $doc-types return '&lt;' || $type || '&gt;', ' ') || ' }')//srx:binding[@name = 'block']/srx:uri/xs:anyURI(.)) else ()) else ()" as="xs:anyURI*"/>
<xsl:param name="block-uris" select="key('resources', ac:absolute-path(ldh:base-uri(.)))/rdf:*[starts-with(local-name(), '_')]/@rdf:resource" as="xs:anyURI*"/>
<!-- document has content when there are are content sequence properties or template-declared class-level blocks exist -->
<xsl:param name="has-content" select="exists($block-uris) or exists($template-block-uris)" as="xs:boolean"/>
<!-- document has content when there are content sequence properties -->
<xsl:param name="has-content" select="exists($block-uris)" as="xs:boolean"/>
<xsl:param name="ac:mode" select="if ($has-content) then xs:anyURI('&ldh;ContentMode') else xs:anyURI('&ac;ReadMode')" as="xs:anyURI*"/>
<xsl:param name="location-mapping" as="map(xs:anyURI, xs:anyURI)">
<xsl:map>
Expand Down Expand Up @@ -177,17 +175,37 @@ LIMIT 100
]]>
</xsl:variable>
<xsl:variable name="app-request-uri" select="ac:build-uri(resolve-uri('sparql', $ldt:base), map{ 'query': $app-query })" as="xs:anyURI"/>
<xsl:variable name="template-query" as="xs:string">
<xsl:variable name="forward-block-query" as="xs:string">
<![CDATA[
PREFIX rdfs: <http://www.w3.org/2000/01/rdf-schema#>
PREFIX ldh: <https://w3id.org/atomgraph/linkeddatahub#>

SELECT *
SELECT DISTINCT ?block
WHERE
{
$Type ldh:template ?block
?property ldh:block ?block .
{ ?property rdfs:domain $domain }
UNION
{ ?property rdfs:subPropertyOf+/rdfs:domain $domain }
}
]]>
<!-- VALUES $Type goes here -->
<!-- VALUES $domain goes here -->
</xsl:variable>
<xsl:variable name="inverse-block-query" as="xs:string">
<![CDATA[
PREFIX rdfs: <http://www.w3.org/2000/01/rdf-schema#>
PREFIX ldh: <https://w3id.org/atomgraph/linkeddatahub#>

SELECT DISTINCT ?block
WHERE
{
?property ldh:inverseBlock ?block .
{ ?property rdfs:range $range }
UNION
{ ?property rdfs:subPropertyOf+/rdfs:range $range }
}
]]>
<!-- VALUES $range goes here -->
</xsl:variable>
<xsl:variable name="constraint-query" as="xs:string">
<![CDATA[
Expand Down Expand Up @@ -875,17 +893,10 @@ LIMIT 100
<!-- error responses always rendered in bs2:Row mode, no matter what $ac:mode specifies -->
<xsl:when test="key('resources-by-type', '&http;Response') and not(key('resources-by-type', '&spin;ConstraintViolation')) and not(key('resources-by-type', '&sh;ValidationResult'))">
<xsl:apply-templates select="." mode="bs2:Row">
<xsl:with-param name="template-query" select="$template-query" tunnel="yes"/>
<xsl:sort select="ac:label(.)"/>
</xsl:apply-templates>
</xsl:when>
<xsl:when test="$ac:mode = '&ldh;ContentMode'">
<xsl:for-each select="$template-block-uris">
<xsl:if test="doc-available(ac:document-uri(.))">
<xsl:apply-templates select="key('resources', ., document(ac:document-uri(.)))" mode="bs2:Row"/>
</xsl:if>
</xsl:for-each>

<xsl:apply-templates select="." mode="ldh:ContentList"/>
</xsl:when>
<xsl:when test="$ac:mode = '&ac;MapMode'">
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -609,7 +609,7 @@ extension-element-prefixes="ixsl"
<!-- hide instances of system classes -->
<xsl:template match="*[not($ldh:renderSystemResources)][@rdf:about = ac:absolute-path(ldh:base-uri(.)) and rdf:type/@rdf:resource = ('&def;Root', '&dh;Container', '&dh;Item')]" mode="bs2:Row" priority="1" use-when="system-property('xsl:product-name') = 'SAXON'"/>

<!-- overriding template used to inject ldh:template blocks (server-side only) -->
<!-- overriding template used to inject ldh:block blocks (server-side only) -->
<xsl:template match="*[*][@rdf:about][not(rdf:type/@rdf:resource = '&http;Response')] | *[*][@rdf:nodeID][not(rdf:type/@rdf:resource = '&http;Response')]" mode="bs2:Row" priority="0.7" use-when="system-property('xsl:product-name') = 'SAXON'">
<!-- TO-DO: use ldh:request-uri() to resolve URIs server-side -->
<xsl:param name="id" select="if (contains(@rdf:about, ac:absolute-path(ldh:base-uri(.)) || '#')) then substring-after(@rdf:about, ac:absolute-path(ldh:base-uri(.)) || '#') else generate-id()" as="xs:string?"/>
Expand All @@ -618,8 +618,12 @@ extension-element-prefixes="ixsl"
<xsl:param name="typeof" select="rdf:type/@rdf:resource/xs:anyURI(.)" as="xs:anyURI*"/>
<xsl:param name="mode" as="xs:anyURI?"/>
<xsl:param name="style" as="xs:string?"/>
<!-- take care not to load unnecessary documents over HTTP when $typeof is empty -->
<xsl:variable name="block-values" select="if (exists($typeof)) then (if (doc-available(resolve-uri('ns?query=ASK%20%7B%7D', $ldt:base))) then (ldh:query-result(resolve-uri('ns', $ldt:base), $template-query || ' VALUES $Type { ' || string-join(for $type in $typeof return '&lt;' || $type || '&gt;', ' ') || ' }')//srx:binding[@name = 'block']/srx:uri/xs:anyURI(.)) else ()) else ()" as="xs:anyURI*" use-when="system-property('xsl:product-name') = 'SAXON'"/>
<!-- query ontology for forward blocks where rdfs:domain matches instance types (check direct domain and inherited via rdfs:subPropertyOf) -->
<xsl:variable name="forward-block-values" select="if (exists($typeof) and doc-available(resolve-uri('ns?query=ASK%20%7B%7D', $ldt:base))) then ldh:query-result(resolve-uri('ns', $ldt:base), $forward-block-query || ' VALUES $domain { ' || string-join(for $type in $typeof return '&lt;' || $type || '&gt;', ' ') || ' }')//srx:binding[@name = 'block']/srx:uri/xs:anyURI(.) else ()" as="xs:anyURI*" use-when="system-property('xsl:product-name') = 'SAXON'"/>
<!-- query ontology for inverse blocks where rdfs:range matches instance types (check direct range and inherited via rdfs:subPropertyOf) -->
<xsl:variable name="inverse-block-values" select="if (exists($typeof) and doc-available(resolve-uri('ns?query=ASK%20%7B%7D', $ldt:base))) then ldh:query-result(resolve-uri('ns', $ldt:base), $inverse-block-query || ' VALUES $range { ' || string-join(for $type in $typeof return '&lt;' || $type || '&gt;', ' ') || ' }')//srx:binding[@name = 'block']/srx:uri/xs:anyURI(.) else ()" as="xs:anyURI*" use-when="system-property('xsl:product-name') = 'SAXON'"/>
<!-- combine both forward and inverse blocks -->
<xsl:variable name="block-values" select="($forward-block-values, $inverse-block-values)" as="xs:anyURI*" use-when="system-property('xsl:product-name') = 'SAXON'"/>

<xsl:choose>
<xsl:when test="exists($block-values)">
Expand Down Expand Up @@ -652,7 +656,7 @@ extension-element-prefixes="ixsl"
</xsl:next-match>

<xsl:variable name="base-uri" select="ac:absolute-path(ldh:base-uri(.))" as="xs:anyURI"/>
<!-- render contents attached to the types of this resource using ldh:template -->
<!-- render blocks applicable to this resource's types (forward blocks via rdfs:domain, inverse blocks via rdfs:range) -->
<xsl:for-each select="$block-values" use-when="system-property('xsl:product-name') = 'SAXON'">
<xsl:if test="doc-available(ac:document-uri(.))">
<xsl:variable name="id" select="'id' || ac:uuid()" as="xs:string"/>
Expand Down