lib/bolognese/schema_org.rb in bolognese-0.8 vs lib/bolognese/schema_org.rb in bolognese-0.8.1
- old
+ new
@@ -29,11 +29,11 @@
def exists?
metadata.present?
end
def valid?
- true
+ schema_org.present?
end
def doi
doi_from_url(id)
end
@@ -112,17 +112,22 @@
Array.wrap(is_identical_to) +
Array.wrap(is_part_of) +
Array.wrap(has_part) +
Array.wrap(is_previous_version_of) +
Array.wrap(is_new_version_of) +
- Array.wrap(references)
+ Array.wrap(references) +
+ Array.wrap(is_supplemented_by)
end
def get_related_identifier(relation_type: nil)
normalize_ids(metadata.fetch(relation_type, nil), SO_TO_DC_RELATION_TYPES[relation_type])
end
+ def get_reverse_related_identifier(relation_type: nil)
+ normalize_ids(metadata.dig("@reverse", relation_type), SO_TO_DC_RELATION_TYPES[relation_type])
+ end
+
def is_identical_to
get_related_identifier(relation_type: "sameAs")
end
def is_part_of
@@ -141,9 +146,21 @@
get_related_identifier(relation_type: "isSuccessor")
end
def references
get_related_identifier(relation_type: "citation")
+ end
+
+ def is_referenced_by
+ get_reverse_related_identifier(relation_type: "citation")
+ end
+
+ def is_supplement_to
+ get_reverse_related_identifier(relation_type: "isBasedOn")
+ end
+
+ def is_supplemented_by
+ get_related_identifier(relation_type: "isBasedOn")
end
def publisher
metadata.dig("publisher", "name")
end