![Create React App Officially Deprecated Amid React 19 Compatibility Issues](https://cdn.sanity.io/images/cgdhsj6q/production/04fa08cf844d798abc0e1a6391c129363cc7e2ab-1024x1024.webp?w=400&fit=max&auto=format)
Security News
Create React App Officially Deprecated Amid React 19 Compatibility Issues
Create React App is officially deprecated due to React 19 issues and lack of maintenance—developers should switch to Vite or other modern alternatives.
semantic-graphql
Advanced tools
Semantic GraphQL provides an API to convert any RDF, RDFS and OWL-based ontologies into GraphQL objects.
The library does not deal with data, only with terminology. Therefore resolving data/resources is up to you.
Table of contents:
Runs on Node v6 or higher.
npm install semantic-graphql --save
Semantic-graphql makes no assumption about the shape of your data and only passes it around. You have to provide six functions to resolve it in different ways. See the resolvers section.
const resolvers = { /* Choose how to resolve data */ };
Once your resolvers are written you can create a SemanticGraph. In the graph all the triples defining RDF, RDFS and OWL are included by default.
const SemanticGraph = require('semantic-graphql');
const _ = new SemanticGraph(resolvers, config);
Now you can add your own triples. Only statements defining your terminology (classes + properties) will be used, so you shouldn't add your individuals as it will only consume memory.
_.addTriple({
subject: 'http://foo.com#MyClass',
predicate: 'http://www.w3.org/1999/02/22-rdf-syntax-ns#type',
object: 'http://www.w3.org/2002/07/owl#Class',
});
// From a string or a file. Multiple formats are available.
_.parse(string);
_.parseFile('/path/to/ontology.ttl');
When Semantic-graphql translates a rdf:Property to a GraphQLFieldConfig, the resulting type will be wrapped in a GraphQLList unless the property is a owl:FunctionalProperty. Therefore you may have to do some adjustments in order to prevent that. Almost anything can be overriden, see the override section.
// We do not want rdfs:label to resolve arrays
_['http://www.w3.org/2000/01/rdf-schema#label'].isGraphqlList = false;
Now you can start building your GraphQL schema however you want.
const schema = new GraphQLSchema({
query: new GraphQLObjectType({
name: 'Query',
fields: {
myField: {
// GraphQL objects are created on demand using the API
type: _.getObjectType('http://foo.com#MyClass'),
resolve: /* ... */,
},
resource: {
// The rdfs:Resource interface allows you to query any data
type: _.getInterfaceType('http://www.w3.org/2000/01/rdf-schema#Resource'),
args: {
id: { type: new GraphQLNonNull(GraphQLString) },
},
resolve: /* ... */,
},
},
}),
});
Have a look at the examples folder to see a complete setup.
By using the relay: true
option:
_.nodeField
and _.nodeInterface
object are available_.getConnectionType
and _.getEdgeType
methods are availableSee the Relay example.
Must be sync. See this GraphQL issue.
To override anything there is no method: you directly set the library's internals.
_['http://the.resource.to/be#altered'].key = value;
If "key" is already present, the library will use the underlying value and won't try to create it.
Resource type | key | value type |
---|---|---|
any | graphqlName | String |
any | graphqlDescription | String |
class | graphqlFieldConfigMap | GraphQLFieldConfigMap |
class | graphqlObjectType | GraphQLObjectType |
class | graphqlInterfaceType | GraphQLInterfaceType |
class | relayConnectionDefinitions | { edgeType, connectionType } |
property | isGraphqlList | Boolean |
property | isRelayConnection | Boolean |
property | graphqlFieldConfig | GraphQLFieldConfig |
property | graphqlFieldConfigExtension | partial GraphQLFieldConfig, to modify only parts of it |
Note that the following overrides must be performed before invoking getObjectType
or getInterfaceType
or getEdgeType
or getConnectionType
since those methods create the GraphQL objects you want to override.
Example:
_['http://foo.com#worksForCompany'].graphqlName = 'company';
// Now the field name for foo:worksForCompany will be 'company'
// Partial modifications to fields are achieved using
_['http://foo/com#worksForCompany'].graphqlFieldConfigExtension = {
args: /* Look Ma', arguments! */
resolve: customResolveFn,
};
The following features will not be implemented due to their incomptability with GraphQL:
Yes, thank you. Please lint, update/write tests and add your name to the package.json file before you PR.
Semantic GraphQL is released under the MIT License.
GraphQL is released by Facebook, inc. under the BSD-license with an additional patent grant.
0.4.0
Breaking changes:
resolvers.resolveSourceTypes
must now be sync.isTypeOf
method anymore, instead external InterfaceTypes must provide a resolveType
method.Bug fixes:
Miscellaneous:
Promise.resolve
instead of home-made function. It's slower but safer.FAQs
Create GraphQL schemas from RDF ontologies
The npm package semantic-graphql receives a total of 16 weekly downloads. As such, semantic-graphql popularity was classified as not popular.
We found that semantic-graphql demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 1 open source maintainer collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Security News
Create React App is officially deprecated due to React 19 issues and lack of maintenance—developers should switch to Vite or other modern alternatives.
Security News
Oracle seeks to dismiss fraud claims in the JavaScript trademark dispute, delaying the case and avoiding questions about its right to the name.
Security News
The Linux Foundation is warning open source developers that compliance with global sanctions is mandatory, highlighting legal risks and restrictions on contributions.