npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2024 – Pkg Stats / Ryan Hefner

ontouml-schema

v0.2.4

Published

This package provides a JSON Schema message format for the exchange of OntoUML models.

Downloads

21

Readme

OntoUML Schema

This project defines a JSON Schema message format for the exchange of OntoUML models.

This project is defined under the umbrella of the OntoUML Server project and stands as a proof of concept at the moment.

If you are interested to know more, feel free to open an issue to provide feedback on the project or reach our team members for more specific cases:

How to use

JSON Schema is a popular web standard for definition and validation of JSON files. The standard employs JSON files describing valid schema formats as input to validation software to check the validity of any other JSON file its is feed with.

The code excerpt bellow, exemplifies how to use the ontouml-schema project to validate objects representing OntoUML 2 models:

const schemas = require('ontouml-schema');
const Ajv = require('ajv');

let validator = new Ajv().compile(schemas.getSchema(schemas.ONTOUML_2));
let model = {
    type: 'Package',
    id: 'm1',
    name: 'My Model',
    description: null,
    contents: null,
    propertyAssignments: null,
};
let isValid = validator(model);

if (isValid) {
    console.log(`Model ${model.name} is valid!`);
} else {
    console.log(`Model ${model.name} is NOT valid!`);
    console.log(validator.errors);
}

Even though the source in this repository is developed for Javascript projects, the schema files themselves available in ours releases can be used in any of JSON Schema's validators which available for all major programming languages.

OntoUML 2

This section describes the object types defined in the OntoUML Schema.

The type of an object is identified by the field "type".

All fields defined for an object type are MANDATORY, but only some are not nullable.

Additional fields are NOT allowed for any object type.

  • Package: An object representing an ontology or an ontology (sub)module. The Package object at the root of a JSON file instantiating the ontouml-schema is also referred to as "root package" and "model", where the later captures the notion of all container for all model elements in an ontology module.

    { 
        "type": "Package",
        "id": "1",
        "name": "UFO-S",
        "description": {
            "en": "A commitment-based ontology of services.",
            "es": "Una ontología de servicios basada en el concepto de compromiso.",
            "pt-BR": "Uma ontologia de serviços baseada no conceito de compromisso.",
        },
        "elements": [ ... ],
        "propertyAssignments": { ... }
    }
  • Class: An object representing a type defined in the ontology.

    { 
        "type": "Class",
        "id": "1",
        "name": {
            "en-US": "Service Provider",
            "it": "Fornitore di servizi",
        },
        "description": "A role played by the agent providing a service.",
        "stereotypes": ["roleMixin"],
        "isAbstract": true,
        "isDerived": false,
        "properties": [ ... ],
        "literals": null,
        "propertyAssignments": { ... },
        "isExtensional": null,
        "isPowertype": null,
        "order": null,
        "allowed": [ "functional-complex" ]
    }

    An enumeration is represented as a class with the "enumeration" stereotype and its values using the field "literals".

    { 
        "type": "Class",
        "id": "2",
        "name": "Color",
        "description": null,
        "stereotypes": ["enumeration"],
        "isAbstract": false,
        "isDerived": false,
        "properties": null,
        "literals": [
            {
                "type": "Literal",
                "id": "0",
                "name": "Red",
                ...
            },
            {
                "type": "Literal",
                "id": "1",
                "name": "Blue",
                ...
            },
            ...
        ],
        "propertyAssignments": { ... },
        "isExtensional": null,
        "isPowertype": null,
        "order": null,
        "allowed": null
    }
  • Literal: An object representing a value defined for an enumeration.

    {
          "type": "Literal",
          "id": "0",
          "name": "Red",
          "description": "Classic red. Hex Code: #FF0000 Decimal Code: rgb(255,0,0)",
          "propertyAssignments": { ... }
        }
  • Relation: An object representing a relation defined in the ontology.

    { 
        "type": "Relation",
        "id": "1",
        "name": "hires",
        "description": "A relation between a service customer and a service provider.",
        "stereotypes": ["material"],
        "isAbstract": false,
        "isDerived": true,
        "properties": [
            {
                "type": "Property",
                "id": "1",
                "name": "customer",
                "propertyType": {
                    "type": "Class",
                    "id": "1"
                },
                ...
            },
            {
                "type": "Property",
                "id": "2",
                "name": "provider",
                "propertyType": {
                    "type": "Class",
                    "id": "2"
                },
                ...
            }
        ],
        "literals": null,
        "propertyAssignments": { ... }
    }

    The field "properties" is a nullable ordered array of objets of type "Property" whose minimum size should be 2. Relation objects with less than 2 items in the "properties" must raise error messages.

    The order of the properties in this array represents their position on a equivalent predicate, e.g., in the ternary relation "buys-product-from(buyer,product,seller)", the order of items representing these entities must follow the order "buyer" (in properties[0]), "product" (in properties[1]), and "seller" (in properties[2]).

    Relation elements are also used to represent derivation relations, in which case they must contain the stereotype "derivation" and have only 2 properties, the first being an object of type "Relation" and the second an object of type "Class" element.

  • Generalization: An object representing a generalization defined in the ontology.

    {
        "type": "Generalization",
        "id": "1",
        "name": "G1",
        "description": null,
        "general": {
            "type": "Class",
            "id": "1"
        },
        "specific": {
            "type": "Class",
            "id": "2"
        },
        "propertyAssignments": { ... }
    }
  • GeneralizationSet: An object representing a generalization set defined in the ontology.

    {
        "type": "GeneralizationSet",
        "id": "1",
        "name": "Gender Set",
        "description": null,
        "categorizer": {
            "type": "Class",
            "id": "1"
        },
        "generalizations": [
            {
                "type": "Generalization",
                "id": "1"
            },
            {
                "type": "Generalization",
                "id": "2"
            }
        ],
        "isDisjoint": true,
        "isComplete": true,
        "propertyAssignments": { ... }
    }
  • Property: An object representing a property defined in the ontology. Properties contained by classes are deemed attributes and those contained by relations are deemed association ends.

    {
        "type": "Property",
        "id": "0",
        "name": "name",
        "description": null,
        "propertyType": {
            "type": "Class",
            "id": "0"
        },
        "cardinality": "1..1",
        "isDerived": false,
        "isOrdered": false,
        "isReadOnly": false,
        "stereotypes": null,
        "aggregationKind": null,
        "subsettedProperties": [
            {
                "type": "Property",
                "id": "1"
            }
        ],
        "redefinedProperties": [ ... ],
        "propertyAssignments": { ... }
    }
  • contents: A non-empty nullable array of objects representing model elements. Possible object types in this array are: "Package", "Class", "Relation", "Generalization", "GeneralizationSet".

  • id: A non-empty and non-nullable string that uniquely identifies an object of a given type. Thus, two objects of the same type (e.g. two classes, two relations, two properties) may not have the same id, even if they are contained by different packages.

  • name: A non-empty nullable string containing the object's name. It is allowed for two objects of the ontology to have identical names, even if they are of the same type,.

  • description: A non-empty nullable string representing the description of the object in free textual format.

  • properties: A non-empty array of Property elements representing properties exhibited by instances of the container model element. Nullable.

  • propertyAssignments: A non-empty array of key-value pairs representing assignments to instantiated properties instantiated by the container object. Assignments may have any key name, but its values are restricted to null, booleans, numbers, strings, references or arrays of these. Assignments are analogous to UML's notion of tagged values. Nullable.

  • reference: An object representing a singular reference to a model element. Mandatory fields: "type", "id".

  • stereotypes: A non-empty array of non-empty strings representing stereotypes of its container object. Nullable.