forked from RehanSaeed/Schema.NET
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathSchemaClass.cs
33 lines (26 loc) · 1.14 KB
/
SchemaClass.cs
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
namespace Schema.NET.Tool.Models
{
using System;
using System.Collections.Generic;
using System.Linq;
using Schema.NET.Tool.Constants;
public class SchemaClass : SchemaObject
{
private static readonly Uri EnumerationId = new("https://schema.org/Enumeration");
public SchemaClass(string comment, Uri id, string label, string layer)
: base(comment, id, label, layer)
{
}
public bool IsEnum => EnumerableExtensions
.Traverse(this, x => x.SubClassOf)
.Any(x => x.Id == EnumerationId);
public override bool IsArchived => EnumerableExtensions
.Traverse(this, x => x.SubClassOf)
.Any(x => string.Equals(x.Layer, LayerName.Archived, StringComparison.OrdinalIgnoreCase));
public override bool IsMeta => EnumerableExtensions
.Traverse(this, x => x.SubClassOf)
.Any(x => string.Equals(x.Layer, LayerName.Meta, StringComparison.OrdinalIgnoreCase));
public List<SchemaClass> SubClassOf { get; } = new List<SchemaClass>();
public List<Uri> SubClassOfIds { get; } = new List<Uri>();
}
}