mirror of
https://github.com/OpenSPG/openspg.git
synced 2025-12-12 07:41:27 +00:00
bugfix
This commit is contained in:
parent
65a557aaa1
commit
223aeb6f52
@ -38,6 +38,7 @@
|
||||
<module>core</module>
|
||||
<module>model</module>
|
||||
<module>runner/local</module>
|
||||
<module>test</module>
|
||||
</modules>
|
||||
|
||||
<properties/>
|
||||
|
||||
15
builder/test/pom.xml
Normal file
15
builder/test/pom.xml
Normal file
@ -0,0 +1,15 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<project xmlns="http://maven.apache.org/POM/4.0.0"
|
||||
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
|
||||
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
|
||||
<modelVersion>4.0.0</modelVersion>
|
||||
<parent>
|
||||
<groupId>com.antgroup.openspg.builder</groupId>
|
||||
<artifactId>builder-parent</artifactId>
|
||||
<version>0.0.1-SNAPSHOT</version>
|
||||
</parent>
|
||||
|
||||
<artifactId>builder-test</artifactId>
|
||||
|
||||
|
||||
</project>
|
||||
@ -0,0 +1,6 @@
|
||||
package com.antgroup.openspg.builder.test;
|
||||
|
||||
public class RiskMiningRecord {
|
||||
|
||||
|
||||
}
|
||||
@ -32,5 +32,9 @@
|
||||
<groupId>com.antgroup.openspg.builder</groupId>
|
||||
<artifactId>builder-model</artifactId>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>com.antgroup.openspg.builder</groupId>
|
||||
<artifactId>test</artifactId>
|
||||
</dependency>
|
||||
</dependencies>
|
||||
</project>
|
||||
|
||||
@ -1,24 +0,0 @@
|
||||
package com.antgroup.openspg.cloudext.interfaces.graphstore
|
||||
|
||||
import com.antgroup.openspg.core.schema.model.BasicInfo
|
||||
import com.antgroup.openspg.core.schema.model.identifier.PredicateIdentifier
|
||||
import com.antgroup.openspg.core.schema.model.identifier.SPGTypeIdentifier
|
||||
import com.antgroup.openspg.core.schema.model.predicate.Property
|
||||
import com.antgroup.openspg.core.schema.model.type.EntityType
|
||||
import com.antgroup.openspg.core.schema.model.type.ParentTypeInfo
|
||||
import spock.lang.Specification
|
||||
|
||||
class RecordGenerator extends Specification {
|
||||
|
||||
public final static ParentTypeInfo THING = new ParentTypeInfo(1L, 1L, SPGTypeIdentifier.parse("THING"), [])
|
||||
|
||||
public final static EntityType PERSON = new EntityType(
|
||||
new BasicInfo<SPGTypeIdentifier>(SPGTypeIdentifier.parse("RiskMining.Person")),
|
||||
THING,
|
||||
[
|
||||
new Property(
|
||||
new BasicInfo<PredicateIdentifier>(new PredicateIdentifier(""))
|
||||
)
|
||||
]
|
||||
)
|
||||
}
|
||||
5
pom.xml
5
pom.xml
@ -59,6 +59,11 @@
|
||||
<dependencyManagement>
|
||||
<dependencies>
|
||||
<!-- openspg start -->
|
||||
<dependency>
|
||||
<groupId>com.antgroup.openspg.builder</groupId>
|
||||
<artifactId>test</artifactId>
|
||||
<version>${project.version}</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>com.antgroup.openspg.server</groupId>
|
||||
<artifactId>common-model</artifactId>
|
||||
|
||||
@ -22,6 +22,10 @@
|
||||
|
||||
<artifactId>test</artifactId>
|
||||
<dependencies>
|
||||
<dependency>
|
||||
<groupId>com.antgroup.openspg.server</groupId>
|
||||
<artifactId>core-schema-model</artifactId>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.springframework</groupId>
|
||||
<artifactId>spring-context</artifactId>
|
||||
|
||||
@ -0,0 +1,100 @@
|
||||
package com.antgroup.openspg.server;
|
||||
|
||||
import static com.antgroup.openspg.server.StandardTypes.CHINA_MOBILE;
|
||||
import static com.antgroup.openspg.server.TestCommons.*;
|
||||
import static com.antgroup.openspg.server.TestCommons.THING;
|
||||
|
||||
import com.antgroup.openspg.core.schema.model.BasicInfo;
|
||||
import com.antgroup.openspg.core.schema.model.identifier.SPGTypeIdentifier;
|
||||
import com.antgroup.openspg.core.schema.model.type.*;
|
||||
import com.google.common.collect.Lists;
|
||||
|
||||
public class RiskMiningSchema {
|
||||
|
||||
public static final String NAMESPACE = "RiskMining";
|
||||
|
||||
/** basic type */
|
||||
public static final BasicType LONG = new BasicType.LongBasicType();
|
||||
|
||||
public static final BasicType TEXT = new BasicType.TextBasicType();
|
||||
public static final BasicType DOUBLE = new BasicType.DoubleBasicType();
|
||||
|
||||
/** concept type */
|
||||
public static final ConceptType TAX_OF_RISK_USER =
|
||||
new ConceptType(
|
||||
new BasicInfo<>(newSPGTypeIdentifier("TaxOfRiskUser")),
|
||||
THING,
|
||||
Lists.newArrayList(),
|
||||
Lists.newArrayList(),
|
||||
new SPGTypeAdvancedConfig(),
|
||||
new ConceptLayerConfig("isA", Lists.newArrayList()),
|
||||
new ConceptTaxonomicConfig(newSPGTypeIdentifier("Person")),
|
||||
null);
|
||||
|
||||
public static final ConceptType TAX_OF_RISK_APP =
|
||||
new ConceptType(
|
||||
new BasicInfo<>(newSPGTypeIdentifier("TaxOfRiskApp")),
|
||||
THING,
|
||||
Lists.newArrayList(),
|
||||
Lists.newArrayList(),
|
||||
new SPGTypeAdvancedConfig(),
|
||||
new ConceptLayerConfig("isA", Lists.newArrayList()),
|
||||
new ConceptTaxonomicConfig(newSPGTypeIdentifier("App")),
|
||||
null);
|
||||
|
||||
/** entity type */
|
||||
public static final EntityType CERT =
|
||||
new EntityType(
|
||||
new BasicInfo<>(newSPGTypeIdentifier("Cert")),
|
||||
THING,
|
||||
Lists.newArrayList(newProperty("certNum", "证书编号", TEXT)),
|
||||
Lists.newArrayList(),
|
||||
new SPGTypeAdvancedConfig());
|
||||
|
||||
public static final EntityType APP =
|
||||
new EntityType(
|
||||
new BasicInfo<>(newSPGTypeIdentifier("App")),
|
||||
THING,
|
||||
Lists.newArrayList(
|
||||
newProperty("riskMark", "风险标记", TEXT),
|
||||
newProperty("useCert", "使用证书", CERT),
|
||||
newProperty("belongTo", "属于", TAX_OF_RISK_APP)),
|
||||
Lists.newArrayList(),
|
||||
new SPGTypeAdvancedConfig());
|
||||
|
||||
public static final EntityType COMPANY =
|
||||
new EntityType(
|
||||
new BasicInfo<>(newSPGTypeIdentifier("Company")),
|
||||
THING,
|
||||
Lists.newArrayList(newProperty("hasPhone", "电话号码", CHINA_MOBILE)),
|
||||
Lists.newArrayList(newRelation("hasCert", "拥有证书", CERT)),
|
||||
new SPGTypeAdvancedConfig());
|
||||
|
||||
static {
|
||||
COMPANY.getRelations().add(newRelation("holdShare", "持股", COMPANY));
|
||||
}
|
||||
|
||||
public static final EntityType DEVICE =
|
||||
new EntityType(
|
||||
new BasicInfo<>(newSPGTypeIdentifier("Device")),
|
||||
THING,
|
||||
Lists.newArrayList(
|
||||
newProperty("umid", "设备umid", TEXT), newProperty("install", "安装", APP)),
|
||||
Lists.newArrayList(),
|
||||
new SPGTypeAdvancedConfig());
|
||||
|
||||
public static final EntityType PERSON =
|
||||
new EntityType(
|
||||
new BasicInfo<>(newSPGTypeIdentifier("Person")),
|
||||
THING,
|
||||
Lists.newArrayList(
|
||||
newProperty("age", "年龄", LONG),
|
||||
newProperty("hasPhone", "电话号码", CHINA_MOBILE),
|
||||
newProperty("belongTo", "属于", TAX_OF_RISK_USER)),
|
||||
Lists.newArrayList(),
|
||||
new SPGTypeAdvancedConfig());
|
||||
|
||||
private static SPGTypeIdentifier newSPGTypeIdentifier(String identifier) {
|
||||
return SPGTypeIdentifier.parse(NAMESPACE + "_" + identifier);
|
||||
}
|
||||
}
|
||||
@ -0,0 +1,29 @@
|
||||
package com.antgroup.openspg.server;
|
||||
|
||||
import static com.antgroup.openspg.server.TestCommons.THING;
|
||||
|
||||
import com.antgroup.openspg.core.schema.model.BasicInfo;
|
||||
import com.antgroup.openspg.core.schema.model.constraint.RegularConstraint;
|
||||
import com.antgroup.openspg.core.schema.model.identifier.SPGTypeIdentifier;
|
||||
import com.antgroup.openspg.core.schema.model.type.SPGTypeAdvancedConfig;
|
||||
import com.antgroup.openspg.core.schema.model.type.StandardType;
|
||||
import com.google.common.collect.Lists;
|
||||
|
||||
public class StandardTypes {
|
||||
|
||||
public static final StandardType CHINA_MOBILE =
|
||||
new StandardType(
|
||||
new BasicInfo<>(newStandardIdentifier("ChinaMobile")),
|
||||
THING,
|
||||
Lists.newArrayList(),
|
||||
Lists.newArrayList(),
|
||||
new SPGTypeAdvancedConfig(),
|
||||
Boolean.TRUE,
|
||||
Lists.newArrayList(
|
||||
new RegularConstraint(
|
||||
"^((13[0-9])|(14[5,7,9])|(15([0-3]|[5-9]))|(16[5,6])|(17[0-8])|(18[0-9])|(19[1,5,8,9]))[0-9]{8}$")));
|
||||
|
||||
private static SPGTypeIdentifier newStandardIdentifier(String identifier) {
|
||||
return SPGTypeIdentifier.parse("STD" + "_" + identifier);
|
||||
}
|
||||
}
|
||||
@ -0,0 +1,35 @@
|
||||
package com.antgroup.openspg.server;
|
||||
|
||||
import com.antgroup.openspg.core.schema.model.BasicInfo;
|
||||
import com.antgroup.openspg.core.schema.model.identifier.PredicateIdentifier;
|
||||
import com.antgroup.openspg.core.schema.model.identifier.SPGTypeIdentifier;
|
||||
import com.antgroup.openspg.core.schema.model.predicate.Property;
|
||||
import com.antgroup.openspg.core.schema.model.predicate.PropertyAdvancedConfig;
|
||||
import com.antgroup.openspg.core.schema.model.predicate.Relation;
|
||||
import com.antgroup.openspg.core.schema.model.type.BaseSPGType;
|
||||
import com.antgroup.openspg.core.schema.model.type.ParentTypeInfo;
|
||||
import java.util.ArrayList;
|
||||
|
||||
public class TestCommons {
|
||||
|
||||
public static final ParentTypeInfo THING =
|
||||
new ParentTypeInfo(1L, 1L, SPGTypeIdentifier.parse("THING"), new ArrayList<>());
|
||||
|
||||
public static Property newProperty(String propertyName, String desc, BaseSPGType objectType) {
|
||||
return new Property(
|
||||
new BasicInfo<>(new PredicateIdentifier(propertyName), desc, desc),
|
||||
null,
|
||||
objectType.toRef(),
|
||||
Boolean.FALSE,
|
||||
new PropertyAdvancedConfig());
|
||||
}
|
||||
|
||||
public static Relation newRelation(String propertyName, String desc, BaseSPGType objectType) {
|
||||
return new Relation(
|
||||
new BasicInfo<>(new PredicateIdentifier(propertyName), desc, desc),
|
||||
null,
|
||||
objectType.toRef(),
|
||||
Boolean.FALSE,
|
||||
new PropertyAdvancedConfig());
|
||||
}
|
||||
}
|
||||
Loading…
x
Reference in New Issue
Block a user