You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Change compact-iri generation to allow any term mapping to a string ending in a gen-delim in 1.0 mode, or which does that and is a simple term in 1.1, or has a @prefix: true mapping in an expanded term definition in 1.1.
# If term is a compact IRI with a prefix that is a key in local context then a dependency has been found. Use this algorithm recursively passing active context, local context, the prefix as term, and defined.
raiseJsonLdError::InvalidTermDefinition,'@context not valid in term definition for JSON-LD 1.0 on term #{term.inspect}, set processing mode using @version'ifprocessingMode && processingMode < 'json-ld-1.1'
raiseJsonLdError::InvalidTermDefinition,'@nest not valid in term definition for JSON-LD 1.0 on term #{term.inspect}, set processing mode using @version'ifprocessingMode && processingMode < 'json-ld-1.1'
694
-
695
-
# Not supported in JSON-LD 1.0
696
-
raiseJsonLdError::InvalidTermDefinition,'@nest not valid in term definition for JSON-LD 1.0 on term #{term.inspect}, set processing mode using @version'ifprocessingMode && processingMode < 'json-ld-1.1'
697
-
698
701
nest=value['@nest']
699
702
raiseJsonLdError::InvalidNestValue,"nest must be a string, was #{nest.inspect}} on term #{term.inspect}"unlessnest.is_a?(String)
700
703
raiseJsonLdError::InvalidNestValue,"nest must not be a keyword other than @nest, was #{nest.inspect}} on term #{term.inspect}"ifnest.start_with?('@') && nest != '@nest'
701
704
#log_debug("") {"nest: #{nest.inspect}"}
702
705
definition.nest=nest
703
706
end
704
707
708
+
ifvalue.has_key?('@prefix')
709
+
casepfx=value['@prefix']
710
+
whenTrueClass,FalseClass
711
+
definition.prefix=pfx
712
+
else
713
+
raiseJsonLdError::InvalidPrefixValue,"unknown value for '@prefix': #{pfx.inspect} on term #{term.inspect}"
714
+
end
715
+
end
716
+
705
717
term_definitions[term]=definition
706
718
defined[term]=true
707
719
else
@@ -837,7 +849,7 @@ def from_vocabulary(graph)
837
849
defset_mapping(term,value)
838
850
#log_debug("") {"map #{term.inspect} to #{value.inspect}"}
# If local context is not null, it contains a key that equals prefix, or prefix followed by a ':', and the value associated with the key that equals prefix in defined is not true, invoke the Create Term Definition algorithm, passing active context, local context, prefix (possibly with an added ':') as term, and defined. This will ensure that a term definition is created for prefix in active context during Context Processing.
# If local context is not null, it contains a key that equals prefix, and the value associated with the key that equals prefix in defined is not true, invoke the Create Term Definition algorithm, passing active context, local context, prefix as term, and defined. This will ensure that a term definition is created for prefix in active context during Context Processing.
# If active context contains a term definition for prefix followed by ':', or prefix, return the result of concatenating the IRI mapping associated with prefix and suffix.
1006
-
result=if(td=term_definitions[prefix + ':'])
1007
-
result=td.id + suffix
1008
-
elsif(td=term_definitions[prefix])
1013
+
# If active context contains a term definition for prefix, return the result of concatenating the IRI mapping associated with prefix and suffix.
1014
+
result=if(td=term_definitions[prefix])
1009
1015
result=td.id + suffix
1010
1016
else
1011
1017
# (Otherwise) Return value as it is already an absolute IRI.
# The iri could not be compacted using the active context's vocabulary mapping. Try to create a compact IRI, starting by initializing compact IRI to null. This variable will be used to tore the created compact IRI, if any.
1161
1167
candidates=[]
1162
1168
1163
-
# For 1.1, favor simple terms that end in a ':'
1164
-
term_definitions.eachdo |term,td|
1165
-
# Skip things that don't end with a ':' or contain a ':'
1166
-
nextunlessterm.end_with?(':')
1167
-
nextiftd.nil? || td.id.nil? || td.id == iri || !iri.start_with?(td.id)
1168
-
1169
-
# Also skip term if it was not a simple term with an id ends in a gen-delim, or if the term ends with ':'
0 commit comments