<commit_before>import React                                                 from "react";
import {Modal, FormGroup, ControlLabel, FormControl, Button} from "react-bootstrap";

import BlankNodeInput from "./BlankNodeInput.jsx";
import LiteralInput   from "./LiteralInput.jsx";
import NamedNodeInput from "./NamedNodeInput.jsx";

function nodeInput(node) {
    switch (node.interfaceName) {
    case "BlankNode":
        return (
            <BlankNodeInput
                node={node}
            />
        );
    case "Literal":
        return (
            <LiteralInput
                node={node}
            />
        );
    case "NamedNode":
        return (
            <NamedNodeInput
                node={node}
            />
        );
    }
}

function handleInterfaceNameChange(interfaceName) {
    this.setState({ interfaceName });
}

export default function ({node, valid}) {
    const interfaceName = node.interfaceName;
    return (
        <div>
            <FormGroup controlId="interfaceName">
                <ControlLabel>Interface Name</ControlLabel>
                <FormControl
                    componentClass="select"
                    value={interfaceName}
                    onChange={value => this.handleInterfaceNameChange(value)}>
                    <option value="BlankNode">Blank Node</option>
                    <option value="Literal">Literal</option>
                    <option value="NamedNode">Named Node</option>
                </FormControl>
            </FormGroup>
            {nodeInput(node)}
        </div>
    );
}
<commit_msg>Changing the node interface of the object works<commit_after>import React                                                 from "react";
import {Modal, FormGroup, ControlLabel, FormControl, Button} from "react-bootstrap";

import * as rdf from "@ignavia/rdf";

import BlankNodeInput from "./BlankNodeInput.jsx";
import LiteralInput   from "./LiteralInput.jsx";
import NamedNodeInput from "./NamedNodeInput.jsx";

const defaultBlankNode = new rdf.BlankNode("");
const defaultLiteral   = new rdf.Literal("");
const defaultNamedNode = new rdf.NamedNode("");

function nodeInput(node, valid, handleChange) {
    const props = {node, valid, handleChange};
    switch (node.interfaceName) {
    case "BlankNode":
        return <BlankNodeInput {...props} />;
    case "Literal":
        return <LiteralInput {...props} />;
    case "NamedNode":
        return <NamedNodeInput {...props} />;
    }
}

function handleInterfaceChange(interfaceName, handleChange) {
    switch (interfaceName) {
    case "BlankNode":
        return handleChange({
            node:  defaultBlankNode,
            valid: false,
        });
    case "Literal":
        return handleChange({
            node:  defaultLiteral,
            valid: false,
        });
    case "NamedNode":
        return handleChange({
            node:  defaultNamedNode,
            valid: false,
        });
    }
}

export default function ({node, valid, handleChange}) {
    const interfaceName = node.interfaceName;
    return (
        <div>
            <FormGroup controlId="interfaceName">
                <ControlLabel>Interface Name</ControlLabel>
                <FormControl
                    componentClass="select"
                    value={interfaceName}
                    onChange={e => handleInterfaceChange(e.target.value, handleChange)}>
                    <option value="BlankNode">Blank Node</option>
                    <option value="Literal">Literal</option>
                    <option value="NamedNode">Named Node</option>
                </FormControl>
            </FormGroup>
            {nodeInput(node, valid, handleChange)}
        </div>
    );
}

{'fraction_non_alphanumeric': 0.10991668906208009, 'fraction_numerical': 0.0, 'mean_word_length': 1.898753894080997, 'pattern_counts': {'":': 9, '<': 37, '<?xml version=': 0, '>': 39, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 4, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '2763084', 'n_tokens_mistral': 942, 'n_tokens_neox': 924, 'n_words': 216}