Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
A
atlas
Project
Overview
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
dataplatform
atlas
Commits
2769809d
Commit
2769809d
authored
Jan 28, 2015
by
TJBChris
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Added (commented out) code outline for indexing by AttributeDefinition
instead of prop file.
parent
2679dab3
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
46 additions
and
0 deletions
+46
-0
TitanGraphService.java
...e/hadoop/metadata/repository/graph/TitanGraphService.java
+46
-0
No files found.
repository/src/main/java/org/apache/hadoop/metadata/repository/graph/TitanGraphService.java
View file @
2769809d
...
...
@@ -29,9 +29,11 @@ import javax.inject.Inject;
import
javax.inject.Singleton
;
import
com.thinkaurelius.titan.core.PropertyKey
;
import
org.apache.commons.configuration.Configuration
;
import
org.apache.commons.configuration.ConfigurationException
;
import
org.apache.commons.configuration.PropertiesConfiguration
;
import
org.apache.hadoop.metadata.types.TypeSystem
;
import
org.slf4j.Logger
;
import
org.slf4j.LoggerFactory
;
...
...
@@ -58,6 +60,9 @@ public class TitanGraphService implements GraphService {
private
static
final
String
INDEXER_PREFIX
=
"metadata.indexer.vertex."
;
private
static
final
List
<
String
>
acceptedTypes
=
Arrays
.
asList
(
"String"
,
"Int"
,
"Long"
);
// TODO - When we get the TypeSystem to return types, this will support the commented code block below.
//private static final TypeSystem typeSystem = TypeSystem.getInstance();
private
final
TitanGraph
titanGraph
;
/**
...
...
@@ -110,6 +115,7 @@ public class TitanGraphService implements GraphService {
return
graphConfig
;
}
/**
* Initializes the indices for the graph.
* @throws ConfigurationException
...
...
@@ -141,8 +147,47 @@ public class TitanGraphService implements GraphService {
mgmt
.
buildIndex
(
"byType"
,
Vertex
.
class
)
.
addKey
(
typeKey
)
.
buildCompositeIndex
();
//TODO - Once we can get the TypeSystem to give me actual types, the below will be modified and replace the current
//indexer config.
/*
Iterator<String> i = typeSystem.getTypeNames().iterator();
// Get a list of property names to iterate through...
List<String> propList = new ArrayList<>();
while (i.hasNext()) {
String currType = i.next();
Iterator<String> typeDefIterator = null;
while (typeDefIterator.hasNext()) {
// Pull the property name and index, so we can register the name
// and look up the type.
String prop = "";
String type = "";
boolean isUnique = false;
// Add the key.
LOG.info("Adding property: " + prop + " to index as type: "
+ type);
mgmt.addIndexKey(graphIndex, mgmt.makePropertyKey(prop)
.dataType(type.getClass()).make());
}
mgmt.commit();
LOG.info("Index creation complete.");
}
*/
Configuration
indexConfig
=
getConfiguration
(
"indexer.properties"
,
INDEXER_PREFIX
);
// Properties are formatted: prop_name:type;prop_name:type
// E.g. Name:String;Date:Long
if
(!
indexConfig
.
isEmpty
())
{
...
...
@@ -196,6 +241,7 @@ public class TitanGraphService implements GraphService {
mgmt
.
commit
();
LOG
.
info
(
"Index creation complete."
);
}
}
/**
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment