Skip to content

Commit

Permalink
feat (modl): Initial outline of Enola's own (Meta) Schema model
Browse files Browse the repository at this point in the history
  • Loading branch information
vorburger committed Jun 26, 2024
1 parent c4568cc commit d57ded1
Show file tree
Hide file tree
Showing 12 changed files with 301 additions and 0 deletions.
23 changes: 23 additions & 0 deletions java/dev/enola/model/enola/Common.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
/*
* SPDX-License-Identifier: Apache-2.0
*
* Copyright 2024 The Enola <https://enola.dev> Authors
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* https://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package dev.enola.model.enola;

import dev.enola.model.w3.rdfs.HasLabel;
import dev.enola.model.w3.rdfs.Typed;

public interface Common extends Typed, HasLabel, HasIcon, HasDescription {}
26 changes: 26 additions & 0 deletions java/dev/enola/model/enola/HasDescription.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
/*
* SPDX-License-Identifier: Apache-2.0
*
* Copyright 2024 The Enola <https://enola.dev> Authors
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* https://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package dev.enola.model.enola;

import dev.enola.thing.Thing;

public interface HasDescription extends Thing {

// TODO @IRI(KIRI.E.META.DESCRIPTION)
String description();
}
33 changes: 33 additions & 0 deletions java/dev/enola/model/enola/HasIcon.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
/*
* SPDX-License-Identifier: Apache-2.0
*
* Copyright 2024 The Enola <https://enola.dev> Authors
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* https://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package dev.enola.model.enola;

import dev.enola.thing.KIRI;
import dev.enola.thing.Thing;
import dev.enola.thing.java.IRI;

import java.net.URI;

public interface HasIcon extends Thing {

@IRI(KIRI.E.EMOJI)
String emoji();

// TODO @IRI(KIRI.E.IMAGE)
URI image();
}
28 changes: 28 additions & 0 deletions java/dev/enola/model/enola/HasURL.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
/*
* SPDX-License-Identifier: Apache-2.0
*
* Copyright 2024 The Enola <https://enola.dev> Authors
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* https://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package dev.enola.model.enola;

import dev.enola.thing.Thing;

import java.net.URI;

public interface HasURL extends Thing {

// TODO @IRI(KIRI.E.URL) ?
URI url();
}
26 changes: 26 additions & 0 deletions java/dev/enola/model/enola/Named.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
/*
* SPDX-License-Identifier: Apache-2.0
*
* Copyright 2024 The Enola <https://enola.dev> Authors
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* https://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package dev.enola.model.enola;

import dev.enola.thing.Thing;

public interface Named extends Thing {

// TODO @IRI(KIRI.E.NAME)
String name();
}
30 changes: 30 additions & 0 deletions java/dev/enola/model/enola/schema/Class.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
/*
* SPDX-License-Identifier: Apache-2.0
*
* Copyright 2024 The Enola <https://enola.dev> Authors
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* https://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package dev.enola.model.enola.schema;

import java.util.Set;

public interface Class extends Type {

// TODO @IRI(KIRI.E.META.PARENTS) ?
Set<Class> parents();

// TODO @IRI(KIRI.E.META.PROPERTIES)
// Cannot be properties() due to conflict
Set<Property> fields();
}
29 changes: 29 additions & 0 deletions java/dev/enola/model/enola/schema/Datatype.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
/*
* SPDX-License-Identifier: Apache-2.0
*
* Copyright 2024 The Enola <https://enola.dev> Authors
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* https://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package dev.enola.model.enola.schema;

import java.util.regex.Pattern;

public interface Datatype extends Type {

// TODO @IRI(KIRI.E.META.PARENT)
// Intentionally only singular instead of multiple
Datatype parent();

Pattern regExp();
}
26 changes: 26 additions & 0 deletions java/dev/enola/model/enola/schema/Enum.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
/*
* SPDX-License-Identifier: Apache-2.0
*
* Copyright 2024 The Enola <https://enola.dev> Authors
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* https://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package dev.enola.model.enola.schema;

import java.util.Set;

public interface Enum extends Type {

// TODO @IRI(KIRI.E.META.VALUES)
Set<EnumValue> values();
}
20 changes: 20 additions & 0 deletions java/dev/enola/model/enola/schema/EnumValue.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
/*
* SPDX-License-Identifier: Apache-2.0
*
* Copyright 2024 The Enola <https://enola.dev> Authors
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* https://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package dev.enola.model.enola.schema;

public interface EnumValue extends Type {}
36 changes: 36 additions & 0 deletions java/dev/enola/model/enola/schema/Property.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
/*
* SPDX-License-Identifier: Apache-2.0
*
* Copyright 2024 The Enola <https://enola.dev> Authors
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* https://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package dev.enola.model.enola.schema;

public interface Property extends Type {

// TODO @IRI(KIRI.E.META.PARENT)
Property parent();

// TODO @IRI(KIRI.E.META.DATATYPE)
Datatype datatype();

// TODO @IRI(KIRI.E.META.MULTIPLICITY)
Multiplicity multiplicity();

enum Multiplicity {
Single,
Set,
List
}
}
23 changes: 23 additions & 0 deletions java/dev/enola/model/enola/schema/Type.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
/*
* SPDX-License-Identifier: Apache-2.0
*
* Copyright 2024 The Enola <https://enola.dev> Authors
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* https://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package dev.enola.model.enola.schema;

import dev.enola.model.enola.Common;
import dev.enola.model.enola.Named;

public interface Type extends Common, Named {}
1 change: 1 addition & 0 deletions java/dev/enola/thing/datatype/DatatypeThing.java
Original file line number Diff line number Diff line change
Expand Up @@ -20,5 +20,6 @@
import dev.enola.datatype.Datatype;
import dev.enola.thing.Thing;

// TODO Replace with dev.enola.model.enola.schema.Datatype
// TODO Implement properly, like ImmutableTestThing...
public abstract class DatatypeThing implements Datatype, Thing {}

0 comments on commit d57ded1

Please sign in to comment.